No project description provided
Project description
XCDO
XCDO is a Python-based command-line tool built around Xarray. It provides a collection of operators for working with datasets such as NetCDF, GRIB, and Zarr, using a familiar CDO-style interface. With the help of Python’s type annotations, creating new operators becomes effortless, making it easy to extend the tool with simple functions and build reusable, organised analysis workflows.
Why XCDO?
Why build another CDO-style tool—even if it won’t be as fast as the original CDO? Because XCDO offers a different kind of power:
- Write operators as simple Python functions. If you know Python, you can create new operators instantly. This opens the door for real community-driven development.
- As these operators are Python functions, it can be called from Python scripts as well.
- Use your own code as operators. Drop a Python function into a file and call it like any other XCDO operator. This keeps workflows clean, modular, and easy to reuse.
- Full Zarr support. Since XCDO builds on Xarray, it naturally supports modern formats like Zarr, which CDO doesn’t handle yet.
- Smooth CDO integration. When you need the performance of CDO, you can call it directly with the “-cdo” operator and combine it with XCDO or custom operators in one chain.
With community support, XCDO can grow into a unified library of reusable and well-structured tools for climate and weather analysis.
Installation
$ pip install xcdo
You may want to install xcdo to an isolated virtual environment to avoid conflicts with other packages. Use any virtual environment manager such as micromamba or conda or virtualenv or venv
Optionaly, you may also install cdo for using the -cdo.
Usage
To get a list of all available operators and their short descriptions, use:
$ xcdo --list
$ xcdo --list
Available Operators
┏━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Operator ┃ Description ┃
┡━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ cdo │ Operator to run CDO commands │
│ showtimestamp │ Show time stamp │
│ mermean │ Meridional mean │
│ mermin │ Meridional minimum │
│ mermax │ Meridional maximum │
│ merstd │ Meridional standard deviation │
│ mersum │ Meridional sum │
To get detailed information and the synopsis (or signature) about a specific operator, use:
$ xcdo --show <operator>
$ xcdo --show selvar
╭─ Synopsis ──────────────────────────────────────────────────╮
│ │
│ xcdo -selvar,name input output │
│ │
╰─────────────────────────────────────────────────────────────╯
╭─ Description ───────────────────────────────────────────────╮
│ │
│ Select a data variable by name. │
│ │
╰─────────────────────────────────────────────────────────────╯
Positional Arguments
┏━━━━━━━━━━━┳━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┓
┃ Parameter ┃ Type ┃ Required ┃ Description ┃
┡━━━━━━━━━━━╇━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━┩
│ name │ TEXT │ Required │ Name of the variable │
└───────────┴──────┴──────────┴──────────────────────┘
╭─ Examples ──────────────────────────────────────────────────╮
│ │
│ xcdo -selvar,tas infile.nc outfile.nc │
│ xcdo -selname,tas infile.nc outfile.nc │
│ │
╰─────────────────────────────────────────────────────────────╯
As it mimics the CDO interface, using XCDO is generally the same as using CDO. for e.g:
$ xcdo -selvar,var1 indata.nc outdata.nc
$ xcdo -timemean -zonmean in.nc out.nc
Custom Operators
A simple python function can be used as a custom operator of XCDO.
For example: a simple operator to print the dataset to terminal can be defined as follows in file a dump.py:
# dump.py
from xcdo import operator, DatasetIn
@operator()
def main(input: DatasetIn):
print(input)
And this can be used as follows in xcdo:
$ xcdo -dump.py in.nc
Notice the ".py" extension for the custom operator? Yes, basically the operator name is just the path of the python file.
You can see the signature and documentation of the custom operator by running:
$ xcdo --show dump.py
╭─ Synopsis ──────────────────────────────────────────────────╮
│ │
│ xcdo -dump.py input │
│ │
╰─────────────────────────────────────────────────────────────╯
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xcdo-0.0.0.tar.gz.
File metadata
- Download URL: xcdo-0.0.0.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da2acd0bc37752dae8f58c485631c111d9714eadc45c5c46e18a856c7cbf5f19
|
|
| MD5 |
027a6387600c8d6d830ab9b6415b48aa
|
|
| BLAKE2b-256 |
8caf4c96c60940eab25114a68d0467a0c1532425479b6b3b8d4ff5efc1a5169a
|
Provenance
The following attestation bundles were made for xcdo-0.0.0.tar.gz:
Publisher:
publish.yml on prajeeshag/xcdo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xcdo-0.0.0.tar.gz -
Subject digest:
da2acd0bc37752dae8f58c485631c111d9714eadc45c5c46e18a856c7cbf5f19 - Sigstore transparency entry: 740124901
- Sigstore integration time:
-
Permalink:
prajeeshag/xcdo@c939b09ebcbf658a01f4d6c101c57dbfdf3b1ae5 -
Branch / Tag:
refs/tags/v0.0.0 - Owner: https://github.com/prajeeshag
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c939b09ebcbf658a01f4d6c101c57dbfdf3b1ae5 -
Trigger Event:
release
-
Statement type:
File details
Details for the file xcdo-0.0.0-py3-none-any.whl.
File metadata
- Download URL: xcdo-0.0.0-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec09cda03ba9f0d02195142c941960f1970adfff3e80fb43e2cb7908d7abf707
|
|
| MD5 |
cbd76a7c0d9bc0312075cdcfca5ccfe3
|
|
| BLAKE2b-256 |
64df832b1dcb21285508f52ab8ed26cbc4823cd051868ea1f50ccfa2a3d11d05
|
Provenance
The following attestation bundles were made for xcdo-0.0.0-py3-none-any.whl:
Publisher:
publish.yml on prajeeshag/xcdo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xcdo-0.0.0-py3-none-any.whl -
Subject digest:
ec09cda03ba9f0d02195142c941960f1970adfff3e80fb43e2cb7908d7abf707 - Sigstore transparency entry: 740124906
- Sigstore integration time:
-
Permalink:
prajeeshag/xcdo@c939b09ebcbf658a01f4d6c101c57dbfdf3b1ae5 -
Branch / Tag:
refs/tags/v0.0.0 - Owner: https://github.com/prajeeshag
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c939b09ebcbf658a01f4d6c101c57dbfdf3b1ae5 -
Trigger Event:
release
-
Statement type: