Skip to content

Commit 0611c78

Browse files
authored
fix: make precip_nowcast four dimensional (#530)
1 parent fa1c5d2 commit 0611c78

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

examples/steps_blended_forecast.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,9 @@
265265

266266
precip_forecast = blending.steps.forecast(
267267
precip=radar_precip,
268-
precip_nowcast=fc_lagrangian_extrapolation,
268+
precip_nowcast=np.array(
269+
[fc_lagrangian_extrapolation]
270+
), # Add an extra dimension, becuase precip_nowcast has to be 4-dimensional
269271
precip_models=nwp_precip,
270272
velocity=velocity_radar,
271273
velocity_models=velocity_nwp,
@@ -304,7 +306,7 @@
304306
# forecast has become more important and the forecast starts to resemble the
305307
# NWP forecast more.
306308

307-
fig = plt.figure(figsize=(5, 12))
309+
fig = plt.figure(figsize=(6, 12))
308310

309311
leadtimes_min = [30, 60, 90, 120, 150, 180]
310312
n_leadtimes = len(leadtimes_min)
@@ -329,7 +331,7 @@
329331
plot_precip_field(
330332
fc_lagrangian_extrapolation_mmh[idx, :, :],
331333
geodata=radar_metadata,
332-
title=f"Extrapolated +{leadtime} min",
334+
title=f"NWC +{leadtime} min",
333335
axis="off",
334336
colorscale="STEPS-NL",
335337
colorbar=False,
@@ -355,7 +357,9 @@
355357

356358
precip_forecast = blending.steps.forecast(
357359
precip=radar_precip,
358-
precip_nowcast=fc_lagrangian_extrapolation,
360+
precip_nowcast=np.array(
361+
[fc_lagrangian_extrapolation]
362+
), # Add an extra dimension, becuase precip_nowcast has to be 4-dimensional
359363
precip_models=nwp_precip,
360364
velocity=velocity_radar,
361365
velocity_models=velocity_nwp,
@@ -387,7 +391,7 @@
387391
# Visualize the output
388392
# ~~~~~~~~~~~~~~~~~~~~
389393

390-
fig = plt.figure(figsize=(5, 12))
394+
fig = plt.figure(figsize=(8, 12))
391395

392396
leadtimes_min = [30, 60, 90, 120, 150, 180]
393397
n_leadtimes = len(leadtimes_min)
@@ -422,7 +426,7 @@
422426
# Raw extrapolated nowcast
423427
ax3 = plt.subplot(n_leadtimes, 4, n * 4 + 3)
424428
plot_precip_field(
425-
fc_lagrangian_extrapolation_mmh[0, idx, :, :],
429+
fc_lagrangian_extrapolation_mmh[idx, :, :],
426430
geodata=radar_metadata,
427431
title=f"NWC + {leadtime} min",
428432
axis="off",

0 commit comments

Comments
 (0)