N-D labeled arrays and datasets in Python
Branch: master
Clone or download
spencerkclark Add use_cftime option to open_dataset (#2759)
* Add use_cftime option to open_dataset

* Remove f-strings

* Fix test-skipping logic and remove 'dummy' from warning

* Note that use_cftime is only relevant for standard calendar dates

* Move use_cftime option to CFDatetimeCoder constructor
Latest commit 612d390 Feb 19, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github deprecate compat & encoding (#2703) Feb 1, 2019
asv_bench Update asv.conf.json (#2693) Jan 19, 2019
ci Fix mypy errors (#2753) Feb 8, 2019
doc Add use_cftime option to open_dataset (#2759) Feb 19, 2019
examples fix examples (#2581) Nov 28, 2018
licenses isin: better docs, support older numpy and use dask.array.isin. (#2038) Apr 6, 2018
properties isort (#2469) Oct 7, 2018
xarray Add use_cftime option to open_dataset (#2759) Feb 19, 2019
.coveragerc Fixing xray -> xarray Jan 18, 2016
.gitattributes Versioneer (#2163) May 20, 2018
.gitignore Align DataArrays based on coords in Dataset constructor (#1826) May 31, 2018
.landscape.yml add landscape.yml config file and landscape badge to readme Sep 30, 2015
.pep8speaks.yml Use pycodestyle for lint checks. (#2642) Jan 3, 2019
.travis.yml remove bottleneck dev build from travis, this test env was failing to… Feb 3, 2019
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Jan 10, 2018
HOW_TO_RELEASE Simplify release checklist Jul 18, 2018
LICENSE Initial commit Sep 30, 2013
MANIFEST.in Versioneer (#2163) May 20, 2018
README.rst Update README.rst (#2682) Jan 16, 2019
appveyor.yml DEP: drop python 2 support and associated ci mods (#2637) Jan 2, 2019
conftest.py dl tutorial files to tmp directory, then move them once successful (#… May 21, 2017
readthedocs.yml Make RTD builds faster (#2310) Jul 27, 2018
setup.cfg Update computation.py to use Python 3 function signatures (#2756) Feb 12, 2019
setup.py Remove py2 compat (#2645) Jan 25, 2019
versioneer.py Flake fixed (#2629) Dec 25, 2018


xarray: N-D labeled arrays and datasets

https://travis-ci.org/pydata/xarray.svg?branch=master https://ci.appveyor.com/api/projects/status/github/pydata/xarray?svg=true&passingText=passing&failingText=failing&pendingText=pending https://readthedocs.org/projects/xray/badge/?version=latest http://img.shields.io/badge/benchmarked%20by-asv-green.svg?style=flat

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.

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.


Learn more about xarray in its official documentation at http://xarray.pydata.org/


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

Get in touch

  • Ask usage questions ("How do I?") on StackOverflow.
  • 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.



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.


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.


Copyright 2014-2019, 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


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.

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