Skip to content

Commit

Permalink
Merge pull request #72 from metno/CI/minimal-deps
Browse files Browse the repository at this point in the history
Minimal deps test in CI
  • Loading branch information
magnusuMET authored Nov 12, 2024
2 parents 7fd66d8 + 1adfc46 commit 1f022c0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,15 @@ jobs:
- name: Test with tox
run: |
tox
minimal-dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create virtual env
run: python3 -m venv venv --upgrade-deps
- name: Install pyaro
run: source venv/bin/activate && pip install ./
- name: Try importing pyaro
run: source venv/bin/activate && python -c "import pyaro; print(pyaro.__version__)"

16 changes: 12 additions & 4 deletions src/pyaro/timeseries/Filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1227,11 +1227,11 @@ def __init__(
upper: float | None = None,
):
if "cf_units" not in sys.modules:
raise ModuleNotFoundError(
logger.info(
"valleyfloor_relaltitude filter is missing required dependency 'cf-units'. Please install to use this filter."
)
if "xarray" not in sys.modules:
raise ModuleNotFoundError(
logger.info(
"valleyfloor_relaltitude filter is missing required dependency 'xarray'. Please install to use this filter."
)

Expand All @@ -1254,8 +1254,16 @@ def name(self):
return "valleyfloor_relaltitude"

def filter_stations(self, stations: dict[str, Station]) -> dict[str, Station]:
filtered_stations = {}
if "cf_units" not in sys.modules:
raise ModuleNotFoundError(
"valleyfloor_relaltitude filter is missing required dependency 'cf-units'. Please install to use this filter."
)
if "xarray" not in sys.modules:
raise ModuleNotFoundError(
"valleyfloor_relaltitude filter is missing required dependency 'xarray'. Please install to use this filter."
)

filtered_stations = {}
with xr.open_dataset(self._topo_file) as topo:
for k, v in stations.items():
lat = v.latitude
Expand Down Expand Up @@ -1285,7 +1293,7 @@ def _calculate_relative_altitude(
*,
radius: float,
altitude: float,
topo: xr.Dataset,
topo: "xr.Dataset",
):
"""Calculates relative altitude
Expand Down

0 comments on commit 1f022c0

Please sign in to comment.