Skip to content

Commit d6e298d

Browse files
committed
Update function names
1 parent 38404a3 commit d6e298d

3 files changed

Lines changed: 14 additions & 16 deletions

File tree

src/parcels/_datasets/remote.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
from parcels._v3to4 import patch_dataset_v4_compat
1313

14-
__all__ = ["list_datasets", "open_dataset"]
15-
1614
# When modifying existing datasets in a backwards incompatible way,
1715
# make a new release in the repo and update the DATA_REPO_TAG to the new tag
1816
_DATA_REPO_TAG = "main"
@@ -220,7 +218,7 @@ class _Purpose(enum.Enum):
220218
# fmt: on
221219

222220

223-
def list_datasets(purpose: _TPurpose | Literal["any"] = "any") -> list[str]:
221+
def list_remote_datasets(purpose: _TPurpose | Literal["any"] = "any") -> list[str]:
224222
"""List the available remote datasets.
225223
226224
Use :func:`open_dataset` to download and open one of the datasets.
@@ -244,7 +242,7 @@ def list_datasets(purpose: _TPurpose | Literal["any"] = "any") -> list[str]:
244242
return [k for (k, (_, p)) in _DATASET_KEYS_AND_CONFIGS.items() if p == purpose_enum]
245243

246244

247-
def open_dataset(name: str, purpose: _TPurpose | Literal["any"] = "any"):
245+
def open_remote_dataset(name: str, purpose: _TPurpose | Literal["any"] = "any"):
248246
"""Download and open a remote dataset as an :class:`xarray.Dataset`.
249247
250248
Use :func:`list_datasets` to see the available dataset names.
@@ -267,7 +265,7 @@ def open_dataset(name: str, purpose: _TPurpose | Literal["any"] = "any"):
267265
dataset_config = _DATASET_KEYS_AND_CONFIGS[name][0]
268266
except KeyError as e:
269267
raise ValueError(
270-
f"Dataset {name!r} not found. Available datasets are: " + ", ".join(list_datasets(purpose=purpose))
268+
f"Dataset {name!r} not found. Available datasets are: " + ", ".join(list_remote_datasets(purpose=purpose))
271269
) from e
272270

273271
return dataset_config.open_dataset()

src/parcels/tutorial.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from parcels._datasets.remote import list_datasets as _remote_list_datasets
2-
from parcels._datasets.remote import open_dataset as _remote_open_dataset
1+
from parcels._datasets.remote import list_remote_datasets as _list_remote_datasets
2+
from parcels._datasets.remote import open_remote_dataset as _open_remote_dataset
33

44
__all__ = ["list_datasets", "open_dataset"]
55

@@ -14,7 +14,7 @@ def list_datasets() -> list[str]:
1414
datasets : list of str
1515
The names of the available datasets matching the given purpose.
1616
"""
17-
return _remote_list_datasets(purpose="tutorial")
17+
return _list_remote_datasets(purpose="tutorial")
1818

1919

2020
def open_dataset(name: str):
@@ -33,4 +33,4 @@ def open_dataset(name: str):
3333
xarray.Dataset
3434
The requested dataset.
3535
"""
36-
return _remote_open_dataset(name, purpose="tutorial")
36+
return _open_remote_dataset(name, purpose="tutorial")

tests/datasets/test_remote.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,24 @@ def test_pooch_registry_url_reponse(url):
1919

2020
def test_open_dataset_non_existing():
2121
with pytest.raises(ValueError, match="Dataset.*not found"):
22-
remote.open_dataset("non_existing_dataset")
22+
remote.open_remote_dataset("non_existing_dataset")
2323

2424

25-
@pytest.mark.parametrize("name", remote.list_datasets())
25+
@pytest.mark.parametrize("name", remote.list_remote_datasets())
2626
def test_open_dataset(name):
27-
ds = remote.open_dataset(name)
27+
ds = remote.open_remote_dataset(name)
2828
assert isinstance(ds, xr.Dataset)
2929

3030

31-
@pytest.mark.parametrize("name", remote.list_datasets())
31+
@pytest.mark.parametrize("name", remote.list_remote_datasets())
3232
def test_dataset_keys(name):
3333
assert not name.endswith((".zarr", ".zip", ".nc")), "Dataset name should not have suffix"
3434

3535

3636
def test_list_datasets():
37-
tutorial_datasets = set(remote.list_datasets("tutorial"))
38-
testing_datasets = set(remote.list_datasets("testing"))
39-
all_datasets = set(remote.list_datasets("any"))
37+
tutorial_datasets = set(remote.list_remote_datasets("tutorial"))
38+
testing_datasets = set(remote.list_remote_datasets("testing"))
39+
all_datasets = set(remote.list_remote_datasets("any"))
4040
assert tutorial_datasets.issubset(all_datasets)
4141
assert testing_datasets.issubset(all_datasets)
4242
assert tutorial_datasets | testing_datasets == all_datasets

0 commit comments

Comments
 (0)