From 66a663f5506f4f3ff50cbe41e5a9407141f5d34a Mon Sep 17 00:00:00 2001 From: Ou Ku Date: Mon, 21 Oct 2024 15:16:51 +0200 Subject: [PATCH] rename ds to dataset to avoid ambiguity with distributed scatterers --- sarxarray/__init__.py | 4 ++-- sarxarray/_io.py | 2 +- tests/test_io.py | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sarxarray/__init__.py b/sarxarray/__init__.py index d4393db..b50e907 100644 --- a/sarxarray/__init__.py +++ b/sarxarray/__init__.py @@ -1,5 +1,5 @@ from sarxarray import stack -from sarxarray._io import from_binary, from_ds +from sarxarray._io import from_binary, from_dataset from sarxarray.utils import complex_coherence, multi_look -__all__ = ("stack", "from_binary", "from_ds", "multi_look", "complex_coherence") +__all__ = ("stack", "from_binary", "from_dataset", "multi_look", "complex_coherence") diff --git a/sarxarray/_io.py b/sarxarray/_io.py index 86efe60..927b938 100644 --- a/sarxarray/_io.py +++ b/sarxarray/_io.py @@ -13,7 +13,7 @@ # Example: https://docs.dask.org/en/stable/array-creation.html#memory-mapping -def from_ds(ds: xr.Dataset) -> xr.Dataset: +def from_dataset(ds: xr.Dataset) -> xr.Dataset: """Create a SLC stack or from an Xarray Dataset. This function create tasks graph converting the two data variables of complex data: diff --git a/tests/test_io.py b/tests/test_io.py index f570d17..604656b 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -19,32 +19,32 @@ def test_slcs(): class TestFromDS: - """from_ds in _io.py""" + """from_dataset in _io.py""" - def test_from_ds_normal(self): + def test_from_dataset_normal(self): test_ds = xr.open_zarr( f"{os.path.dirname(__file__)}/data/zarrs/slcs_example.zarr" ) - slcs = sarxarray.from_ds(test_ds) + slcs = sarxarray.from_dataset(test_ds) assert all(dim in slcs.dims for dim in ["azimuth", "range", "time"]) assert all(var not in slcs.variables.keys() for var in ["real", "imag"]) assert all( var in slcs.variables.keys() for var in ["complex", "amplitude", "phase"] ) - def test_from_ds_broken_dim(self): + def test_from_dataset_broken_dim(self): test_ds_broken_dim = xr.open_zarr( f"{os.path.dirname(__file__)}/data/zarrs/slcs_example_broken_dim.zarr" ) with pytest.raises(ValueError): - sarxarray.from_ds(test_ds_broken_dim) + sarxarray.from_dataset(test_ds_broken_dim) - def test_from_ds_broken_vars(self): + def test_from_dataset_broken_vars(self): test_ds_broken_vars = xr.open_zarr( f"{os.path.dirname(__file__)}/data/zarrs/slcs_example_broken_vars.zarr" ) with pytest.raises(ValueError): - sarxarray.from_ds(test_ds_broken_vars) + sarxarray.from_dataset(test_ds_broken_vars) class TestFromBinary: