pyxarr
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 pyxarr DataArray:
import numpy as np
from pyxarr import DataArray
xda = DataArray()
bool(xda) # will return False, thus if xda: ... will work
len(xda) # 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(xda) # returns True
len(xda) # 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 operators are sub, div and mul.
Working with pyxarr Dataset:
from pyxarr import Dataset
xds = Dataset()
bool(xds) # will return False, thus if xds: ... will work
len(xds) # will return 0
xds["foo"] = xda # adding data to a dataset all dimensions will be added as coordinates
xds.attrs["title"] = "test example" # adding attributes to a dataset
Working with pyxarr Coords:
import numpy as np
from pyxarr import Coords
coords = Coords()
bool(coords) # will return False, thus if xds: ... will work
len(coords) # will return 0
coords += ("time", np.arange("2025-07-01", "2025-08-01", dtype="datetime64[D]))
coords += ("column", np.arange(31)) # adding coordinates
coords = {
"time": np.arange("2025-07-01", "2025-08-01", dtype="datetime64[D]),
"column": np.arange(31),
} # using a dictionary to define the coordinates
coords = [
("time", np.arange("2025-07-28T12:43:00", "2025-07-28T12:58:00", dtype="datetime64[s])),
("column", np.arange(1000)),
("row", np.arange(256)),
] # using a list of tuples to define the coordinates
Time coordinates
Using the CF convensions described in section 4.4, we can define a simple time-coordinate variable as:
double time(time) ;
time:axis = "T" ;
time:standard_name = "time" ;
time:units = "days since 2024-01-01" ; // defaults to UTC
or
double time(time) ;
time:long_time = "sample time" ;
time:axis = "T" ;
time:standard_name = "time" ;
time:units = "seconds since 2024-01-01 00:00:00" ; // defaults to UTC
time:calendar = "proleptic_gregorian" ; // or utc, tai, etc.
time:valid_min = 0. ;
time:valid_max = 172800. ;
You can store any time-coordinate with all its attributes into an pyxarr Coords.
However, often it handy to have the data read into a numpy.datetime64, this is an
option which is offered in the pyxarr tools: dest_from_h5 and dest_to_h5.
Both tools will only perform the conversion when the precision (level of detail or
granularity present) is specified. This can be: days, hours, minutes, seconds,
milli-seconds, micro-seconds, or nano-seconds.
TBW
Authors and acknowledgment
The code is developed by R.M. van Hees (SRON)
License
- Copyright: R.M. van Hees (SRON) (https://www.sron.nl)
- License: Apache-2.0
Metadata
Release files for pyxarr 0.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyxarr-0.5.2.tar.gz | 26.2 kB | With provenance | Details for pyxarr-0.5.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyxarr-0.5.2-py3-none-any.whl | Python 3 | none | any | Details for pyxarr-0.5.2-py3-none-any.whl |
Total release size: 51.0 kB
Release files / pyxarr-0.5.2.tar.gz
| Download URL | pyxarr-0.5.2.tar.gz |
|---|---|
| Size | 26.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
417566612d188f60812ca91eb9cadd0b124383d29fcbacc366eb26c6f776fff4
|
|
BLAKE2b-256 checksum How to use checksums |
607b526e575ce2211ec783ccc4c4eef2905442ff3639127b52efd94009ec0c6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logRelease files / pyxarr-0.5.2-py3-none-any.whl
| Download URL | pyxarr-0.5.2-py3-none-any.whl |
|---|---|
| Size | 24.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
11b6a3b848b2e34e8584e50e5a3c03442e308a37f4c518392ab0ab2bea087a3b
|
|
BLAKE2b-256 checksum How to use checksums |
17b7d0c34666174ec46334de5c4e2c74a006239748c2d3f623ea5e6308678dbe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logSecurity for pyxarr 0.5.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pyxarr-0.5.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.