Metadata-Version: 2.4
Name: cfdb
Version: 0.8.2
Summary: CF conventions multi-dimensional array storage on top of Booklet
Project-URL: Documentation, https://mullenkamp.github.io/cfdb/
Project-URL: Source, https://github.com/mullenkamp/cfdb
Author-email: mullenkamp <mullenkamp1@gmail.com>
License-File: LICENSE
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.10
Requires-Dist: booklet>=0.9.2
Requires-Dist: cfdb-models>=0.1.0
Requires-Dist: cfdb-vars>=0.2.2
Requires-Dist: geointerp>=0.1.1
Requires-Dist: lz4
Requires-Dist: msgspec
Requires-Dist: numpy>2
Requires-Dist: pyproj>3
Requires-Dist: rechunkit>=0.5.1
Requires-Dist: shapely>2
Requires-Dist: zstandard
Provides-Extra: ebooklet
Requires-Dist: ebooklet>=0.8.1; extra == 'ebooklet'
Provides-Extra: netcdf4
Requires-Dist: cftime; extra == 'netcdf4'
Requires-Dist: h5netcdf; extra == 'netcdf4'
Provides-Extra: xarray
Requires-Dist: xarray; extra == 'xarray'
Description-Content-Type: text/markdown

# cfdb

<p align="center">
    <em>CF conventions multi-dimensional array storage on top of Booklet</em>
</p>

[![build](https://github.com/mullenkamp/cfdb/workflows/Build/badge.svg)](https://github.com/mullenkamp/cfdb/actions)
[![codecov](https://codecov.io/gh/mullenkamp/cfdb/branch/master/graph/badge.svg)](https://codecov.io/gh/mullenkamp/cfdb)
[![PyPI version](https://badge.fury.io/py/cfdb.svg)](https://badge.fury.io/py/cfdb)

---

**Documentation**: <a href="https://mullenkamp.github.io/cfdb/" target="_blank">https://mullenkamp.github.io/cfdb/</a>

**Source Code**: <a href="https://github.com/mullenkamp/cfdb" target="_blank">https://github.com/mullenkamp/cfdb</a>

---

cfdb is a pure Python database for managing labeled multi-dimensional arrays following the [CF conventions](https://cfconventions.org/). It is an alternative to netCDF4/xarray, built on [Booklet](https://github.com/mullenkamp/booklet) for local file storage and [EBooklet](https://github.com/mullenkamp/ebooklet) for S3 sync. Thread-safe and multiprocessing-safe via locks.

## Installation

```bash
pip install cfdb
```

## Quick Example

```python
import cfdb
import numpy as np

with cfdb.open_dataset('example.cfdb', flag='n') as ds:
    lat = ds.create.coord.lat(data=np.linspace(-90, 90, 181, dtype='float32'))
    lon = ds.create.coord.lon(data=np.linspace(-180, 180, 361, dtype='float32'))
    temp = ds.create.data_var.generic('temperature', ('latitude', 'longitude'), dtype='float32')
    temp[:] = np.random.rand(181, 361).astype('float32') * 40 - 10

with cfdb.open_dataset('example.cfdb') as ds:
    for slices, data in ds['temperature'].iter_chunks(include_data=True):
        print(slices, data.shape)

```

## Multivariable Rechunking

Efficiently iterate over multiple variables with synchronized chunks:

```python
with cfdb.open_dataset('data.cfdb') as ds:
    # Synchronized iteration over temperature and pressure
    for target_chunk, var_data in ds.iter_chunks({'latitude': 50, 'longitude': 50}):
        temp = var_data['temperature']
        pres = var_data['pressure']
        # Perform calculations on aligned blocks
```

See the [full documentation](https://mullenkamp.github.io/cfdb/) for user guides, concepts, and API reference.

## License

This project is licensed under the terms of the Apache Software License 2.0.
