Metadata-Version: 2.1
Name: cubed-xarray
Version: 0.0.4
Summary: Interface for using cubed with xarray for parallel computation.
Author-email: Tom Nicholas <tomnicholas1@googlemail.com>
License: Apache-2
Project-URL: homepage, https://github.com/xarray-contrib/cubed-xarray
Project-URL: documentation, https://github.com/xarray-contrib/cubed-xarray#readme
Project-URL: repository, https://github.com/xarray-contrib/cubed-xarray
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy (>=1.17)
Requires-Dist: xarray (>=2023.05.0)
Requires-Dist: cubed (>=0.6.3)

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

# cubed-xarray

Interface for using [cubed](https://github.com/tomwhite/cubed) with [xarray](https://github.com/pydata/xarray).

## Requirements

- Cubed version >=0.6.3
- Xarray version >=2023.05.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:

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` 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, 
as the entrypoints system will then default to the only chunked parallel backend available (i.e. cubed).

## Tests

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