Skip to main content

CF conventions multi-dimensional array storage on top of Booklet

Project description

cfdb

CF conventions multi-dimensional array storage on top of Booklet

build codecov PyPI version


Documentation: https://mullenkamp.github.io/cfdb/

Source Code: https://github.com/mullenkamp/cfdb


cfdb is a pure Python database for managing labeled multi-dimensional arrays following the CF conventions. It is an alternative to netCDF4/xarray, built on Booklet for local file storage and EBooklet for S3 sync. Thread-safe and multiprocessing-safe via locks.

Installation

pip install cfdb

Quick Example

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:

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 for user guides, concepts, and API reference.

License

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cfdb-0.8.2.tar.gz (67.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cfdb-0.8.2-py3-none-any.whl (74.6 kB view details)

Uploaded Python 3

File details

Details for the file cfdb-0.8.2.tar.gz.

File metadata

  • Download URL: cfdb-0.8.2.tar.gz
  • Upload date:
  • Size: 67.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.7

File hashes

Hashes for cfdb-0.8.2.tar.gz
Algorithm Hash digest
SHA256 635d53a6ac5042ab1662e1f7fc14c7e58f7bcce2e95135511bf7d05db090deb1
MD5 d7fd56094cd9c4973537c188eeb72d3b
BLAKE2b-256 8e1b73db5b283a3ab4a80be3bae90c475010c357e6b157e36de4769853e8b834

See more details on using hashes here.

File details

Details for the file cfdb-0.8.2-py3-none-any.whl.

File metadata

  • Download URL: cfdb-0.8.2-py3-none-any.whl
  • Upload date:
  • Size: 74.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.7

File hashes

Hashes for cfdb-0.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 335c188c3d166f86345b74b8e291c36efb5ba9fe225afee7be11759c961fd702
MD5 6fe533201634f448755b63dae3e942e4
BLAKE2b-256 8d4a5be43f64f3ec5c7297af4db6c8d1f0c9d30bcc8bb70b132b6e00a9ec5828

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page