Skip to main content

Interface for using cubed with xarray for parallel computation.

Project description

Note: this is a proof-of-concept, and many things are incomplete, untested, or don't work.

cubed-xarray

Interface for using cubed with xarray.

Requirements

  • Cubed version >=0.6.3
  • Xarray version >=2024.02.0

Installation

Install via pip

pip install cubed-xarray

or conda

conda install -c conda-forge cubed-xarray

Importing

You don't need to import this package in user code. Once poperly installed, xarray should automatically become aware of this package via the magic of entrypoints.

Usage

Xarray objects backed by cubed arrays can be created either by:

  1. Passing existing cubed.Array objects to the data argument of xarray constructors,
  2. Calling .chunk on xarray objects,
  3. Passing a chunks argument to xarray.open_dataset.

In (2) and (3) the choice to use cubed.Array instead of dask.array.Array is made by passing the keyword argument chunked_array_type='cubed'. To pass arguments to the constructor of cubed.Array you should pass them via the dictionary from_array_kwargs, e.g. from_array_kwargs={'spec': cubed.Spec(allowed_mem='2GB')}.

If cubed and cubed-xarray are installed but dask is not, then specifying chunked_array_type is not necessary, as the entrypoints system will then default to the only chunked parallel backend available (i.e. cubed).

Sharp Edges 🔪

Some things almost certainly won't work yet:

and some other things might work but have not yet been tried:

  • Saving to formats other than zarr

In general a bug could take the form of an error, or of a silent attempt to coerce the array type to numpy by immediately computing the underlying array.

Tests

Integration tests for wrapping cubed with xarray also live in this repository.

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

cubed-xarray-0.0.5.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

cubed_xarray-0.0.5-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file cubed-xarray-0.0.5.tar.gz.

File metadata

  • Download URL: cubed-xarray-0.0.5.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for cubed-xarray-0.0.5.tar.gz
Algorithm Hash digest
SHA256 b11226df9d868aeb1c6466a09851fab52f5c0fe2e00818c88880278089c9d3b5
MD5 620a325d328686d0ced6c1efb9ca2c48
BLAKE2b-256 7c06f78b1d239a87c9e7a578d5ab428a92c98692280fe2a474c9ca6c4781a8f1

See more details on using hashes here.

File details

Details for the file cubed_xarray-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: cubed_xarray-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for cubed_xarray-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 707a3799017c4866805da6858b186c49b6456293efa67b28de93294af0cb3758
MD5 b96a944537240d6f0ef1672fe10461fc
BLAKE2b-256 363a420e9116bfb373d4e3bbd1e59bc4129904ab67e1aebd777a36ad954243a8

See more details on using hashes here.

Supported by

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