Data classes for custom xarray creation
Project Links
Meta
Author: Akio Taniguchi
Requires Python: >=3.6,<4.0
Classifiers
License
- OSI Approved :: MIT License
Programming Language
- Python :: 3
- Python :: 3.6
- Python :: 3.7
- Python :: 3.8
xarray-custom
:zap: Data classes for custom xarray creation
TL;DR
xarray-custom is a third-party Python package which helps to create custom DataArray classes in the same manner as the Python's native dataclass. Here is an introduction code of what the package provides:
from xarray_custom import ctype, dataarrayclass
@dataarrayclass(accessor='img')
class Image:
"""DataArray class to represent images."""
dims = 'x', 'y'
dtype = float
x: ctype('x', int) = 0
y: ctype('y', int) = 0
def normalize(self):
return self / self.max()
The key features are:
# create a custom DataArray
image = Image([[0, 1], [2, 3]], x=[0, 1], y=[0, 1])
# use a custom method via an accessor
normalized = image.img.normalize()
# create a custom DataArray 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. - Custom DataArray methods can be available via a custom accessor.
Aug 04, 2020
0.6.2
Aug 04, 2020
0.6.1
Aug 04, 2020
0.6.0
May 29, 2020
0.5.1
May 29, 2020
0.5.0
May 28, 2020
0.4.1
May 27, 2020
0.4.0
May 26, 2020
0.3.0
May 10, 2020
0.2.1
May 09, 2020
0.2.0
May 07, 2020
0.1.0
Wheel compatibility matrix
Files in release
Extras:
None
Dependencies:
(<2.0,>=1.18)
numpy
(<6.0,>=5.3)
pyyaml
(<0.11,>=0.10)
toml
(<0.16,>=0.15)
xarray