xarray

N-D labeled arrays and datasets in Python

https://github.com/pydata/xarray

Science Score: 77.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
    56 of 559 committers (10.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.5%) to scientific vocabulary

Keywords

dask netcdf numpy pandas python xarray

Keywords from Contributors

flexible alignment closember gtk qt tk wx meteorology earth-science weather
Last synced: 6 months ago · JSON representation ·

Repository

N-D labeled arrays and datasets in Python

Basic Info
  • Host: GitHub
  • Owner: pydata
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Homepage: https://xarray.dev
  • Size: 48.2 MB
Statistics
  • Stars: 3,946
  • Watchers: 105
  • Forks: 1,169
  • Open Issues: 1,292
  • Releases: 108
Topics
dask netcdf numpy pandas python xarray
Created over 12 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing Funding License Code of conduct Citation

README.md

xarray: N-D labeled arrays and datasets

CI Code coverage Docs Benchmarked with asv Formatted with black Checked with mypy Available on pypi PyPI - Downloads Conda - Downloads DOI Examples on binder Twitter

xarray (pronounced "ex-array", formerly known as xray) is an open source project and Python package that makes working with labelled multi-dimensional arrays simple, efficient, and fun!

Xarray introduces labels in the form of dimensions, coordinates and attributes on top of raw NumPy-like arrays, which allows for a more intuitive, more concise, and less error-prone developer experience. The package includes a large and growing library of domain-agnostic functions for advanced analytics and visualization with these data structures.

Xarray was inspired by and borrows heavily from pandas, the popular data analysis package focused on labelled tabular data. It is particularly tailored to working with netCDF files, which were the source of xarray\'s data model, and integrates tightly with dask for parallel computing.

Why xarray?

Multi-dimensional (a.k.a. N-dimensional, ND) arrays (sometimes called "tensors") are an essential part of computational science. They are encountered in a wide range of fields, including physics, astronomy, geoscience, bioinformatics, engineering, finance, and deep learning. In Python, NumPy provides the fundamental data structure and API for working with raw ND arrays. However, real-world datasets are usually more than just raw numbers; they have labels which encode information about how the array values map to locations in space, time, etc.

Xarray doesn\'t just keep track of labels on arrays -- it uses them to provide a powerful and concise interface. For example:

  • Apply operations over dimensions by name: x.sum('time').
  • Select values by label instead of integer location: x.loc['2014-01-01'] or x.sel(time='2014-01-01').
  • Mathematical operations (e.g., x - y) vectorize across multiple dimensions (array broadcasting) based on dimension names, not shape.
  • Flexible split-apply-combine operations with groupby: x.groupby('time.dayofyear').mean().
  • Database like alignment based on coordinate labels that smoothly handles missing values: x, y = xr.align(x, y, join='outer').
  • Keep track of arbitrary metadata in the form of a Python dictionary: x.attrs.

Documentation

Learn more about xarray in its official documentation at https://docs.xarray.dev/.

Try out an interactive Jupyter notebook.

Contributing

You can find information about contributing to xarray at our Contributing page.

Get in touch

  • Ask usage questions ("How do I?") on GitHub Discussions.
  • Report bugs, suggest features or view the source code on GitHub.
  • For less well defined questions or ideas, or to announce other projects of interest to xarray users, use the mailing list.

NumFOCUS

Xarray is a fiscally sponsored project of NumFOCUS, a nonprofit dedicated to supporting the open source scientific computing community. If you like Xarray and want to support our mission, please consider making a donation to support our efforts.

History

Xarray is an evolution of an internal tool developed at The Climate Corporation. It was originally written by Climate Corp researchers Stephan Hoyer, Alex Kleeman and Eugene Brevdo and was released as open source in May 2014. The project was renamed from "xray" in January 2016. Xarray became a fiscally sponsored project of NumFOCUS in August 2018.

Contributors

Thanks to our many contributors!

Contributors

License

Copyright 2014-2024, xarray Developers

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Xarray bundles portions of pandas, NumPy and Seaborn, all of which are available under a "3-clause BSD" license:

  • pandas: setup.py, xarray/util/print_versions.py
  • NumPy: xarray/core/npcompat.py
  • Seaborn: _determine_cmap_params in xarray/core/plot/utils.py

Xarray also bundles portions of CPython, which is available under the "Python Software Foundation License" in xarray/core/pycompat.py.

Xarray uses icons from the icomoon package (free version), which is available under the "CC BY 4.0" license.

The full text of these licenses are included in the licenses directory.

Owner

  • Name: Python for Data
  • Login: pydata
  • Kind: organization

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - family-names: "Hoyer"
    given-names: "Stephan"
    orcid: "https://orcid.org/0000-0002-5207-0380"
  - family-names: "Roos"
    given-names: "Maximilian"
  - family-names: "Joseph"
    given-names: "Hamman"
    orcid: "https://orcid.org/0000-0001-7479-8439"
  - family-names: "Magin"
    given-names: "Justus"
    orcid: "https://orcid.org/0000-0002-4254-8002"
  - family-names: "Cherian"
    given-names: "Deepak"
    orcid: "https://orcid.org/0000-0002-6861-8734"
  - family-names: "Fitzgerald"
    given-names: "Clark"
    orcid: "https://orcid.org/0000-0003-3446-6389"
  - family-names: "Hauser"
    given-names: "Mathias"
    orcid: "https://orcid.org/0000-0002-0057-4878"
  - family-names: "Fujii"
    given-names: "Keisuke"
    orcid: "https://orcid.org/0000-0003-0390-9984"
  - family-names: "Maussion"
    given-names: "Fabien"
    orcid: "https://orcid.org/0000-0002-3211-506X"
  - family-names: "Imperiale"
    given-names: "Guido"
  - family-names: "Clark"
    given-names: "Spencer"
    orcid: "https://orcid.org/0000-0001-5595-7895"
  - family-names: "Kleeman"
    given-names: "Alex"
  - family-names: "Nicholas"
    given-names: "Thomas"
    orcid: "https://orcid.org/0000-0002-2176-0530"
  - family-names: "Kluyver"
    given-names: "Thomas"
    orcid: "https://orcid.org/0000-0003-4020-6364"
  - family-names: "Westling"
    given-names: "Jimmy"
  - family-names: "Munroe"
    given-names: "James"
    orcid: "https://orcid.org/0000-0001-9098-6309"
  - family-names: "Amici"
    given-names: "Alessandro"
    orcid: "https://orcid.org/0000-0002-1778-4505"
  - family-names: "Barghini"
    given-names: "Aureliana"
  - family-names: "Banihirwe"
    given-names: "Anderson"
    orcid: "https://orcid.org/0000-0001-6583-571X"
  - family-names: "Bell"
    given-names: "Ray"
    orcid: "https://orcid.org/0000-0003-2623-0587"
  - family-names: "Hatfield-Dodds"
    given-names: "Zac"
    orcid: "https://orcid.org/0000-0002-8646-8362"
  - family-names: "Abernathey"
    given-names: "Ryan"
    orcid: "https://orcid.org/0000-0001-5999-4917"
  - family-names: "Bovy"
    given-names: "Benoît"
  - family-names: "Omotani"
    given-names: "John"
    orcid: "https://orcid.org/0000-0002-3156-8227"
  - family-names: "Mühlbauer"
    given-names: "Kai"
    orcid: "https://orcid.org/0000-0001-6599-1034"
  - family-names: "Roszko"
    given-names: "Maximilian K."
    orcid: "https://orcid.org/0000-0001-9424-2526"
  - family-names: "Wolfram"
    given-names: "Phillip J."
    orcid: "https://orcid.org/0000-0001-5971-4241"
  - family-names: "Henderson"
    given-names: "Scott"
    orcid: "https://orcid.org/0000-0003-0624-4965"
  - family-names: "Awowale"
    given-names: "Eniola Olufunke"
  - family-names: "Scheick"
    given-names: "Jessica"
    orcid: "https://orcid.org/0000-0002-3421-4459"
  - family-names: "Savoie"
    given-names: "Matthew"
    orcid: "https://orcid.org/0000-0002-8881-2550"
  - family-names: "Littlejohns"
    given-names: "Owen"
title: "xarray"
abstract: "N-D labeled arrays and datasets in Python."
license: Apache-2.0
doi: 10.5281/zenodo.598201
url: "https://xarray.dev/"
repository-code: "https://github.com/pydata/xarray"
preferred-citation:
  type: article
  authors:
    - family-names: "Hoyer"
      given-names: "Stephan"
      orcid: "https://orcid.org/0000-0002-5207-0380"
    - family-names: "Joseph"
      given-names: "Hamman"
      orcid: "https://orcid.org/0000-0001-7479-8439"
  doi: "10.5334/jors.148"
  journal: "Journal of Open Research Software"
  month: 4
  title: "xarray: N-D labeled Arrays and Datasets in Python"
  volume: 5
  issue: 1
  year: 2017

GitHub Events

Total
  • Create event: 39
  • Release event: 7
  • Issues event: 611
  • Watch event: 323
  • Delete event: 27
  • Issue comment event: 2,657
  • Push event: 416
  • Pull request event: 916
  • Pull request review event: 1,615
  • Pull request review comment event: 1,466
  • Fork event: 125
Last Year
  • Create event: 39
  • Release event: 7
  • Issues event: 611
  • Watch event: 323
  • Delete event: 27
  • Issue comment event: 2,657
  • Push event: 416
  • Pull request event: 916
  • Pull request review event: 1,615
  • Pull request review comment event: 1,466
  • Fork event: 125

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 5,593
  • Total Committers: 559
  • Avg Commits per committer: 10.005
  • Development Distribution Score (DDS): 0.774
Past Year
  • Commits: 577
  • Committers: 104
  • Avg Commits per committer: 5.548
  • Development Distribution Score (DDS): 0.842
Top Committers
Name Email Commits
Stephan Hoyer s****r@c****m 1,262
Deepak Cherian d****n 408
Maximilian Roos 5****y 391
keewis k****s 311
Thomas Nicholas t****s@c****u 307
Illviljan 1****n 170
Mathias Hauser m****e 131
Joe Hamman j****n@u****u 114
Spencer Clark s****k@g****m 101
dependabot[bot] 4****] 100
pre-commit-ci[bot] 6****] 98
Clark Fitzgerald c****g@g****m 88
Kai Mühlbauer k****r@u****e 79
Mick m****s@g****m 70
Keisuke Fujii f****p@g****m 69
crusaderky c****y@g****m 69
Joe Hamman j****1@u****u 67
Fabien Maussion f****n@u****t 67
Dimitri Papadopoulos Orfanos 3****s 65
Clark Fitzgerald c****d@c****m 61
Anderson Banihirwe a****e@u****u 60
Benoit Bovy b****y@g****m 58
Thomas Kluyver t****l@g****m 45
alexamici a****i@b****u 28
Ray Bell r****0@g****m 26
James Munroe j****e@m****a 25
Alex Kleeman k****n@c****m 24
aurghs 3****s 24
github-actions[bot] 4****] 20
Mark Harfouche m****e@g****m 20
and 529 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 1,632
  • Total pull requests: 2,486
  • Average time to close issues: over 1 year
  • Average time to close pull requests: about 1 month
  • Total issue authors: 762
  • Total pull request authors: 265
  • Average comments per issue: 4.14
  • Average comments per pull request: 2.56
  • Merged pull requests: 1,821
  • Bot issues: 28
  • Bot pull requests: 117
Past Year
  • Issues: 479
  • Pull requests: 1,157
  • Average time to close issues: 13 days
  • Average time to close pull requests: 6 days
  • Issue authors: 248
  • Pull request authors: 121
  • Average comments per issue: 1.74
  • Average comments per pull request: 1.81
  • Merged pull requests: 839
  • Bot issues: 18
  • Bot pull requests: 55
Top Authors
Issue Authors
  • dcherian (103)
  • TomNicholas (97)
  • max-sixty (60)
  • shoyer (52)
  • github-actions[bot] (27)
  • mathause (23)
  • benbovy (19)
  • rabernat (16)
  • kmuehlbauer (15)
  • keewis (15)
  • Illviljan (14)
  • jhamman (13)
  • hmaarrfk (12)
  • flamingbear (11)
  • eni-awowale (10)
Pull Request Authors
  • dcherian (339)
  • max-sixty (219)
  • TomNicholas (136)
  • keewis (136)
  • kmuehlbauer (129)
  • Illviljan (126)
  • DimitriPapadopoulos (106)
  • shoyer (98)
  • dependabot[bot] (69)
  • benbovy (66)
  • mathause (59)
  • pre-commit-ci[bot] (48)
  • spencerkclark (44)
  • andersy005 (41)
  • hmaarrfk (34)
Top Labels
Issue Labels
bug (517) needs triage (356) enhancement (211) topic-backends (128) topic-documentation (100) topic-zarr (96) topic-DataTree (95) plan to close (77) usage question (72) topic-indexing (68) upstream issue (64) topic-groupby (58) API design (56) topic-dask (44) contrib-good-first-issue (42) contrib-help-wanted (41) topic-performance (39) topic-CF conventions (37) CI (34) needs mcve (32) topic-arrays (27) topic-error reporting (27) topic-typing (26) topic-interpolation (23) topic-cftime (22) topic-plotting (21) design question (20) topic-rolling (18) regression (17) topic-chunked-arrays (16)
Pull Request Labels
plan to merge (497) topic-documentation (344) topic-DataTree (185) topic-backends (157) run-upstream (126) io (121) dependencies (114) topic-zarr (90) run-benchmark (75) topic-indexing (74) topic-typing (74) topic-groupby (64) CI (60) topic-plotting (59) Automation (58) topic-arrays (54) topic-NamedArray (45) topic-cftime (43) topic-rolling (43) topic-dask (39) topic-CF conventions (34) topic-chunked-arrays (34) topic-performance (31) topic-testing (28) needs review (26) topic-error reporting (25) run-slow-hypothesis (23) Release (21) needs work (16) enhancement (14)

Packages

  • Total packages: 7
  • Total downloads:
    • pypi 10,092,275 last-month
  • Total docker downloads: 19,430,565
  • Total dependent packages: 1,732
    (may contain duplicates)
  • Total dependent repositories: 10,016
    (may contain duplicates)
  • Total versions: 271
  • Total maintainers: 5
pypi.org: xarray

N-D labeled arrays and datasets in Python

  • Versions: 97
  • Dependent Packages: 1,350
  • Dependent Repositories: 5,198
  • Downloads: 10,091,425 Last month
  • Docker Downloads: 19,430,565
Rankings
Dependent packages count: 0.0%
Dependent repos count: 0.1%
Downloads: 0.2%
Average: 0.6%
Docker downloads count: 0.6%
Forks count: 1.3%
Stargazers count: 1.3%
Last synced: 6 months ago
conda-forge.org: xarray
  • Versions: 48
  • Dependent Packages: 345
  • Dependent Repositories: 2,401
Rankings
Dependent packages count: 0.2%
Dependent repos count: 0.2%
Average: 3.2%
Forks count: 5.1%
Stargazers count: 7.4%
Last synced: 6 months ago
spack.io: py-xarray

N-D labeled arrays and datasets in Python

  • Versions: 12
  • Dependent Packages: 18
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Forks count: 3.0%
Average: 3.4%
Stargazers count: 4.3%
Dependent packages count: 6.2%
Maintainers (1)
Last synced: 6 months ago
pypi.org: xray

N-D labeled arrays and datasets in Python

  • Versions: 17
  • Dependent Packages: 1
  • Dependent Repositories: 16
  • Downloads: 850 Last month
Rankings
Forks count: 1.3%
Stargazers count: 1.3%
Dependent packages count: 3.3%
Dependent repos count: 3.7%
Average: 4.9%
Downloads: 15.0%
Maintainers (1)
Last synced: 6 months ago
proxy.golang.org: github.com/pydata/xarray
  • Versions: 66
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Forks count: 0.9%
Stargazers count: 1.2%
Average: 5.6%
Dependent packages count: 9.6%
Dependent repos count: 10.8%
Last synced: 6 months ago
anaconda.org: xarray

xarray (formerly xray) is an open source project and Python package that makes working with labelled multi-dimensional arrays simple, efficient, and fun! xarray introduces labels in the form of dimensions, coordinates and attributes on top of raw NumPy_-like arrays, which allows for a more intuitive, more concise, and less error-prone developer experience. The package includes a large and growing library of domain-agnostic functions for advanced analytics and visualization with these data structures. xarray was inspired by and borrows heavily from pandas_, the popular data analysis package focused on labelled tabular data. It is particularly tailored to working with netCDF_ files, which were the source of xarray's data model, and integrates tightly with dask_ for parallel computing.

  • Homepage: https://xarray.dev
  • License: Apache-2.0
  • Latest release: 2025.4.0
    published 9 months ago
  • Versions: 29
  • Dependent Packages: 18
  • Dependent Repositories: 2,401
Rankings
Dependent repos count: 1.1%
Dependent packages count: 1.9%
Average: 7.4%
Forks count: 11.5%
Stargazers count: 15.1%
Last synced: 6 months ago
pypi.org: xarray-map

Plot xarrays lat-lon datasets using folium

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Forks count: 1.3%
Stargazers count: 1.3%
Dependent packages count: 7.2%
Average: 10.8%
Dependent repos count: 33.4%
Last synced: about 1 year ago

Dependencies

.github/workflows/benchmarks.yml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • mamba-org/provision-with-micromamba v14 composite
.github/workflows/ci-additional.yaml actions
  • actions/checkout v3 composite
  • codecov/codecov-action v3.1.1 composite
  • mamba-org/provision-with-micromamba v14 composite
  • xarray-contrib/ci-trigger v1 composite
.github/workflows/ci.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • codecov/codecov-action v3.1.1 composite
  • mamba-org/provision-with-micromamba v14 composite
  • xarray-contrib/ci-trigger v1 composite
.github/workflows/publish-test-results.yaml actions
  • EnricoMi/publish-unit-test-result-action v2 composite
.github/workflows/pypi-release.yaml actions
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • pypa/gh-action-pypi-publish v1.6.4 composite
.github/workflows/upstream-dev-ci.yaml actions
  • actions/checkout v3 composite
  • mamba-org/provision-with-micromamba v14 composite
  • xarray-contrib/ci-trigger v1 composite
  • xarray-contrib/issue-from-pytest-log v1 composite
.github/workflows/benchmarks-last-release.yml actions
  • WyriHaximus/github-action-get-previous-tag v1 composite
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • mamba-org/setup-micromamba v1 composite
.github/workflows/nightly-wheels.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • scientific-python/upload-nightly-action main composite
pyproject.toml pypi
setup.py pypi
.binder/environment.yml conda
  • boto3
  • bottleneck
  • cartopy
  • cfgrib
  • cftime
  • coveralls
  • dask
  • dask_labextension
  • distributed
  • h5netcdf
  • h5py
  • hdf5
  • iris
  • lxml
  • matplotlib
  • nc-time-axis
  • netcdf4
  • numba
  • numbagg
  • numpy
  • packaging
  • pandas
  • pint >=0.22
  • pip
  • pooch
  • pydap
  • pynio
  • python 3.10.*
  • rasterio
  • scipy
  • seaborn
  • setuptools
  • sparse
  • toolz
  • xarray
  • zarr
ci/requirements/environment.yml conda
  • aiobotocore
  • boto3
  • bottleneck
  • cartopy
  • cftime
  • dask-core
  • distributed
  • flox
  • fsspec !=2021.7.0
  • h5netcdf
  • h5py
  • hdf5
  • hypothesis
  • iris
  • lxml
  • matplotlib-base
  • nc-time-axis
  • netcdf4
  • numba
  • numbagg
  • numexpr
  • numpy
  • opt_einsum
  • packaging
  • pandas
  • pint >=0.22
  • pip
  • pooch
  • pre-commit
  • pydap
  • pytest
  • pytest-cov
  • pytest-env
  • pytest-timeout
  • pytest-xdist
  • rasterio
  • scipy
  • seaborn
  • sparse
  • toolz
  • typing_extensions
  • zarr