When slicing a comparer in time (either using start/stop or specific time=) for the purpose of calculating statistics over a sub-period, we also try to slice raw_data.
|
if (start is not None) or (end is not None): |
|
# TODO: can this be done without to_index? (simplify) |
|
d = d.sel(time=d.time.to_index().to_frame().loc[start:end].index) # type: ignore |
|
|
|
# Note: if user asks for a specific time, we also filter raw |
|
raw_mod_data = { |
|
k: v.sel(time=slice(start, end)) for k, v in raw_mod_data.items() |
|
} # type: ignore |
|
if time is not None: |
|
d = d.sel(time=time) |
|
|
|
# Note: if user asks for a specific time, we also filter raw |
|
raw_mod_data = {k: v.sel(time=time) for k, v in raw_mod_data.items()} |
|
if area is not None: |
If model results have been interpolated to the obs, the timesteps in raw data and matched data does not align. This can easily make sel(time=) fail since we have no raw_data on this time step.
Solution:
Try to slice raw_data, otherwhise set None.
When slicing a comparer in time (either using start/stop or specific time=) for the purpose of calculating statistics over a sub-period, we also try to slice raw_data.
modelskill/src/modelskill/comparison/_comparison.py
Lines 862 to 875 in c50518c
If model results have been interpolated to the obs, the timesteps in raw data and matched data does not align. This can easily make sel(time=) fail since we have no raw_data on this time step.
Solution:
Try to slice raw_data, otherwhise set None.