You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are numerous problems caused (in many parts of the code) if we load in data that has only one time value; I've run into this in trying to construct a test case for #129 with a file consisting of a single monthly mean.
I think it mostly has to do with the fact that in that case time is treated as a scalar coordinate and not an indexable dimension. Since there are numerous places where we try to do da.sel or da.isel on the time dimension throughout the code, we run into a lot of problems.
@spencerahill is there a way to enforce that a coordinate is always indexable (in other words make sure that it is always in ds.dims even if it only has one value)?
The text was updated successfully, but these errors were encountered:
What immediately comes to mind for me is for us to just check upon loading if there is only a single time value.
I.e. so data_loader._load_data_from_disk would become:
...
apply_preload_user_commands(file_set)
ds=xr.open_mfdataset(file_set, preprocess=rename_grid_attrs,
concat_dim=internal_names.TIME_STR,
decode_cf=False)
return_ensure_indexable_time(ds)
def_ensure_indexable_time(ds):
""""Force dataset to have indexable time coordinate. The primary use-case is for datasets with a single time-value, which results in a scalar coordinate that is therefore not indexable. """if<insertneededboolhere>:
return<insertneededlogichere>else:
returnds
There are numerous problems caused (in many parts of the code) if we load in data that has only one time value; I've run into this in trying to construct a test case for #129 with a file consisting of a single monthly mean.
I think it mostly has to do with the fact that in that case time is treated as a scalar coordinate and not an indexable dimension. Since there are numerous places where we try to do
da.sel
orda.isel
on the time dimension throughout the code, we run into a lot of problems.@spencerahill is there a way to enforce that a coordinate is always indexable (in other words make sure that it is always in
ds.dims
even if it only has one value)?The text was updated successfully, but these errors were encountered: