Package: xarray
xarray: N-D labeled arrays and datasetsxarray(pronounced "ex-array", formerly known asxray) 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 rawNumPy-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 frompandas, the popular data analysis package
focused on labelled tabular data. It is particularly tailored to working
withnetCDFfiles, which
were the source of xarray's data model, and integrates tightly withdaskfor 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,NumPyprovides 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']orx.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.DocumentationLearn more about xarray in its official documentation athttps://docs.xarray.dev/.Try out aninteractive Jupyter
notebook.ContributingYou can find information about contributing to xarray at ourContributing
page.Get in touchAsk usage questions ("How do I?") onGitHub Discussions.Report bugs, suggest features or view the source codeon
GitHub.For less well defined questions or ideas, or to announce other
projects of interest to xarray users, use themailing
list.NumFOCUSXarray is a fiscally sponsored project ofNumFOCUS, a nonprofit dedicated to supporting
the open source scientific computing community. If you like Xarray and
want to support our mission, please consider making adonationto support
our efforts.HistoryXarray is an evolution of an internal tool developed atThe 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 ofNumFOCUSin August 2018.ContributorsThanks to our many contributors!LicenseCopyright 2014-2023, xarray DevelopersLicensed 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 athttps://www.apache.org/licenses/LICENSE-2.0Unless 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.pyNumPy:xarray/core/npcompat.pySeaborn:_determine_cmap_paramsinxarray/core/plot/utils.pyXarray also bundles portions of CPython, which is available under the
"Python Software Foundation License" inxarray/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.