Skip to content

Commit d6fd074

Browse files
committed
Adopt ICON names after fix in dea87ce
1 parent 383ec0f commit d6fd074

File tree

4 files changed

+29
-27
lines changed

4 files changed

+29
-27
lines changed

src/plotting/colormap_defaults.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ def _fallback():
1212

1313

1414
_CMAP_DEFAULTS = {
15-
"sp": {"cmap": plt.get_cmap("coolwarm", 11), "vmin": 800 * 100, "vmax": 1100 * 100},
16-
"2d": load_ncl_colormap("t2m_29lev.ct"),
17-
"2t": load_ncl_colormap("t2m_29lev.ct") | {"units": "degC"},
18-
"10v": load_ncl_colormap("modified_uv_17lev.ct") | {"units": "m/s"},
19-
"10u": load_ncl_colormap("modified_uv_17lev.ct") | {"units": "m/s"},
20-
"10si": load_ncl_colormap("modified_uv_17lev.ct") | {"units": "m/s"},
15+
"SP": {"cmap": plt.get_cmap("coolwarm", 11), "vmin": 800 * 100, "vmax": 1100 * 100},
16+
"TD_2M": load_ncl_colormap("t2m_29lev.ct"),
17+
"T_2M": load_ncl_colormap("t2m_29lev.ct") | {"units": "degC"},
18+
"V_10M": load_ncl_colormap("modified_uv_17lev.ct") | {"units": "m/s"},
19+
"U_10M": load_ncl_colormap("modified_uv_17lev.ct") | {"units": "m/s"},
20+
"SP_10M": load_ncl_colormap("modified_uv_17lev.ct") | {"units": "m/s"},
2121
# "10si": {"cmap": plt.get_cmap("GnBu", 11), "vmin": 0, "vmax": 25},
22-
"t_850": {"cmap": plt.get_cmap("inferno", 11), "vmin": 220, "vmax": 310},
23-
"z_850": {"cmap": plt.get_cmap("coolwarm", 11), "vmin": 8000, "vmax": 17000},
24-
"q_925": load_ncl_colormap("RH_6lev.ct"),
25-
"tp": {
22+
"T_850": {"cmap": plt.get_cmap("inferno", 11), "vmin": 220, "vmax": 310},
23+
"FI_850": {"cmap": plt.get_cmap("coolwarm", 11), "vmin": 8000, "vmax": 17000},
24+
"QV_925": load_ncl_colormap("RH_6lev.ct"),
25+
"TOT_PREC": {
2626
"colors": [
2727
"#ffffff",
2828
"#04e9e7",

workflow/Snakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ rule showcase_all:
5252
/ "showcases/{run_id}/{init_time}/{init_time}_{param}_{region}.gif",
5353
init_time=[t.strftime("%Y%m%d%H%M") for t in REFTIMES],
5454
run_id=collect_all_candidates(),
55-
param=["tp", "2t", "10si"],
55+
param=["TOT_PREC", "T_2M", "SP_10M"],
5656
region=["globe", "europe", "switzerland"],
5757
),
5858

workflow/rules/plot.smk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ rule plot_forecast_frame:
1818
OUT_ROOT
1919
/ "showcases/{run_id}/{init_time}/frames/{init_time}_{leadtime}_{param}_{region}.png"
2020
),
21+
wildcard_constraints:
22+
leadtime="\d+" # only digits
2123
resources:
2224
slurm_partition="postproc",
2325
cpus_per_task=1,

workflow/scripts/plot_forecast_frame.mo.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ def _(ArgumentParser, Path):
7676
def _(grib_dir, init_time, lead_time, load_state_from_grib, param):
7777
# load grib file
7878
grib_file = grib_dir / f"{init_time}_{lead_time}.grib"
79-
if param == "10si":
80-
paramlist = ["10u", "10v"]
81-
elif param == "si":
82-
paramlist = ["u", "v"]
79+
if param == "SP_10M":
80+
paramlist = ["U_10M", "V_10M"]
81+
elif param == "SP":
82+
paramlist = ["U", "V"]
8383
else:
8484
paramlist = [param]
8585
state = load_state_from_grib(grib_file, paramlist=paramlist)
@@ -158,27 +158,27 @@ def _m_to_mm(arr):
158158

159159
def preprocess_field(param: str, state: dict):
160160
"""
161-
- Temperatures (2t, 2d, t, d): K -> °C
162-
- Wind speed at 10m (10si): m/s -> kn, sqrt(10u^2 + 10v^2)
163-
- Wind speed (si): m/s -> kn, sqrt(u^2 + v^2)
161+
- Temperatures: K -> °C
162+
- Wind speed: sqrt(u^2 + v^2)
163+
- Precipitation: m -> mm
164164
Returns: (field_array, units_override or None)
165165
"""
166166
fields = state["fields"]
167167
# temperature variables
168-
if param in ("2t", "2d", "t", "d"):
168+
if param in ("T_2M", "TD_2M", "T", "TD"):
169169
return _k_to_c(fields[param]), "°C"
170170
# 10m wind speed (allow legacy 'uv' alias)
171-
if param == "10si":
172-
u = fields["10u"]
173-
v = fields["10v"]
171+
if param == "SP_10M":
172+
u = fields["U_10M"]
173+
v = fields["V_10M"]
174174
return np.sqrt(u**2 + v**2), "m/s"
175175
# wind speed from standard-level components
176-
if param == "si":
177-
u = fields["u"]
178-
v = fields["v"]
176+
if param == "SP":
177+
u = fields["U"]
178+
v = fields["V"]
179179
return np.sqrt(u**2 + v**2), "m/s"
180-
if param == "tp":
181-
return _m_to_mm(fields[param]), "mm" # convert m to mm
180+
if param == "TOT_PREC":
181+
return _m_to_mm(fields[param]), "mm"
182182
# default: passthrough
183183
return fields[param], None
184184

0 commit comments

Comments
 (0)