Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT: Update GitHub actions, address DeprecationWarnings #153

Merged
merged 11 commits into from
Feb 22, 2024
Merged
34 changes: 17 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
name: lint and style checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -41,9 +41,9 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install micromamba environment
Expand All @@ -66,7 +66,7 @@ jobs:
run: |
pytest -n auto --dist loadfile --verbose --durations=15 --cov-report xml:coverage_unit.xml --cov=xradar --pyargs tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
file: ./coverage_unit.xml
flags: unittests
Expand All @@ -86,9 +86,9 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install micromamba environment
Expand All @@ -111,7 +111,7 @@ jobs:
run: |
pytest -n auto --dist loadfile --verbose --durations=15 --cov-report xml:coverage_notebooks.xml --cov=xradar --pyargs examples/notebooks
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
file: ./coverage_notebook.xml
flags: notebooktests
Expand All @@ -128,13 +128,13 @@ jobs:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -146,7 +146,7 @@ jobs:
python -m build
cp dist/xradar*.gz dist/xradar1.gz
- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: xradar-1-${{github.event.number}}
path: dist/xradar1.gz
Expand All @@ -167,13 +167,13 @@ jobs:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -183,7 +183,7 @@ jobs:
python -m build
cp dist/xradar*.gz dist/xradar0.gz
- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: xradar-0-${{github.event.number}}
path: dist/xradar0.gz
6 changes: 3 additions & 3 deletions .github/workflows/upload_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
4 changes: 4 additions & 0 deletions docs/history.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# History

## Development Version (unreleased)

* MNT: Update GitHub actions, address DeprecationWarnings ({pull}`153`) by [@kmuehlbauer](https://github.com/kmuehlbauer).

## 0.4.3 (2024-02-24)

* MNT: address black style changes, update pre-commit-config.yaml ({pull}`152`) by [@kmuehlbauer](https://github.com/kmuehlbauer).
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ exclude = [
"doc",
]

[tool.ruff.lint]
# E402: module level import not at top of file
# E501: line too long - let black worry about that
# E731: do not assign a lambda expression, use a def
Expand All @@ -92,5 +93,5 @@ select = [
"UP",
]

[tool.ruff.isort]
[tool.ruff.lint.isort]
known-first-party = ["xradar"]
48 changes: 24 additions & 24 deletions tests/io/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_open_cfradial1_datatree(cfradial1_file):
ds = dtree[grp].ds
i = ds.sweep_number.values
assert i == int(grp[7:])
assert dict(ds.dims) == {"time": azimuths[i], "range": ranges[i]}
assert dict(ds.sizes) == {"time": azimuths[i], "range": ranges[i]}
assert set(ds.data_vars) & (
sweep_dataset_vars | non_standard_sweep_dataset_vars
) == set(moments)
Expand Down Expand Up @@ -153,7 +153,7 @@ def test_open_odim_datatree(odim_file):
]
for i, grp in enumerate(dtree.groups[1:]):
ds = dtree[grp].ds
assert dict(ds.dims) == {"azimuth": azimuths[i], "range": ranges[i]}
assert dict(ds.sizes) == {"azimuth": azimuths[i], "range": ranges[i]}
assert set(ds.data_vars) & (
sweep_dataset_vars | non_standard_sweep_dataset_vars
) == set(moments)
Expand All @@ -176,15 +176,15 @@ def test_open_odim_datatree(odim_file):
def test_open_odim_dataset(odim_file):
# open first sweep group
ds = xr.open_dataset(odim_file, group="sweep_0", engine="odim")
assert dict(ds.dims) == {"azimuth": 360, "range": 1200}
assert dict(ds.sizes) == {"azimuth": 360, "range": 1200}
assert set(ds.data_vars) & (
sweep_dataset_vars | non_standard_sweep_dataset_vars
) == {"WRADH", "VRADH", "PHIDP", "DBZH", "RHOHV", "KDP", "TH", "ZDR"}
assert ds.sweep_number == 0

# open last sweep group
ds = xr.open_dataset(odim_file, group="sweep_11", engine="odim")
assert dict(ds.dims) == {"azimuth": 360, "range": 280}
assert dict(ds.sizes) == {"azimuth": 360, "range": 280}
assert set(ds.data_vars) & (
sweep_dataset_vars | non_standard_sweep_dataset_vars
) == {"VRADH", "KDP", "WRADH", "TH", "RHOHV", "PHIDP", "ZDR", "DBZH"}
Expand All @@ -197,7 +197,7 @@ def test_open_odim_dataset(odim_file):
engine="odim",
backend_kwargs=dict(first_dim="time"),
)
assert dict(ds.dims) == {"time": 360, "range": 280}
assert dict(ds.sizes) == {"time": 360, "range": 280}
assert ds.sweep_number == 11


Expand Down Expand Up @@ -261,7 +261,7 @@ def test_open_gamic_datatree(gamic_file):
]
for i, grp in enumerate(dtree.groups[1:]):
ds = dtree[grp].ds
assert dict(ds.dims) == {"azimuth": azimuths[i], "range": ranges[i]}
assert dict(ds.sizes) == {"azimuth": azimuths[i], "range": ranges[i]}
assert set(ds.data_vars) & (
sweep_dataset_vars | non_standard_sweep_dataset_vars
) == set(moments)
Expand All @@ -284,7 +284,7 @@ def test_open_gamic_datatree(gamic_file):
def test_open_gamic_dataset(gamic_file):
# open first sweep group
ds = xr.open_dataset(gamic_file, group="sweep_0", engine="gamic")
assert dict(ds.dims) == {"azimuth": 361, "range": 360}
assert dict(ds.sizes) == {"azimuth": 361, "range": 360}
assert set(ds.data_vars) & (
sweep_dataset_vars | non_standard_sweep_dataset_vars
) == {
Expand All @@ -305,7 +305,7 @@ def test_open_gamic_dataset(gamic_file):

# open last sweep group
ds = xr.open_dataset(gamic_file, group="sweep_9", engine="gamic")
assert dict(ds.dims) == {"azimuth": 360, "range": 1000}
assert dict(ds.sizes) == {"azimuth": 360, "range": 1000}
assert set(ds.data_vars) & (
sweep_dataset_vars | non_standard_sweep_dataset_vars
) == {
Expand All @@ -331,7 +331,7 @@ def test_open_gamic_dataset(gamic_file):
engine="gamic",
backend_kwargs=dict(first_dim="time"),
)
assert dict(ds.dims) == {"time": 360, "range": 1000}
assert dict(ds.sizes) == {"time": 360, "range": 1000}
assert ds.sweep_number == 9


Expand All @@ -341,13 +341,13 @@ def test_open_gamic_dataset_reindex(gamic_file):
ds = xr.open_dataset(
gamic_file, group="sweep_0", engine="gamic", reindex_angle=reindex_angle
)
assert dict(ds.dims) == {"azimuth": 360, "range": 360}
assert dict(ds.sizes) == {"azimuth": 360, "range": 360}


def test_open_furuno_scn_dataset(furuno_scn_file):
# open sweep group
ds = xr.open_dataset(furuno_scn_file, first_dim="time", engine="furuno")
assert dict(ds.dims) == {"time": 1376, "range": 602}
assert dict(ds.sizes) == {"time": 1376, "range": 602}
assert set(ds.data_vars) & (
sweep_dataset_vars | non_standard_sweep_dataset_vars
) == {"KDP", "VRADH", "ZDR", "DBZH", "WRADH", "RHOHV", "PHIDP"}
Expand All @@ -367,14 +367,14 @@ def test_open_furuno_scn_dataset(furuno_scn_file):
furuno_scn_file,
engine="furuno",
)
assert dict(ds.dims) == {"azimuth": 1376, "range": 602}
assert dict(ds.sizes) == {"azimuth": 1376, "range": 602}
assert ds.sweep_number == 0


def test_open_furuno_scnx_dataset(furuno_scnx_file):
# open sweep group
ds = xr.open_dataset(furuno_scnx_file, first_dim="time", engine="furuno")
assert dict(ds.dims) == {"time": 722, "range": 936}
assert dict(ds.sizes) == {"time": 722, "range": 936}
assert set(ds.data_vars) & (
sweep_dataset_vars | non_standard_sweep_dataset_vars
) == {"KDP", "VRADH", "ZDR", "DBZH", "WRADH", "RHOHV", "PHIDP"}
Expand All @@ -395,7 +395,7 @@ def test_open_furuno_scnx_dataset(furuno_scnx_file):
furuno_scnx_file,
engine="furuno",
)
assert dict(ds.dims) == {"azimuth": 722, "range": 936}
assert dict(ds.sizes) == {"azimuth": 722, "range": 936}
assert ds.sweep_number == 0


Expand Down Expand Up @@ -441,7 +441,7 @@ def test_open_rainbow_datatree(rainbow_file):
ranges = [400] * 14
for i, grp in enumerate(dtree.groups[1:]):
ds = dtree[grp].ds
assert dict(ds.dims) == {"azimuth": azimuths[i], "range": ranges[i]}
assert dict(ds.sizes) == {"azimuth": azimuths[i], "range": ranges[i]}
assert set(ds.data_vars) & (
sweep_dataset_vars | non_standard_sweep_dataset_vars
) == set(moments)
Expand All @@ -464,7 +464,7 @@ def test_open_rainbow_datatree(rainbow_file):
def test_open_rainbow_dataset(rainbow_file):
# open first sweep group
ds = xr.open_dataset(rainbow_file, group="sweep_0", engine="rainbow")
assert dict(ds.dims) == {"azimuth": 361, "range": 400}
assert dict(ds.sizes) == {"azimuth": 361, "range": 400}
assert set(ds.data_vars) & (
sweep_dataset_vars | non_standard_sweep_dataset_vars
) == {
Expand All @@ -474,7 +474,7 @@ def test_open_rainbow_dataset(rainbow_file):

# open last sweep group
ds = xr.open_dataset(rainbow_file, group="sweep_13", engine="rainbow")
assert dict(ds.dims) == {"azimuth": 361, "range": 400}
assert dict(ds.sizes) == {"azimuth": 361, "range": 400}
assert set(ds.data_vars) & (
sweep_dataset_vars | non_standard_sweep_dataset_vars
) == {
Expand All @@ -489,7 +489,7 @@ def test_open_rainbow_dataset(rainbow_file):
engine="rainbow",
backend_kwargs=dict(first_dim="time"),
)
assert dict(ds.dims) == {"time": 361, "range": 400}
assert dict(ds.sizes) == {"time": 361, "range": 400}
assert ds.sweep_number == 13


Expand Down Expand Up @@ -536,7 +536,7 @@ def test_open_iris_datatree(iris0_file):
ranges = [664] * 10
for i, grp in enumerate(dtree.groups[1:]):
ds = dtree[grp].ds
assert dict(ds.dims) == {"azimuth": azimuths[i], "range": ranges[i]}
assert dict(ds.sizes) == {"azimuth": azimuths[i], "range": ranges[i]}
assert set(ds.data_vars) & (
sweep_dataset_vars | non_standard_sweep_dataset_vars
) == set(moments)
Expand All @@ -559,7 +559,7 @@ def test_open_iris_datatree(iris0_file):
def test_open_iris0_dataset(iris0_file):
# open first sweep group
ds = xr.open_dataset(iris0_file, group="sweep_0", engine="iris")
assert dict(ds.dims) == {"azimuth": 360, "range": 664}
assert dict(ds.sizes) == {"azimuth": 360, "range": 664}
assert set(ds.data_vars) & (
sweep_dataset_vars | non_standard_sweep_dataset_vars
) == {
Expand All @@ -574,7 +574,7 @@ def test_open_iris0_dataset(iris0_file):

# open last sweep group
ds = xr.open_dataset(iris0_file, group="sweep_9", engine="iris")
assert dict(ds.dims) == {"azimuth": 360, "range": 664}
assert dict(ds.sizes) == {"azimuth": 360, "range": 664}
assert set(ds.data_vars) & (
sweep_dataset_vars | non_standard_sweep_dataset_vars
) == {
Expand All @@ -594,14 +594,14 @@ def test_open_iris0_dataset(iris0_file):
engine="iris",
backend_kwargs=dict(first_dim="time"),
)
assert dict(ds.dims) == {"time": 360, "range": 664}
assert dict(ds.sizes) == {"time": 360, "range": 664}
assert ds.sweep_number == 9


def test_open_iris1_dataset(iris1_file):
# open first and only sweep group
ds = xr.open_dataset(iris1_file, group="sweep_0", engine="iris")
assert dict(ds.dims) == {"azimuth": 359, "range": 833}
assert dict(ds.sizes) == {"azimuth": 359, "range": 833}
assert set(ds.data_vars) & (
sweep_dataset_vars | non_standard_sweep_dataset_vars
) == {
Expand All @@ -623,7 +623,7 @@ def test_open_iris1_dataset(iris1_file):
engine="iris",
backend_kwargs=dict(first_dim="time"),
)
assert dict(ds.dims) == {"time": 359, "range": 833}
assert dict(ds.sizes) == {"time": 359, "range": 833}
assert ds.sweep_number == 0


Expand Down
8 changes: 4 additions & 4 deletions tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_create_sweep_dataset():
assert ds.elevation.shape == (360,)
assert ds.time.shape == (360,)
assert ds.range.shape == (1000,)
assert ds.dims == {"time": 360, "range": 1000}
assert ds.sizes == {"time": 360, "range": 1000}
assert np.unique(ds.elevation) == [1.0]
assert ds.azimuth[0] == 0.5
assert ds.azimuth[-1] == 359.5
Expand All @@ -36,7 +36,7 @@ def test_create_sweep_dataset():
assert ds.elevation.shape == (360,)
assert ds.time.shape == (360,)
assert ds.range.shape == (1000,)
assert ds.dims == {"time": 360, "range": 1000}
assert ds.sizes == {"time": 360, "range": 1000}
assert np.unique(ds.elevation) == [5.0]
assert ds.azimuth[0] == 0.5
assert ds.azimuth[-1] == 359.5
Expand All @@ -45,7 +45,7 @@ def test_create_sweep_dataset():

# provide shape and range-res, fixed-elevation
ds = model.create_sweep_dataset(shape=(180, 100), rng=50.0, elevation=5.0)
assert ds.dims == {"time": 180, "range": 100}
assert ds.sizes == {"time": 180, "range": 100}
assert ds.range[-1] == 4975
assert ds.time[-1].values == np.datetime64("2022-08-27T10:00:44.750000000")
assert np.unique(ds.elevation) == [5.0]
Expand All @@ -54,7 +54,7 @@ def test_create_sweep_dataset():
ds = model.create_sweep_dataset(
shape=(90, 100), rng=50.0, azimuth=205.0, sweep="RHI"
)
assert ds.dims == {"time": 90, "range": 100}
assert ds.sizes == {"time": 90, "range": 100}
assert ds.range[-1] == 4975
assert ds.time[-1].values == np.datetime64("2022-08-27T10:00:22.250000000")
assert np.unique(ds.azimuth) == [205.0]
Expand Down
Loading