xarray extension for dataarray classes
Project description
xarray-dataclasses
xarray extension for dataarray classes
TL;DR
xarray-dataclasses is a third-party Python package which helps to create DataArray classes in the same manner as the Python's native dataclass. Here is an introduction code of what the package provides:
from xarray_dataclasses import DataArray, dataarrayclass
@dataarrayclass
class Image:
"""DataArray class to represent images."""
data: DataArray[('x', 'y'), float]
x: DataArray['x', int] = 0
y: DataArray['y', int] = 0
The key features are:
# create a DataArray instance
image = Image.new([[0, 1], [2, 3]], x=[0, 1], y=[0, 1])
# create a DataArray instance filled with ones
ones = Image.ones((2, 2), x=[0, 1], y=[0, 1])
- Custom DataArray instances with fixed dimensions, datatype, and coordinates can easily be created.
- NumPy-like special functions like
ones()
are provided as class methods.
Requirements
- Python: 3.7, 3.8, or 3.9 (tested by the author)
- Dependencies: See pyproject.toml
Installation
$ pip install xarray-dataclasses
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for xarray_dataclasses-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d1e0a07af560227c1eb82609cbaf570b572a607c9d4095d95fc41fd8934dbb3 |
|
MD5 | 584d2cd21a307e0da036639ddd0ae806 |
|
BLAKE2b-256 | 7b203f95b357989ba801bbda3de607e767ed82198411da8026018786ad7bb888 |