Xarray adds named dimensions, coordinates, and attributes on NumPy-like arrays for labeled multi-dimensional data. It integrates with pandas, Dask, and NetCDF-style I/O.
Overview
Xarray is a Python package for working with labelled multi-dimensional arrays and datasets. It layers dimension names, coordinate labels, and metadata attributes on top of NumPy-style array storage to simplify selection, alignment, and computation.
Operations can reference dimension names instead of axis indices, select by coordinate labels, broadcast using named dimensions, group and aggregate with groupby, and align datasets with missing-value handling similar to database joins. Arbitrary metadata can be stored in per-object attribute dictionaries.
The library includes a growing set of domain-agnostic analytics and plotting helpers. It is tailored to NetCDF-style data and connects with Dask for parallel array computing. I/O backends support formats including NetCDF, HDF, Zarr, OpenDAP, and GRIB through a flexible backend API.
Xarray interoperates with NumPy, pandas, Dask, and Matplotlib, and is used across fields such as geoscience, engineering, and bioinformatics that rely on gridded labeled data.
Key features
- Named dimensions and coordinates
- Label-based selection and alignment
- Named broadcasting and groupby
- Dataset and DataArray data models
- Metadata attributes on arrays
- Dask parallel array integration
- NetCDF, Zarr, HDF, and GRIB I/O
- Plotting and analytics helpers
Use cases
- Climate and geoscience gridded data
- NetCDF file analysis in Python
- Labeled multi-dimensional statistics
- Parallel computation with Dask arrays
- Coordinate-aware visualization