Skip to main content

xarray-compare

PyPI Python Test License DOI

xarray extension for data comparison

TL;DR

xarray-compare is a third-party Python package which provides extra data-comparison features. After importing the package, several DataArray methods (dataarray.is*()) will be available.

Requirements

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

Installation

$ pip install xarray-compare

List of available methods

  • .isbetween(lower, upper): Test whether each value in a DataArray falls within an interval
  • .ismatch(pattern): Test whether each string in a DataArray matches a regex pattern

Methods of "not-in" version are also provided for readability.

  • .isnotin(values): Equivalent to ~dataarray.isin(values) (.isin() is an xarray's builtin)
  • .isnotbetween(lower, upper): Equivalent to ~dataarray.isbetween(lower, upper)
  • .isnotmatch(pattern): Equivalent to ~dataarray.ismatch(pattern)

Examples

xarray-compare is a just-import package. After importing it, methods become available from normal DataArray instances.

import xarray as xr
import xarray_compare

A method returns a boolean DataArray each value of which is True where that of the input DataArray fulfills the condition and False otherwise. This is why it works well with the dataarray.where() method.

da = xr.DataArray([0, 1, 1, 2, 3, 5, 8, 13])
da.where(da.isbetween(1, 4), drop=True)

# <xarray.DataArray (dim_0: 4)>
# array([1., 1., 2., 3.])
# Dimensions without coordinates: dim_0
da = xr.DataArray(['a', 'aa', 'ab', 'bc'])
da.where(da.ismatch("^a+$"), drop=True)

# <xarray.DataArray (dim_0: 2)>
# array(['a', 'aa'], dtype=object)
# Dimensions without coordinates: dim_0

Metadata

Release files for xarray-compare 0.2.0

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-compare 0.2.0
File Size Uploaded Provenance Actions
xarray-compare-0.2.0.tar.gz 4.8 kB Without provenance Details for xarray-compare-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xarray-compare 0.2.0
File Interpreter ABI Platform Actions
xarray_compare-0.2.0-py3-none-any.whl Python 3 none any Details for xarray_compare-0.2.0-py3-none-any.whl

Total release size: 10.0 kB

Release files / xarray-compare-0.2.0.tar.gz

Download URL xarray-compare-0.2.0.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d7826eda0fe9cf528526a19ad60d4a0dfef37b6caee46cc1d0907a101aec3ee0
BLAKE2b-256 checksum
How to use checksums
695fef313113759b45495dc359a3fb9b8254ca19e12585c71b2571bf892c55c0
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-1034-azure

Release files / xarray_compare-0.2.0-py3-none-any.whl

Download URL xarray_compare-0.2.0-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b1775cb2f399479b4ee0cab53e258b00d258e9a3c93c7778d4f073e6beb3225
BLAKE2b-256 checksum
How to use checksums
cb2928e5fd570a670d1d113fcb3e835e7ee9f29a9c99587f8a8213226970665e
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-1034-azure

Security for xarray-compare 0.2.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

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