Skip to content

Commit 7573d87

Browse files
uniKorqi422Copilot
andauthored
Update docs/notebooks/era5_to_rocketpy_patch.py
Co-authored-by: Copilot <[email protected]>
1 parent d52653c commit 7573d87

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

docs/notebooks/era5_to_rocketpy_patch.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ def create_era5_compatible_surface(input_path, output_path, target_lat, target_l
1919

2020
# Add v10, u100, v100
2121
if 'v10' not in ds:
22-
ds['v10'] = xr.zeros_like(ds['u10'])
23-
print(" → Added 'v10' (zeroed)")
22+
if 'u10' in ds:
23+
ds['v10'] = xr.zeros_like(ds['u10'])
24+
print(" → Added 'v10' (zeroed)")
25+
else:
26+
raise KeyError("Dataset is missing both 'v10' and 'u10'. Cannot create 'v10'.")
2427
ds['u100'] = ds['u10']
2528
ds['v100'] = ds['v10']
2629
print(" → Added u100/v100")

0 commit comments

Comments
 (0)