Skip to content

Commit 7b4006e

Browse files
committed
Fix open_remote_dataset
It previously didn't respect the purpose since it relied on the KeyError
1 parent 1b28579 commit 7b4006e

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/parcels/_datasets/remote.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,10 @@ def open_remote_dataset(name: str, purpose: _TPurpose | Literal["any"] = "any"):
266266
xarray.Dataset
267267
The requested dataset.
268268
"""
269-
try:
270-
dataset_config = _DATASET_KEYS_AND_CONFIGS[name][0]
271-
except KeyError as e:
269+
if name not in list_remote_datasets(purpose=purpose):
272270
raise ValueError(
273271
f"Dataset {name!r} not found. Available datasets are: " + ", ".join(list_remote_datasets(purpose=purpose))
274-
) from e
272+
)
275273

274+
dataset_config = _DATASET_KEYS_AND_CONFIGS[name][0]
276275
return dataset_config.open_dataset()

0 commit comments

Comments
 (0)