diff --git a/src/zampy/datasets/converter.py b/src/zampy/datasets/converter.py index c57a6d0..02c21e1 100644 --- a/src/zampy/datasets/converter.py +++ b/src/zampy/datasets/converter.py @@ -59,11 +59,11 @@ def convert( var_name = convention_dict[var.lower()]["variable"] var_units = data[var].attrs["units"] if var_units != convert_units: - converted = True # lazy dask array data = _convert_var(data, var, convert_units) data = data.rename({var: var_name}) print(f"{var} renamed to {var_name}.") + converted = True else: print(f"Variable '{var}' is not included in '{convention}' convention.") diff --git a/tests/test_converter.py b/tests/test_converter.py index 7136cc7..7214dd4 100644 --- a/tests/test_converter.py +++ b/tests/test_converter.py @@ -4,12 +4,13 @@ import numpy as np import pytest import xarray as xr +from test_datasets import data_folder from zampy.datasets import EthCanopyHeight from zampy.datasets import converter from zampy.datasets.eth_canopy_height import parse_tiff_file -path_dummy_data = Path(__file__).resolve().parent / "test_data" / "eth-canopy-height" +path_dummy_data = data_folder / "eth-canopy-height" # ruff: noqa: B018 diff --git a/tests/test_regrid.py b/tests/test_regrid.py index d9e5f62..0094347 100644 --- a/tests/test_regrid.py +++ b/tests/test_regrid.py @@ -1,15 +1,17 @@ """Unit test for regridding.""" -from pathlib import Path import numpy as np import pytest +from test_datasets import data_folder from zampy.datasets.dataset_protocol import SpatialBounds from zampy.datasets.eth_canopy_height import parse_tiff_file from zampy.utils import regrid -path_dummy_data = Path(__file__).resolve().parent / "test_data" / "eth-canopy-height" +path_dummy_data = data_folder / "eth-canopy-height" XESMF_INSTALLED = True +# Since xesmf is only supported via conda, we need these checks to support +# tests cases running with and without conda environment in CD/CI try: import xesmf as _ # noqa: F401 (unused import) except ImportError: