Skip to content

Commit fba7ec3

Browse files
langmoreWeatherbench2 authors
authored and
Weatherbench2 authors
committed
--levels FLAG added to compute_probabilistic_climatological_forecasts. Allows selecting designated levels from input path.
PiperOrigin-RevId: 703644807
1 parent ce2b78e commit fba7ec3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

scripts/compute_probabilistic_climatological_forecasts.py

+11
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@
100100
2020,
101101
help='Inclusive end year of --input_path to include.',
102102
)
103+
LEVELS = flags.DEFINE_list(
104+
'levels',
105+
None,
106+
help=(
107+
'Comma delimited list of pressure levels to compute spectra on. If'
108+
' empty, compute on all levels of --input_path'
109+
),
110+
)
103111
VARIABLES = flags.DEFINE_list(
104112
'variables',
105113
None,
@@ -504,6 +512,9 @@ def main(argv: abc.Sequence[str]) -> None:
504512

505513
if VARIABLES.value:
506514
input_ds = input_ds[VARIABLES.value]
515+
if LEVELS.value:
516+
input_ds = input_ds.sel(level=[int(l) for l in LEVELS.value])
517+
507518
input_chunks = {k: v for k, v in input_chunks.items() if k in input_ds.dims}
508519

509520
_check_input_spacing_and_time_flags(input_ds)

0 commit comments

Comments
 (0)