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 >v0.6.0
Installation
Install via pip.
Importing
You don't need to import this package in user code. Once pip install
-ed, 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:
- Passing existing
cubed.Array
objects to thedata
argument of xarray constructors, - Calling
.chunk
on xarray objects, - Passing a
chunks
argument toxarray.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
then pass them via the dictionary from_array_kwargs
, e.g. from_array_kwargs={'spec': cubed.Spec(max_mem=2_000_000)}
.
If cubed and cubed-xarray are installed but dask is not, then specifying the parallel array type to use is not necessary.
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.