Skip to main content

Interface for using cupy in xarray, providing convenience accessors.

Project description

cupy-xarray

[!IMPORTANT] ⚠️ This project is looking for maintainers and contributors. Come help out!

GitHub Workflow CI Status pre-commit.ci status Documentation Status

PyPI Conda-forge

NASA-80NSSC22K0345

Interface for using cupy in xarray, providing convenience accessors.

Installation

cupy-xarray will use an existing cupy installation, hence cupy needs to be installed manually! Please follow cupy's install instructions at https://docs.cupy.dev/en/stable/install.html.

From anaconda:

conda install cupy-xarray -c conda-forge

From PyPI:

pip install cupy-xarray

The latest version from Github:

pip install git+https://github.com/xarray-contrib/cupy-xarray.git

Usage

import xarray as xr
import cupy_xarray  # This registers the `DataSet.cupy` and `DataArray.cupy` namespaces but is not used directly

ds = xr.tutorial.load_dataset("air_temperature.nc")
type(ds.air.data)  # numpy.ndarray

%timeit ds.air.mean()  # 8.56 ms ± 15.6 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

ds = ds.cupy.as_cupy()  # Also available via convenience method ds.as_cupy()
type(ds.air.data)  # cupy.core.core.ndarray

%timeit ds.air.mean()  # 2.14 ms ± 21.4 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

ds = ds.as_numpy()
type(ds.air.data)  # numpy.ndarray

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

cupy_xarray-0.1.5.tar.gz (26.0 kB view details)

Uploaded Source

Built Distribution

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

cupy_xarray-0.1.5-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file cupy_xarray-0.1.5.tar.gz.

File metadata

  • Download URL: cupy_xarray-0.1.5.tar.gz
  • Upload date:
  • Size: 26.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cupy_xarray-0.1.5.tar.gz
Algorithm Hash digest
SHA256 87ed31c49fb538f793c6ded8ecb6bd056bafe02e17dc686551b945e26f64c2e4
MD5 aa1558050bf666dbba6778619aa9aed7
BLAKE2b-256 ab4c54e83a5f0fb4c3e42a6578fe98f16d03928c99ab5f5626dc030b94f88927

See more details on using hashes here.

File details

Details for the file cupy_xarray-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: cupy_xarray-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cupy_xarray-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 96772b88070d81e602ddead747cfe41ecb8bcbc9d4939cef43e67571748397e1
MD5 c6d05bee8a82996e19a7f57e419d443c
BLAKE2b-256 ceccd0f2a4908769578ddf352a266f6e1cd03e85c9ed55daac3c0d74a854452e

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