Skip to main content

xarray-custom

PyPI Python Test License DOI

: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 coord, dataarrayclass

@dataarrayclass
class Image:
    """DataArray class to represent images."""

    dims = 'x', 'y'
    dtype = float
    accessor = 'img'

    x: coord('x', int) = 0
    y: coord('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.

Requirements

  • Python: 3.6, 3.7, or 3.8 (tested by the author)
  • Dependencies: See pyproject.toml

Installation

$ pip install xarray-custom

License

Copyright (c) 2020 Akio Taniguchi

  • xarray-custom is distributed under the MIT License
  • xarray-custom uses an icon of xarray distributed under the Apache 2.0 license

Metadata

Release files for xarray-custom 0.6.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xarray-custom 0.6.2
File Size Uploaded
xarray-custom-0.6.2.tar.gz 10.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xarray-custom 0.6.2
File Interpreter ABI Platform
xarray_custom-0.6.2-py3-none-any.whl Python 3 none any Details

Total release size: 23.2 kB

Release files / xarray-custom-0.6.2.tar.gz

Download URL xarray-custom-0.6.2.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a503056e2683a0a7f581bdc340a0a63fde92f2d020beccd03e6b2942a74c8d89
BLAKE2b-256 checksum
How to use checksums
370131caa162e9a1f82c2f21b97ceed5afaef5f85b8d7159cb93cde4e667cffc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.7.8 Linux/5.3.0-1032-azure

Release files / xarray_custom-0.6.2-py3-none-any.whl

Download URL xarray_custom-0.6.2-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e78ddf961a8780d6bc8747be03682fe98c30ee64bc80a0c835997b0d0456cf10
BLAKE2b-256 checksum
How to use checksums
fa9a3ce731deee2ce6afbb43985bcee14ac3b459d59d2e2cd0e2df175c608867
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.7.8 Linux/5.3.0-1032-azure

Release history Release notifications | RSS feed

This release

0.6.2 This release

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page