py-xarray-regrid

Regridding utility for xarray

https://github.com/xarray-contrib/xarray-regrid

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.2%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Regridding utility for xarray

Basic Info
Statistics
  • Stars: 89
  • Watchers: 7
  • Forks: 8
  • Open Issues: 8
  • Releases: 8
Created over 2 years ago · Last pushed 11 months ago
Metadata Files
Readme Changelog License Citation

README.md

xarray-regrid: Regridding utilities for xarray.

Logo

With xarray-regrid it is possible to regrid between two rectilinear grids. The following methods are supported: - Linear - Nearest-neighbor - Conservative - Cubic - "Most common value", as well as other zonal statistics (e.g., variance or median).

All regridding methods can operate lazily on Dask arrays.

Note that "Most common value" is designed to regrid categorical data to a coarse resolution. For regridding categorical data to a finer resolution, please use "nearest-neighbor" regridder.

PyPI conda-forge DOI Docs

Why xarray-regrid?

Regridding is a common operation in earth science and other fields. While xarray does have some interpolation methods available, these are not always straightforward to use. Additionally, methods such as conservative regridding, or taking the most common value, are not available in xarray.

Installation

For a minimal install: console pip install xarray-regrid

Note: xarray-regrid is also available on conda-forge.

To improve performance in certain cases: console pip install xarray-regrid[accel]

which includes optional extras such as: - dask: parallelization over chunked data - sparse: for performing conservative regridding using sparse weight matrices - opt-einsum: optimized einsum routines used in conservative regridding

Benchmarking varies across different hardware specifications, but the inclusion of these extras can often provide significant speedups.

Usage

The xarray-regrid routines are accessed using the "regrid" accessor on an xarray Dataset: ```py import xarray_regrid

ds = xr.opendataset("inputdata.nc") dsgrid = xr.opendataset("target_grid.nc")

ds.regrid.linear(ds_grid) ```

For examples, see the benchmark notebooks and the demo notebooks.

Benchmarks

The benchmark notebooks contain comparisons to more standard methods (CDO, xESMF).

To be able to run the notebooks, a conda environment is required (due to ESMF and CDO). You can install this environment using the environment.yml file in this repository. Micromamba is a lightweight version of the much faster "mamba" conda alternative.

sh micromamba create -n environment_name -f environment.yml

Acknowledgements

This package was developed under Netherlands eScience Center grant NLESC.OEC.2022.017.

Owner

  • Name: xarray-contrib
  • Login: xarray-contrib
  • Kind: organization

xarray compatible projects

Citation (CITATION.cff)

cff-version: 1.2.0
title: xarray-regrid
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Bart
    family-names: Schilperoort
    email: b.schilperoort@esciencecenter.nl
    affiliation: Netherlands eScience Center
    orcid: 'https://orcid.org/0000-0003-4487-9822'
  - given-names: Yang
    family-names: Liu
    orcid: 'https://orcid.org/0000-0002-1966-8460'
    affiliation: Netherlands eScience Center
  - given-names: Keith
    family-names: Doore
    orcid: 'https://orcid.org/0000-0001-5035-4016'
    affiliation: United States Geological Survey
  - given-names: Sam
    family-names: Levang
    affiliation: Salient Predictions
  - given-names: Ben
    family-names: Mares
    orcid: 'https://orcid.org/0000-0002-1036-0793'
    affiliation: Tensorial (EI Bernard Mares)
    email: services-xarray-regrid@tensorial.com

repository-code: 'https://github.com/EXCITED-CO2/xarray-regrid'
keywords:
  - xarray
  - geospatial
  - regridding
  - conservative regridding
license: Apache-2.0
abstract: >
  xarray-regrid can regrid (geospatial) data to a new
  coordinate system.


  Features:

  - Linear, nearest-neighbor, cubic, conservative regridding
  methods.

  - Fully implemented in Python, no conda or binaries
  required.

  - Both lazy and parallelized computation with Dask,.

  - Benchmarks to validate the results against standard
  methods are available.

GitHub Events

Total
  • Create event: 5
  • Release event: 1
  • Issues event: 8
  • Watch event: 23
  • Delete event: 3
  • Issue comment event: 5
  • Push event: 10
  • Pull request review event: 7
  • Pull request event: 10
  • Fork event: 2
Last Year
  • Create event: 5
  • Release event: 1
  • Issues event: 8
  • Watch event: 23
  • Delete event: 3
  • Issue comment event: 5
  • Push event: 10
  • Pull request review event: 7
  • Pull request event: 10
  • Fork event: 2

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 64
  • Total Committers: 4
  • Avg Commits per committer: 16.0
  • Development Distribution Score (DDS): 0.219
Past Year
  • Commits: 20
  • Committers: 3
  • Avg Commits per committer: 6.667
  • Development Distribution Score (DDS): 0.45
Top Committers
Name Email Commits
Bart Schilperoort b****t@e****l 50
Sam Levang s****g@s****m 11
Keith Doore 5****e 2
Ben Mares s****1@t****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 35
  • Total pull requests: 25
  • Average time to close issues: 4 months
  • Average time to close pull requests: 7 days
  • Total issue authors: 8
  • Total pull request authors: 4
  • Average comments per issue: 1.43
  • Average comments per pull request: 1.68
  • Merged pull requests: 24
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 8
  • Pull requests: 13
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 4 days
  • Issue authors: 3
  • Pull request authors: 3
  • Average comments per issue: 3.0
  • Average comments per pull request: 2.0
  • Merged pull requests: 13
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • BSchilperoort (21)
  • ClaireDons (1)
  • TimBusker (1)
  • maresb (1)
  • SarahAlidoost (1)
  • folmerkrikken (1)
Pull Request Authors
  • BSchilperoort (21)
  • slevang (8)
  • kjdoore (2)
  • maresb (2)
Top Labels
Issue Labels
bug (3) stat (2) enhancement (2) conservative (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
  • Total maintainers: 1
spack.io: py-xarray-regrid

Regridding utility for xarray

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Average: 27.9%
Dependent packages count: 55.7%
Maintainers (1)
Last synced: 7 months ago

Dependencies

.github/workflows/build_test.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
.github/workflows/lint.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
.github/workflows/publish.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
  • pypa/gh-action-pypi-publish 27b31702a0e7fc50959f5ad993c78deac1bdfc29 composite
pyproject.toml pypi
  • flox *
  • numpy *
  • scipy *
  • xarray *
environment.yml conda
  • cdo
  • python 3.12
  • xesmf