Skip to content
This repository was archived by the owner on Jun 2, 2025. It is now read-only.

Commit 681daa8

Browse files
committed
add if statement
1 parent c2c363e commit 681daa8

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

ocf_datapipes/training/windnet.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,15 @@ def __iter__(self):
128128
for filename in self.filenames:
129129
dataset = xr.open_dataset(filename)
130130
datasets = uncombine_from_single_dataset(dataset)
131-
# print(datasets)
132-
datasets["nwp"]["ecmwf"] = potentially_coarsen(datasets["nwp"]["ecmwf"])
133-
# Select the specific keys desired
134-
datasets["nwp"]["ecmwf"] = datasets["nwp"]["ecmwf"].sel(
135-
channel=["u10", "u100", "u200", "v10", "v100", "v200"]
136-
)
131+
132+
if "ecmwf" in datasets["nwp"]:
133+
datasets["nwp"]["ecmwf"] = potentially_coarsen(datasets["nwp"]["ecmwf"])
134+
135+
# Select the specific keys desired
136+
datasets["nwp"]["ecmwf"] = datasets["nwp"]["ecmwf"].sel(
137+
channel=["u10", "u100", "u200", "v10", "v100", "v200"]
138+
)
139+
137140
# Yield a dictionary of the data, using the keys in self.keys
138141
# print(datasets)
139142
dataset_dict = {}

0 commit comments

Comments
 (0)