Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No public description #106

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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