Skip to main content

A light-weight class to work with multi-dimensional labeled arrays.

Project description

pyxarr

image image image image

This is a package which provides a minimal and light-weight class to work with multi-dimensional labeled arrays.

Description

The software of pyxarr is written from scratch. I have tried to mimic the classes DataArray, Dataset and Coords from xarray. My main goal is to keep the code light and fast.

Installation

Pyxarr is available as pyxarr on PyPI. To install it use pip:

$ pip install pyxarr

The module pyxarr requires Python3.10+ and Python modules: h5py, numpy.

Usage

Working with a pyxarr DataArray:

import numpy as np
from pyxarr import DataArray

xds = DataArray()
bool(xds) # will return False, thus if xda: ... will work
len(xds)  # will return 0

rng = np.random.default_rng()
xda = DataArray(
   rng.random((120, 11, 17)),
   dims=("time", "y", "x"),
   coords=(
      np.arange("2025-02-24T14:32:00", "2025-02-24T15:32:00", 30, dtype="datetime64[s]"),
      list(range(11)),
      np.arange(17),
   ),
   attrs={
      "long_name": "noisy signal",
      "units": "1",
   },
)
bool(xds)  # returns True
len(xds)   # returns 120
xda.shape  # returns (120, 11, 17)
xda.size   # returns 22440
"x" in xda.coords  # returns True
xda[4, :, :]  # slicing works
xda.coords += ("orbit", list(range(500, 620))  # will add an auxiliary coordinate
xda.swap_dims("orbit", "time")  # will make the auxiliary coordinate the dimension coordinate and visa versa
xda.mean("time")  # will return a new DataArray averaged over the time axis
xda + xda2  # will return a new DataArray with the sum of the data of both arrays, other supported operator are sub, div and mul.

Authors and acknowledgment

The code is developed by R.M. van Hees (SRON)

License

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

pyxarr-0.2.1.tar.gz (200.2 kB view details)

Uploaded Source

Built Distribution

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

pyxarr-0.2.1-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file pyxarr-0.2.1.tar.gz.

File metadata

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

File hashes

Hashes for pyxarr-0.2.1.tar.gz
Algorithm Hash digest
SHA256 5b19d6801f1402b6f92cb5764aa8e80593895d2aa3c95d6079301237b7725deb
MD5 4f274f3235b96d20ea2d4eafbee4646c
BLAKE2b-256 a1c056a694e6074934d84ed64448a1217c081ce665a13c49c8c011deccbbca95

See more details on using hashes here.

File details

Details for the file pyxarr-0.2.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for pyxarr-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 531b828d15c78099ca2452879867ec1e7630894361a429aafa260e37a8e088ea
MD5 814bb13621f2b80350742c3674f8d1ba
BLAKE2b-256 5050f50b6af5efd50baf8e400842c55d804a6c4e10133a9a1f7e8480608afadc

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