Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
# don't use python3.12 because flake8 finds extra issues with that
# version
python-version: "3.11"
- uses: pre-commit/action@v2.0.3
- uses: pre-commit/action@v3.0.1
8 changes: 7 additions & 1 deletion .github/workflows/python-package-pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.9", "3.10"]
zarr-version: [">=2,<3", ">2,<=3"]
steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install package with pip
run: |
python -m pip install . "zarr${{ matrix.zarr-version }}"
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [unreleased](https://github.com/mllam/mllam-data-prep/compare/v0.6.0...HEAD)

### Fixes
- use old union typing notation compatible with all required python versions [\#77](https://github.com/mllam/mllam-data-prep/pull/77) @SimonKamuk

### Maintenance
- update pre-commit action to v3.0.1 [\#77](https://github.com/mllam/mllam-data-prep/pull/77) @SimonKamuk
- fix tests to use expected python version from test matrix [\#77](https://github.com/mllam/mllam-data-prep/pull/77) @SimonKamuk

## [v0.6.0](https://github.com/mllam/mllam-data-prep/release/tag/v0.6.0)

[All changes](https://github.com/mllam/mllam-data-prep/compare/v0.6.0...v0.5.0)
Expand Down
6 changes: 4 additions & 2 deletions mllam_data_prep/create_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import shutil
from collections import defaultdict
from pathlib import Path
from typing import Optional
from typing import Optional, Union

import numpy as np
import xarray as xr
Expand Down Expand Up @@ -302,7 +302,9 @@ def create_dataset(config: Config):


def create_dataset_zarr(
fp_config: Path, fp_zarr: Optional[str | Path] = None, overwrite: str = "always"
fp_config: Path,
fp_zarr: Optional[Union[str, Path]] = None,
overwrite: str = "always",
):
"""
Create a dataset from the input datasets specified in the config file and
Expand Down
6 changes: 4 additions & 2 deletions tests/derive_variable/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Fixtures for the derive_variable module tests."""

import datetime
from typing import List
from typing import List, Union

import isodate
import numpy as np
Expand All @@ -11,7 +11,9 @@


@pytest.fixture(name="time")
def fixture_time(request) -> List[np.datetime64 | datetime.datetime | xr.DataArray]:
def fixture_time(
request,
) -> List[Union[np.datetime64, datetime.datetime, xr.DataArray]]:
"""Fixture that returns test time data

The fixture has to be indirectly parametrized with the number of time steps.
Expand Down
12 changes: 6 additions & 6 deletions tests/derive_variable/test_physical_field.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Unit tests for the `mllam_data_prep.ops.derive_variable.physical_field` module."""

import datetime
from typing import List
from typing import List, Union

import numpy as np
import pytest
Expand All @@ -11,7 +11,7 @@


@pytest.fixture(name="lat")
def fixture_lat(request) -> List[float | xr.DataArray]:
def fixture_lat(request) -> List[Union[float, xr.DataArray]]:
"""Fixture that returns test latitude data

The fixture has to be indirectly parametrized with the number of coordinates,
Expand All @@ -30,7 +30,7 @@ def fixture_lat(request) -> List[float | xr.DataArray]:


@pytest.fixture(name="lon")
def fixture_lon(request) -> List[float | xr.DataArray]:
def fixture_lon(request) -> List[Union[float, xr.DataArray]]:
"""Fixture that returns test longitude data

The fixture has to be indirectly parametrized with the number of coordinates,
Expand Down Expand Up @@ -62,9 +62,9 @@ def fixture_lon(request) -> List[float | xr.DataArray]:
)
@pytest.mark.parametrize("time", [1, 10, 100], indirect=True)
def test_toa_radiation(
lat: float | xr.DataArray,
lon: float | xr.DataArray,
time: np.datetime64 | datetime.datetime | xr.DataArray,
lat: Union[float, xr.DataArray],
lon: Union[float, xr.DataArray],
time: Union[np.datetime64, datetime.datetime, xr.DataArray],
):
"""Test the `calculate_toa_radiation` function.

Expand Down
5 changes: 3 additions & 2 deletions tests/derive_variable/test_time_components.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Unit tests for the `mllam_data_prep.ops.derive_variable.time_components` module."""

import datetime
from typing import Union

import numpy as np
import pytest
Expand All @@ -21,7 +22,7 @@
],
)
def test_hour_of_day(
time: np.datetime64 | datetime.datetime | xr.DataArray, component: str
time: Union[np.datetime64, datetime.datetime, xr.DataArray], component: str
):
"""Test the `calculate_hour_of_day` function.

Expand All @@ -43,7 +44,7 @@ def test_hour_of_day(
],
)
def test_day_of_year(
time: np.datetime64 | datetime.datetime | xr.DataArray, component: str
time: Union[np.datetime64, datetime.datetime, xr.DataArray], component: str
):
"""Test the `calculate_day_of_year` function.

Expand Down