Metadata-Version: 2.4
Name: reki
Version: 2026.11.0
Summary: A data preparation tool for CEMC/CMA.
Author-email: Wang Dapeng <perillaroc@gmail.com>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/cemc-oper/reki
Project-URL: Documentation, https://reki.readthedocs.io
Project-URL: Repository, https://github.com/cemc-oper/reki.git
Keywords: data,grib2,cemc
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cedarkit-query<0.3,>=0.2.3
Requires-Dist: pyyaml
Requires-Dist: jinja2
Requires-Dist: numpy
Requires-Dist: pandas
Requires-Dist: xarray
Requires-Dist: scipy
Requires-Dist: click
Requires-Dist: tqdm
Requires-Dist: requests
Requires-Dist: eccodes
Requires-Dist: eccodeslib<2.49; platform_system != "Windows"
Requires-Dist: eckitlib<2.3; platform_system != "Windows"
Requires-Dist: importlib-metadata; python_version < "3.8"
Provides-Extra: cmadaas
Requires-Dist: nuwe-cmadaas>=0.4.0; extra == "cmadaas"
Provides-Extra: lazy
Requires-Dist: dask; extra == "lazy"
Dynamic: license-file

# reki

[![GitHub Release](https://img.shields.io/github/v/release/cemc-oper/reki)](https://github.com/cemc-oper/reki/releases)
[![PyPI](https://img.shields.io/pypi/v/reki)](https://pypi.org/project/reki/)
[![CI](https://github.com/cemc-oper/reki/actions/workflows/ci.yaml/badge.svg)](https://github.com/cemc-oper/reki/actions/workflows/ci.yaml)
[![License](https://img.shields.io/github/license/cemc-oper/reki)](https://github.com/cemc-oper/reki/blob/main/LICENSE)

`reki` is a Python library for finding, reading, and processing meteorological
data. It decodes GRIB2 messages with ecCodes and converts selected fields to
xarray datasets.

## Features

- Find data in local and mounted archives using path templates, and download files from URLs.
- Select GRIB2 fields by parameter name, level, reference time, forecast lead, or encoded GRIB keys.
- Read NetCDF, GrADS, and tabular data with format-specific readers.
- Extract regions, sample points, and interpolate gridded data.

### Data sources

| `kind` | Use case |
| --- | --- |
| `file` | Read a local GRIB2 file at a known path. |
| `local` | Find and read GRIB2 files in a mounted archive using a dataset ID and mount root. |
| `cmadaas` | Query CMADaaS MUSIC using a dataset ID and a CedarKit YAML file with connection settings and credentials. |

## Installation

reki requires Python 3.11 or newer. Install a release from PyPI.

```bash
python -m pip install reki
```

To use the API shown below from a checkout, run `python -m pip install .`
from the repository root.

Install `reki[cmadaas]` for CMADaaS MUSIC access or `reki[lazy]` for
Dask-backed arrays in supported readers.

## Quick start

Read 2 m air temperature from a local GRIB2 file with one matching field.
For a public ECMWF IFS example, run `reki-test-data download ecmwf_ifs` and
replace `forecast.grib2` with the downloaded file path.

```python
from reki import from_source

with from_source({"kind": "file", "path": "forecast.grib2"}) as source:
    temperature = source.sel(parameter="t2m").one().to_xarray()["t2m"]

print(temperature)
```

With the ECMWF IFS sample, the output is an `xarray.DataArray` named `t2m`
with `units` set to `K` (kelvin).

## Documentation

[中文文档](https://reki.readthedocs.io/)

## Contributing

Report bugs or request features on [GitHub Issues](https://github.com/cemc-oper/reki/issues).

## License

`reki` is licensed under the
[Apache License 2.0](https://github.com/cemc-oper/reki/blob/main/LICENSE).
