-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Issue: Input files with the same time but different calendars cannot be identified by TempestExtremes (TE).
Description: Under some circumstances (e.g., WRF), users may use xarray and other Python tools to interpolate model states from model levels to standard pressure levels, then feed TE applications with processed (standard pressure levels) and original WRF (surface) data. Because xarray will read time as numpy.datetime64, the time dimension will be saved with an attribute of “proleptic_gregorian” calendar by default. In this case, time in WRF outputs (standard calendar) and processed data (proleptic_gregorian) have different calendar attributes. When TE applications read files, time in the following files is compared with the one in the first file. In src/base/TimeObj.cpp, operator Time::operator== identifies two time objects by comparing their calendar types and then other member variables, which will result in a time identification error even if the timestamps in different files are the same.
Suggestion: It might be better to add a warning or exception when calendars in files are different or standardize time (i.e., converting to the same calendar) when reading files.
Temporary Solution: The current solution for this issue is to keep the same calendar when processing model data. If choosing xarray, one might use the following command to convert the calendar.
ds = ds.convert_calendar('standard', dim='Time', use_cftime=True)