GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • .css-12nek11{width:var(--chakra-sizes-32);}
  • Blog
  • Documentation
  • Spanishes
  • Portuguesept

This view

  • Original page
  • New address

GeezerVison is showing xarray.dev β€” Xarray: N-D labeled arrays and datasets in Python

Check out the latest blog post:
Xarray ❀️ napari: A plan for seamless integration

Xarray
N-D labeled arrays and datasets in Python

Xarray is an open source project and Python package that introduces labels in the form of dimensions, coordinates, and attributes on top of raw NumPy-like arrays, which allows for more intuitive, more concise, and less error-prone user experience.

Xarray includes a large and growing library of domain-agnostic functions for advanced analytics and visualization with these data structures.

xarray data structure
Get StartedWhy Xarray?

Key Features & Capabilities

Xarray provides data models for working with labeled arrays and datasets. Its toolkit includes a broad set of domain-agnostic functions for advanced analytics and visualization with these data structures.

Interoperability

Interoperable with the scientific Python ecosystem including NumPy, Dask, Pandas, and Matplotlib.

Apply operations over named dimensions

Select values by label instead of integer location

Vectorized operations

Mathematical operations vectorize across multiple dimensions (array broadcasting) based on dimension names, not shape.

GroupBy operations

Flexible split-apply-combine operations with groupby.

Database like operations

Database like alignment based on coordinate labels that smoothly handles missing values.

Arbitrary metadata tracking

Keep track of arbitrary metadata in the form of a Python dictionary.

Flexible and Extensible I/O backend API

Read and write data to and from NetCDF, HDF, Zarr, OpenDAP, and GRIB.

Try Xarray

Try Xarray in a REPL directly in your browser (no installation needed)!

1"""
2To try Xarray in the browser,
3use the console located πŸ‘‰ or πŸ‘‡:
41. Type code in the input cell and press
5   Shift + Enter to execute
62. Or copy paste the code, and click on
7   the "Run" β–Ά button in the toolbar
8"""
9import xarray as xr
10import pandas as pd
11import numpy as np
12
13data = xr.DataArray(
14    np.random.randn(3, 2, 3),
15    dims=("time", "lat", "lon"),
16    coords={
17        "lat": [10, 20],
18        "time": pd.date_range(
19            "2020-01", periods=3, freq="MS"
20        ),
21    },
22)
23
24# positional and by integer label, like numpy
25data[0, :]
26
27# loc or "location": positional and
28# coordinate label, like pandas
29data.loc[:, 10]
30
31# isel or "integer select": by dimension name
32# and integer label
33data.isel(lat=0)
34
35# sel or "select": by dimension name and
36# coordinate label
37data.sel(time="2020-01")
38
39# Data aggregations uses dimension names
40# instead of axis numbers
41data.mean(dim=["time", "lat"])
42
43# quick and convenient visualizations
44data.isel(lon=0).plot();
45
46# Pretty neat, eh? :)
47# For more, head over to the documentation page

Ecosystem

Xarray is part of the larger scientific Python ecosystem. It is built on top of NumPy, Pandas, and Dask and supports a wide range of domain specific scientific applications.

This section lists some of the standalone packages, projects developed with xarray.

arviz

Backend-agnostic tools for diagnostics and visualizations of Bayesian inference in Python

Bayesian Inference
cf-xarray

An accessor for Xarray objects that interprets Climate and Forecast (CF) metadata convention attributes

🌎 Geoscience
climpred

Verification of weather and climate forecasts

🌎 Geoscience
hvPlot

A high-level plotting API for the PyData ecosystem built on HoloViews

πŸ“Š Visualization
MetPy

Collection of tools for reading, visualizing and performing calculations with weather data

πŸŒͺ🌑 Meteorology
omfit

Integrated modeling and experimental data analysis software for magnetically confined thermonuclear fusion experiments

πŸ’₯ plasma physics
Pangeo

A community platform for Big Data geoscience

🌎 Geoscience
sgkit

Scalable statistical genetic data analysis in Python

🧬 genomics
SquidPy

Collection of tools for the analysis and visualization of spatial molecular data

πŸ’Š Bioinformatics
verde

Python library for processing spatial data and interpolating it on regular grids

πŸ—ΊοΈ Geographic Processing
xarray-spatial

Raster-based Spatial Analytics for Python

πŸ—ΊοΈ Geographic Processing
xgcm

General Circulation Model Postprocessing with xarray

🌊 Oceanography
xmip

Analysis ready CMIP6 data in Python the easy way with pangeo tools.

🌎 Geoscience
See More

Xarray supports multiple array backends, allowing users to choose array types that work best for their application.

NumPy

NumPy

View NumPy's GithubView NumPy's website

NumPy is the fundamental package for array computing with Python.

Dask

Dask

View Dask's GithubView Dask's website

Distributed arrays and advanced parallelism for analytics, enabling performance at scale.

CuPy

CuPy

View CuPy's GithubView CuPy's website

NumPy-compatible array library for GPU-accelerated computing with Python.

Zarr

Zarr

View Zarr's GithubView Zarr's website

An implementation of chunked, compressed, N-dimensional arrays for Python.

Sparse

Sparse

View Sparse's GithubView Sparse's website

Sparse multi-dimensional arrays for the PyData ecosystem

Pint

Pint

View Pint's GithubView Pint's website

Operate and manipulate physical quantities in Python

Supported By

We thank these institutions for generously supporting the development and maintenance of Xarray.

NSFNASACZINVIDIA

Donate

Xarray is a NumFOCUS Sponsored Project, a 501(c)(3) nonprofit charity in the United States. NumFOCUS provides Xarray with fiscal, legal, and administrative support to help ensure the health and sustainability of the project. For more information, visit numfocus.org

If you like Xarray and want to support our mission, please consider making a donation to support our efforts.

Donate
NumFocus logo
You are visitor 01402503 β€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Γ—600. No cookies required.