|
1 | | -# Obspec Utils |
| 1 | +# obspec-utils |
2 | 2 |
|
3 | | -[](https://pypi.org/project/obspec-utils) |
4 | | -[](https://pypi.org/project/obspec-utils) |
| 3 | +[![PyPI][pypi_badge]][pypi_link] |
| 4 | +[![PyPI - Python Version][python_badge]][pypi_link] |
5 | 5 |
|
6 | | ------ |
| 6 | +[pypi_badge]: https://img.shields.io/pypi/v/obspec-utils.svg |
| 7 | +[pypi_link]: https://pypi.org/project/obspec-utils/ |
| 8 | +[python_badge]: https://img.shields.io/pypi/pyversions/obspec-utils.svg |
7 | 9 |
|
8 | | -## Table of Contents |
| 10 | +Utilities for cloud data access built on [obspec], fully compatible with [obstore]'s storage classes. |
9 | 11 |
|
10 | | -- [Installation](#installation) |
11 | | -- [License](#license) |
| 12 | +[obspec]: https://github.com/developmentseed/obspec |
| 13 | +[obstore]: https://github.com/developmentseed/obstore |
| 14 | + |
| 15 | +- **File-like readers** that work with xarray, rasterio, h5netcdf, and other libraries expecting file objects. |
| 16 | +- **Composable store wrappers** for caching, request tracing, and splitting large requests. |
| 17 | +- **Glob-style file discovery** with patterns like `data/**/*.nc`, using efficient prefix filtering. |
| 18 | +- **AiohttpStore** for generic HTTPS access (e.g., THREDDS, NASA Earthdata). |
12 | 19 |
|
13 | 20 | ## Installation |
14 | 21 |
|
15 | | -```bash |
16 | | -python -m pip install obspec-utils |
| 22 | +```sh |
| 23 | +pip install obspec-utils |
17 | 24 | ``` |
18 | 25 |
|
19 | | -## Setup development environment |
| 26 | +## Quick Example |
| 27 | + |
| 28 | +```python |
| 29 | +import xarray as xr |
| 30 | +from obstore.store import S3Store |
| 31 | +from obspec_utils.glob import glob |
| 32 | +from obspec_utils.readers import EagerStoreReader |
| 33 | + |
| 34 | +store = S3Store( |
| 35 | + bucket="its-live-data", |
| 36 | + aws_region="us-west-2", |
| 37 | + skip_signature=True, |
| 38 | +) |
20 | 39 |
|
21 | | -```console |
22 | | -git clone https://github.com/virtual-zarr/obspec-utils.git |
23 | | -cd obspec-utils |
24 | | -uv sync --all-groups |
25 | | -uv run --all-groups pytest --cov-config=pyproject.toml --cov=pkg --cov-report xml --cov=src |
| 40 | +# Find NetCDF files matching a pattern |
| 41 | +files = glob(store, "NSIDC/velocity_image_pair_sample/landsatOLI/v02/N20E080/*.nc") |
| 42 | +path = next(files) |
| 43 | + |
| 44 | +with EagerStoreReader(store, path) as reader, xr.open_dataset(reader, engine="h5netcdf") as ds: |
| 45 | + print(ds) |
26 | 46 | ``` |
27 | 47 |
|
| 48 | +## Documentation |
| 49 | + |
| 50 | +Full documentation is available at [obspec-utils.readthedocs.io](https://obspec-utils.readthedocs.io). |
| 51 | + |
28 | 52 | ## License |
29 | 53 |
|
30 | 54 | `obspec-utils` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. |
0 commit comments