UXARRAY / uxarray

Xarray-styled package for reading and directly operating on unstructured grid datasets following UGRID conventions
https://uxarray.readthedocs.io/
Apache License 2.0
142 stars 31 forks source link

Hard coded `decode_times` parameter in `ux.open_dataset` #766

Closed philipc2 closed 3 months ago

philipc2 commented 3 months ago

Discussed in https://github.com/UXARRAY/uxarray/discussions/764

Originally posted by **tomvothecoder** April 15, 2024 Hi, I'm just wondering why `decode_times=False` is hard-coded in `ux.open_dataset()` and `ux.open_mfdataset()`? https://github.com/UXARRAY/uxarray/blob/54da444302425be04d33abe914062d8ffc5fed35/uxarray/core/api.py#L170-L171 https://github.com/UXARRAY/uxarray/blob/54da444302425be04d33abe914062d8ffc5fed35/uxarray/core/api.py#L259-L260 I'm trying to use xCDAT's temporal [APIs](https://xcdat.readthedocs.io/en/latest/generated/xcdat.temporal.TemporalAccessor.html) on `uxarray.UxDataset` objects, but those APIs require time coordinates to be decoded as `datetime` or `cftime` objects (`decode_times=True`). ### Workaround I was able to decode time coordinates using [`xarray.decode_cf()`](https://docs.xarray.dev/en/stable/generated/xarray.decode_cf.html) with `decode_times=True` and `use_cftime=True`. All downstream xCDAT temporal APIs worked. **However, the issue is that `xarray.decode_cf()` returns an `xarray.Dataset` object, rather than the `uxarray.UxDataset` object. This means all of the `uxarray` attributes and operators are no longer accessible on the returned object.**
tomvothecoder commented 3 months ago

Do you think this will be able to make it in the upcoming release, which I assume is the beginning of May?

I'm doing a demo of UXarray with xCDAT on May 7th so it'd be great to have this change.

philipc2 commented 3 months ago

Do you think this will be able to make it in the upcoming release, which I assume is the beginning of May?

I'm doing a demo of UXarray with xCDAT on May 7th so it'd be great to have this change.

Yes! I'll be getting a fix in today, and it will be out in our April release.

tomvothecoder commented 3 months ago

Awesome. Thanks @philipc2!

tomvothecoder commented 3 months ago

Yes! I'll be getting a fix in today, and it will be out in our April release.

Hi @philipc2, do UXarray releases typically happen at the end of the release month (e.g., end of April for v2024.04.01)?

The attendees at the upcoming E3SM Tutorial Workshop will be using the E3SM Unified Environment, which will include UXarray. I believe the latest version is going to be released on 4/29/24 (cc. @xylar). Just seeing if this fix will be available in a new version in time.

philipc2 commented 3 months ago

Yes! I'll be getting a fix in today, and it will be out in our April release.

Hi @philipc2, do UXarray releases typically happen at the end of the release month (e.g., end of April for v2024.04.01)?

The attendees at the upcoming E3SM Tutorial Workshop will be using the E3SM Unified Environment, which will include UXarray. I believe the latest version is going to be released on 4/29/24 (cc. @xylar). Just seeing if this fix will be available in a new version in time.

We typically do releases on the Tuesday of the final week of iteration. This would of been last week, but we had multiple presentations (EGU & NCAR ISS).

I'll be getting a release out today.

image

tomvothecoder commented 3 months ago

@philipc2 Awesome! Thank you for all your work and helping me out!

chengzhuzhang commented 2 months ago

@philipc2 Congratulation on the new release! Really appreciate your help to work with the E3SM Tutorial time line..

philipc2 commented 2 months ago

@philipc2 Congratulation on the new release! Really appreciate your help to work with the E3SM Tutorial time line..

Thank you! Don't hessite to reach out if anyone else comes up!