Installation

Required dependencies

  • Python 3.5, 3.6, or 3.7

  • numpy (1.12 or later)

  • pandas (0.19.2 or later)

Optional dependencies

For netCDF and IO

  • netCDF4: recommended if youwant to use xarray for reading or writing netCDF files

  • scipy: used as a fallback for reading/writing netCDF3

  • pydap: used as a fallback for accessing OPeNDAP

  • h5netcdf: an alternative library forreading and writing netCDF4 files that does not use the netCDF-C libraries

  • pynio: for reading GRIB and othergeoscience specific file formats

  • zarr: for chunked, compressed, N-dimensional arrays.

  • cftime: recommended if youwant to encode/decode datetimes for non-standard calendars or dates beforeyear 1678 or after year 2262.

  • PseudoNetCDF: recommendedfor accessing CAMx, GEOS-Chem (bpch), NOAA ARL files, ICARTT files(ffi1001) and many other.

  • rasterio: for reading GeoTiffs andother gridded raster datasets. (version 1.0 or later)

  • iris: for conversion to and from iris’Cube objects

  • cfgrib: for reading GRIB files via theECMWF ecCodes library.

For accelerating xarray

  • scipy: necessary to enable the interpolation features for xarray objects

  • bottleneck: speeds upNaN-skipping and rolling window aggregations by a large factor(1.1 or later)

  • numbagg: for exponential rollingwindow operations

For parallel computing

For plotting

Instructions

xarray itself is a pure Python package, but its dependencies are not. Theeasiest way to get everything installed is to use conda. To install xarraywith its recommended dependencies using the conda command line tool:

  1. $ conda install xarray dask netCDF4 bottleneck

We recommend using the community maintained conda-forge channel if you need difficult-to-build dependencies such as cartopy, pynio or PseudoNetCDF:

  1. $ conda install -c conda-forge xarray cartopy pynio pseudonetcdf

New releases may also appear in conda-forge before being updated in the defaultchannel.

If you don’t use conda, be sure you have the required dependencies (numpy andpandas) installed first. Then, install xarray with pip:

  1. $ pip install xarray

Testing

To run the test suite after installing xarray, first install (via pypi or conda)

  • py.test: Simple unit testing library

  • mock: additional testing library required for python version 2

and runpy.test —pyargs xarray.

Performance Monitoring

A fixed-point performance monitoring of (a part of) our codes can be seen onthis page.

To run these benchmark tests in a local machine, first install

and runasv run # this will install some conda environments in ./.asv/envs