Skip to content

playing with xcdat #558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

playing with xcdat #558

wants to merge 1 commit into from

Conversation

remicousin
Copy link
Contributor

This is not meant to be merged: this is an experiment about using xcdat to represent Time as intervals as opposed to points only, a prerequisite to make functionality that creates yearly seasonal time series.

For the installation, I ran it only for the linux platform since it seems that the environment for windows goes bananas. You can create the environment following the instructions here

The datasets I tested are ENACTS ones in my shared drive so you'll get access if you work on mako.

I had to copy some functions from enactstozarr to calc to get rid of the CONFIG needs.

You can experiment by running the first test function of test_calc
python -m pytest tests/test_calc.py::test_xcdat
Set the final assess to False and uncomment the prints to see what objects look like.
I left some comments to explain the different things I played with.

Let me know what this inspires you.

@remicousin remicousin self-assigned this Jul 31, 2025
"/data/remic/mydatafiles/Malawi/test/ALL_20200917/MERGED_precip_daily/"
).glob("*.nc")))
data = xr.open_mfdataset(
netcdf,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t it be opened using xc? Did I miss something, or does xcdat act on xr with some parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xc.openmfdataset doesn't work, or rather doesn't bring anything in this case, because the individual ENACTS files don't have time dimension. So I need to reuse what we had written from zarrifcation codes to read the files and get time from file names. Then having xc module available, the DataArray created is considered "xcdat" compatible (there is some sort of boolean attribute showing when printing the DataArray) and then the bounds related functions (that are also xr I believe) or the specific xcdat methods are applicable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants