Skip to content

Commit

Permalink
address comments from Sarah
Browse files Browse the repository at this point in the history
  • Loading branch information
Yang committed Jul 24, 2023
1 parent aaa0c48 commit a29416b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/zampy/datasets/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
3 changes: 2 additions & 1 deletion tests/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions tests/test_regrid.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit a29416b

Please sign in to comment.