{"id":18295837,"url":"https://github.com/astropenguin/xarray-compare","last_synced_at":"2025-06-11T21:05:30.123Z","repository":{"id":57477860,"uuid":"286921668","full_name":"astropenguin/xarray-compare","owner":"astropenguin","description":":zap: xarray extension for data comparison","archived":false,"fork":false,"pushed_at":"2020-08-20T07:12:35.000Z","size":1543,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-13T03:38:56.649Z","etag":null,"topics":["python","python-package","xarray"],"latest_commit_sha":null,"homepage":"https://astropenguin.github.io/xarray-compare/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/astropenguin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-12T05:07:00.000Z","updated_at":"2025-04-12T13:35:01.000Z","dependencies_parsed_at":"2022-09-10T08:21:52.689Z","dependency_job_id":null,"html_url":"https://github.com/astropenguin/xarray-compare","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/astropenguin/xarray-compare","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astropenguin%2Fxarray-compare","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astropenguin%2Fxarray-compare/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astropenguin%2Fxarray-compare/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astropenguin%2Fxarray-compare/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/astropenguin","download_url":"https://codeload.github.com/astropenguin/xarray-compare/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astropenguin%2Fxarray-compare/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259340515,"owners_count":22843007,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","python-package","xarray"],"created_at":"2024-11-05T14:38:32.188Z","updated_at":"2025-06-11T21:05:30.106Z","avatar_url":"https://github.com/astropenguin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xarray-compare\n\n[![PyPI](https://img.shields.io/pypi/v/xarray-compare.svg?label=PyPI\u0026style=flat-square)](https://pypi.org/pypi/xarray-compare/)\n[![Python](https://img.shields.io/pypi/pyversions/xarray-compare.svg?label=Python\u0026color=yellow\u0026style=flat-square)](https://pypi.org/pypi/xarray-compare/)\n[![Test](https://img.shields.io/github/workflow/status/astropenguin/xarray-compare/Test?logo=github\u0026label=Test\u0026style=flat-square)](https://github.com/astropenguin/xarray-compare/actions)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg?label=License\u0026style=flat-square)](LICENSE)\n[![DOI](https://img.shields.io/badge/DOI-10.5281/zenodo.3988924-blue?style=flat-square)](https://doi.org/10.5281/zenodo.3988924)\n\nxarray extension for data comparison\n\n## TL;DR\n\nxarray-compare is a third-party Python package which provides extra data-comparison features.\nAfter importing the package, several DataArray methods (`dataarray.is*()`) will be available.\n\n## Requirements\n\n- **Python:** 3.6, 3.7, or 3.8 (tested by the author)\n- **Dependencies:** See [pyproject.toml](https://github.com/astropenguin/xarray-compare/blob/master/pyproject.toml)\n\n## Installation\n\n```shell\n$ pip install xarray-compare\n```\n\n## List of available methods\n\n- `.isbetween(lower, upper)`: Test whether each value in a DataArray falls within an interval\n- `.ismatch(pattern)`: Test whether each string in a DataArray matches a regex pattern\n\nMethods of \"not-in\" version are also provided for readability.\n\n- `.isnotin(values)`: Equivalent to `~dataarray.isin(values)` (`.isin()` is an xarray's builtin)\n- `.isnotbetween(lower, upper)`: Equivalent to `~dataarray.isbetween(lower, upper)`\n- `.isnotmatch(pattern)`: Equivalent to `~dataarray.ismatch(pattern)`\n\n## Examples\n\nxarray-compare is a just-import package.\nAfter importing it, methods become available from normal DataArray instances.\n\n```python\nimport xarray as xr\nimport xarray_compare\n```\n\nA method returns a boolean DataArray each value of which is `True` where that of the input DataArray fulfills the condition and `False` otherwise.\nThis is why it works well with the `dataarray.where()` method.\n\n```python\nda = xr.DataArray([0, 1, 1, 2, 3, 5, 8, 13])\nda.where(da.isbetween(1, 4), drop=True)\n\n# \u003cxarray.DataArray (dim_0: 4)\u003e\n# array([1., 1., 2., 3.])\n# Dimensions without coordinates: dim_0\n```\n\n```python\nda = xr.DataArray(['a', 'aa', 'ab', 'bc'])\nda.where(da.ismatch(\"^a+$\"), drop=True)\n\n# \u003cxarray.DataArray (dim_0: 2)\u003e\n# array(['a', 'aa'], dtype=object)\n# Dimensions without coordinates: dim_0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastropenguin%2Fxarray-compare","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastropenguin%2Fxarray-compare","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastropenguin%2Fxarray-compare/lists"}