Description
What is your issue?
Hi!
I was downloading some data from single files (15min temporal resolution with some smaller gaps here and there) and wanted to save it for further processing. If I reopen the netcdf file, the time dimensions is distorted in a way I cannot really understand. Basically, it changes the 15min difference into something between the first timestamp (e.g. 2018-01-01 00:00:00) and something a few hours later. However, the timestamps are also unordered as the latest time seems to be somewhere in the middle.
my steps are basically a download script which is not really reproducible as it needs login tokens but afterwards everything is purely xarray:
Then, I simply call ds.to_netcdf('filename.nc')
and when I re-open it withxr.open_dataset('filename.nc')
I get this funny data below where the ds.time.max() is array('2018-01-01T09:06:04.000000000', dtype='datetime64[ns]')
with argmax=array(7383, dtype=int64)
, so it is not even increasing.
Interestingly, saving it, opening it and assigning (ds.assign_coords(time=correct_time)
) the correct time values from the ds previously saved and then saving it again seems to be a workaround but I would like to understand if it me missing something or it might be a bug? I had to re-download quite a lot of data due to this as I was not able to recover the correct time dimension from the altered dimension. If I open the corrupted one with decode_times=False
it gives me seconds since 2018-01-01
with only np.unique(ds.time) = 16384
whereas len(ds.time) = 174910
.
Thanks in advance!