Skip to content

Commit

Permalink
Changed call of climatological_mean within compute_horizon to calling…
Browse files Browse the repository at this point in the history
… climatological_op; removed references to climatological_mean in warnings; Warning when op as dict > 1.
  • Loading branch information
vindelico committed Nov 22, 2023
1 parent 2a03ba6 commit d98f082
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions xscen/aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,12 @@ def climatological_op(
# Daily data is not supported
if len(ds.time) > 3 and xr.infer_freq(ds.time) == "D":
raise NotImplementedError(
"xs.climatological_mean does not currently support daily data."
"xs.climatological_op does not currently support daily data."
)
# more than one operation per call is not supported (yet), case for dict
if isinstance(op, dict) and len(op) > 1:
raise NotImplementedError(
"xs.climatological_op does not currently support more than one operation per call."
)

# unstack 1D time in coords (day, month, and year) to make climatological mean faster
Expand Down Expand Up @@ -527,7 +532,7 @@ def compute_deltas(
if "time" in ds:
if (len(ds.time) >= 3) and (xr.infer_freq(ds.time) == "D"):
raise NotImplementedError(
"xs.climatological_mean does not currently support daily data."
"xs.climatological_op does not currently support daily data."
)

# Remove references to 'year' in REF
Expand Down Expand Up @@ -1063,8 +1068,9 @@ def produce_horizon(
ds_merge = xr.Dataset()
for freq, ds_ind in ind_dict.items():
if freq != "fx":
ds_mean = climatological_mean(
ds_mean = climatological_op(
ds_ind,
op="mean",
)
else:
ds_mean = ds_ind
Expand Down

0 comments on commit d98f082

Please sign in to comment.