Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 723815173
  • Loading branch information
raspstephan authored and Weatherbench2 authors committed Feb 6, 2025
1 parent 2eadd37 commit 8e5773f
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions scripts/compute_derived_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,21 @@ def _strip_offsets(


def main(argv: list[str]) -> None:
derived_variables = {
variable_name: dvs.DERIVED_VARIABLE_DICT[variable_name]
for variable_name in DERIVED_VARIABLES.value
}
derived_variables = {}
for variable_name in DERIVED_VARIABLES.value:
# Remove suffix for precipitation accumulations
# E.g. total_precipitation_24hr_from_6hr should also be called
# total_precipitation_24hr
dv = dvs.DERIVED_VARIABLE_DICT[variable_name]
if (
variable_name.startswith('total_precipitation_')
and '_from_' in variable_name
):
variable_name = variable_name.split('_from_')[0]
assert (
variable_name not in DERIVED_VARIABLES.value
), 'Duplicate variable name after removing suffix.'
derived_variables[variable_name] = dv

source_dataset, source_chunks = xbeam.open_zarr(INPUT_PATH.value)

Expand Down

0 comments on commit 8e5773f

Please sign in to comment.