Xcdat
An extension of xarray for climate data analysis on structured grids.
Install / Use
/learn @xCDAT/XcdatREADME
.. raw:: html
<p align="center"> <img src="./docs/_static/xcdat-logo.png" alt="xCDAT logo" style="width:450px;"/> </p>.. container::
.. raw:: html
<h3 align="center">
Xarray Climate Data Analysis Tools
+--------------------+------------------------------------------------------+ | | Badges | +====================+======================================================+ | Distribution | |conda-forge| |platforms| |conda-downloads| | +--------------------+------------------------------------------------------+ | Citation | |zenodo-doi| |joss| | +--------------------+------------------------------------------------------+ | DevOps | |CI/CD Build Workflow| |codecov| |docs| | +--------------------+------------------------------------------------------+ | Quality Assurance | |pre-commit| |ruff| |mypy| | +--------------------+------------------------------------------------------+
.. raw:: html
</h3>
.. |conda-forge| image:: https://img.shields.io/conda/vn/conda-forge/xcdat.svg :target: https://anaconda.org/conda-forge/xcdat .. |platforms| image:: https://img.shields.io/conda/pn/conda-forge/xcdat.svg :target: https://anaconda.org/conda-forge/xcdat .. |conda-downloads| image:: https://anaconda.org/conda-forge/xcdat/badges/downloads.svg :target: https://anaconda.org/conda-forge/xcdat .. |zenodo-doi| image:: https://zenodo.org/badge/354103918.svg :target: https://zenodo.org/badge/latestdoi/354103918 .. |joss| image:: https://joss.theoj.org/papers/10.21105/joss.06426/status.svg :target: https://doi.org/10.21105/joss.06426 .. |CI/CD Build Workflow| image:: https://github.com/xCDAT/xcdat/actions/workflows/build_workflow.yml/badge.svg :target: https://github.com/xCDAT/xcdat/actions/workflows/build_workflow.yml .. |docs| image:: https://readthedocs.org/projects/xcdat/badge/?version=latest :target: https://xcdat.readthedocs.io/en/latest/?badge=latest .. |codecov| image:: https://codecov.io/gh/xCDAT/xcdat/branch/main/graph/badge.svg?token=UYF6BAURTH :target: https://codecov.io/gh/xCDAT/xcdat .. |pre-commit| image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white :target: https://github.com/pre-commit/pre-commit .. |ruff| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json :target: https://github.com/astral-sh/ruff .. |mypy| image:: http://www.mypy-lang.org/static/mypy_badge.svg :target: http://mypy-lang.org/
xCDAT is an extension of xarray_ for climate data analysis on structured grids. It
serves as a modern successor to the Community Data Analysis Tools (CDAT_) library.
Useful links:
Documentation <https://xcdat.readthedocs.io>__ |
Code Repository <https://github.com/xCDAT/xcdat>__ |
Issues <https://github.com/xCDAT/xcdat/issues>__ |
Discussions <https://github.com/xCDAT/xcdat/discussions>__ |
Releases <https://github.com/xCDAT/xcdat/releases>__ |
Mailing List <https://groups.google.com/g/xcdat>__
Project Motivation
The goal of xCDAT is to provide generalizable features and utilities for simple and
robust analysis of climate data. xCDAT’s scope focuses on routine climate research
analysis operations such as loading, averaging, and regridding data on structured grids
(e.g., rectilinear, curvilinear). Some key xCDAT features are inspired by or ported from
the core CDAT library, while others leverage powerful libraries in the xarray ecosystem
(e.g., xESMF, xgcm) to deliver robust APIs. xCDAT has the ability to operate
generally across model and observational datasets that follow the CF Metadata Convention_
by interpreting CF Metadata through the cf_xarray_ package.
The xCDAT core team's mission is to provide a maintainable and extensible package that serves the needs of the climate community in the long-term. We are excited to be working on this project and hope to have you onboard!
.. _xarray: https://github.com/pydata/xarray .. _CDAT: https://github.com/CDAT/cdat
Getting Started
The best resource for getting started is the xCDAT documentation website.
Our documentation provides general guidance for setting up xCDAT in an Anaconda
environment on your local computer or on an HPC/Jupyter_ environment. We also
include an API Overview_ and Gallery_ to highlight xCDAT functionality.
.. _xCDAT documentation website: https://xcdat.readthedocs.io/en/stable/ .. _computer: https://xcdat.readthedocs.io/en/stable/getting-started.html .. _HPC/Jupyter: https://xcdat.readthedocs.io/en/stable/getting-started-hpc-jupyter.html .. _API Overview: https://xcdat.readthedocs.io/en/stable/api.html .. _Gallery: https://xcdat.readthedocs.io/en/stable/gallery.html
Community
xCDAT is a community-driven open source project. We encourage discussion on topics such
as version releases, feature suggestions, and architecture design on the
GitHub Discussions_ page.
Subscribe to our mailing list_ for news and announcements related to xCDAT,
such as software version releases or future roadmap plans.
Please note that xCDAT has a Code of Conduct_. By participating in the xCDAT
community, you agree to abide by its rules.
.. _GitHub Discussions: https://github.com/xCDAT/xcdat/discussions .. _Code of Conduct: CODE-OF-CONDUCT.rst .. _mailing list: https://groups.google.com/g/xcdat
Contributing
We welcome and appreciate contributions to xCDAT. Users and contributors can view and
open issues on our GitHub Issue Tracker_.
For more instructions on how to contribute, please checkout our Contributing Guide_.
.. _GitHub Issue Tracker: https://github.com/xCDAT/xcdat/issues .. _Contributing Guide: https://xcdat.readthedocs.io/en/stable/contributing.html
Features
-
Extension of xarray's
open_dataset()andopen_mfdataset()with post-processing options-
Generate bounds for axes supported by
xcdatif they don't exist in the Dataset -
Optional selection of single data variable to keep in the Dataset (bounds are also kept if they exist)
-
Optional decoding of time coordinates
- In addition to CF time units, also decodes common non-CF time units ("months since ...", "years since ...")
-
Optional centering of time coordinates using time bounds
-
Optional conversion of longitudinal axis orientation between [0, 360) and [-180, 180)
-
-
Temporal averaging
- Time series averages (single snapshot and grouped), climatologies, and departures
- Weighted or unweighted
- Optional seasonal configuration (e.g., DJF vs. JFD, custom seasons)
-
Geospatial weighted averaging
- Supports rectilinear grid
- Optional specification of regional domain
-
Horizontal structured regridding
- Supports rectilinear and curvilinear grids
- Extends the
xESMF_ horizontal regridding API - Python implementation of
regrid2_ for handling cartesian latitude longitude grids
-
Vertical structured regridding
- Support rectilinear and curvilinear grids
- Extends the
xgcm_ vertical regridding API
Things We Are Striving For
-
xCDAT supports CF compliant datasets, but will also strive to support datasets with common non-CF compliant metadata (e.g., time units in "months since ..." or "years since ...")
- xCDAT leverages
cf_xarray_ to interpret CF attributes onxarrayobjects - Refer to
CF Metadata Convention_ for more information on CF attributes
- xCDAT leverages
-
Robust handling of dimensions and their coordinates and coordinate bounds
- Coordinate variables are retrieved with
cf_xarrayusing CF axis names or coordinate names found in xarray object attributes. Refer toMetadata Interpretation_ for more information. - Bounds are retrieved with
cf_xarrayusing the"bounds"attr - Ability to operate on both longitudinal axis orientations, [0, 360) and [-180, 180)
- Coordinate variables are retrieved with
-
Support for parallelism using
dask_ where it is both possible and makes sense
.. _Metadata Interpretation: https://xcdat.readthedocs.io/en/stable/faqs.html#metadata-interpretation .. _xESMF: https://xesmf.readthedocs.io/en/latest/ .. _regrid2: https://cdms.readthedocs.io/en/latest/regrid2.html .. _xgcm: https://xgcm.readthedocs.io/en/latest/index.html .. _dask: https://dask.org/ .. _cf_xarray: https://cf-xarray.readthedocs.io/en/latest/index.html .. _CF Metadata Convention: http://cfconventions.org/
Releases
xCDAT (released as xcdat) follows a feedback-driven release cycle using continuous
integration/continuous deployment. Software releases are performed based on the bandwidth
of the development team, the needs of the community, and the priority of bug fixes or
feature updates.
After releases are performed on GitHub Releases, the corresponding xcdat package
version will be available to download through Anaconda conda-forge usually within a day.
Subscribe to our mailing list_ to stay notified of new releases.
.. _conda-forge: https://anaconda.org/conda-forge/xcdat .. _GitHub Releases: https://anaconda.org/conda-forge/xcdat
Useful Resources
We highly encourage you to checkout the awesome resources below to learn more about Xarray and Xarray usage in climate science!
Official Xarray Tutorials <https://tutorial.xarray.dev/intro.html>_Xarray GitHub Discussion Forum <https://github.com/pydata/xarray/discussions>_Pangeo Forum <https://foundations.projectpythia.org/core/xarray.html>_Project Pythia <https://foundations.projectpythia.org/core/xarray.html>_
Projects Using xCDAT
xCDAT is actively being integrated as a core component of the Program for Climate Model Diagnosis and Intercomparison (PCMDI) Metrics Package_ and the `Ene
