Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 588575786
  • Loading branch information
langmore authored and Weatherbench2 authors committed Dec 12, 2023
1 parent 26b86dd commit 41ad038
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion weatherbench2/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,17 @@ def compute_chunk(
time_dim = "time"
try:
climatology_chunk = self.climatology[list(forecast.keys())]
except KeyError:
except KeyError as e:
not_found = set(forecast.keys()).difference(self.climatology.data_vars)
clim_var_dict = {key + "_mean": key for key in forecast.keys()} # pytype: disable=unsupported-operands
not_found_means = set(clim_var_dict).difference(
self.climatology.data_vars
)
if not_found and not_found_means:
raise KeyError(
f"Did not find {not_found} forecast keys in climatology. Appending "
"'mean' did not help"
) from e
climatology_chunk = self.climatology[list(clim_var_dict.keys())].rename(
clim_var_dict
)
Expand Down

0 comments on commit 41ad038

Please sign in to comment.