xcdat icon indicating copy to clipboard operation
xcdat copied to clipboard

[Feature]: Allow datasets with mixed time types

Open pochedls opened this issue 1 year ago • 1 comments

Is your feature request related to a problem?

One issue with some model datasets is that different chunks of time can be encoded with different calendars. xarray throws an error in these situations.

ds = xc.open_mfdataset("/p/climate/css03/esgf_publish/CMIP6/PMIP/MIROC/MIROC-ES2L/past1000/r1i1p1f2/Amon/tas/gn/v20200318/*nc")

TypeError: Cannot combine along dimension 'time' with mixed types. Found: DatetimeProlepticGregorian, Datetime360Day. If importing data directly from a file then setting use_cftime=True may fix this issue.

This occurs because the first file's time axis is encoded with 360_day and the last is proleptic_gregorian.

Describe the solution you'd like

It would be helpful to use preprocessing to detect this issue and attempt to decode the datasets to a common calendar.

Describe alternatives you've considered

No response

Additional context

No response

pochedls avatar Mar 08 '23 21:03 pochedls