Skip to content

Commit

Permalink
FIX: Fix use of ruff, CI and numpy2 (#177)
Browse files Browse the repository at this point in the history
* FIX: Fix use of ruff linting
* ADD: Add to history.md
* add numpy 1 and 2 runs
* fix numpy 2 casting issue in iris reader
* fix history.md

---------

Co-authored-by: Kai Mühlbauer <[email protected]>
  • Loading branch information
mgrover1 and kmuehlbauer authored Jun 28, 2024
1 parent 5ed1f43 commit 89d9a3e
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 69 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
black --check .
- name: Lint with ruff
run: |
ruff .
ruff check .
build_0:
name: xradar unit tests - linux
Expand All @@ -42,6 +42,7 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
numpy-version: ["1", "2"]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -55,6 +56,7 @@ jobs:
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
create-args: >-
python=${{matrix.python-version}}
numpy=${{matrix.numpy-version}}
conda
- name: Install xradar
run: |
Expand Down Expand Up @@ -88,6 +90,7 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
numpy-version: ["1", "2"]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -101,6 +104,7 @@ jobs:
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
create-args: >-
python=${{matrix.python-version}}
numpy=${{matrix.numpy-version}}
conda
- name: Install xradar
run: |
Expand Down
6 changes: 3 additions & 3 deletions docs/history.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# History

## Development Version (unreleased)

* ADD: Add Alfonso to citation doc ({pull}`169`) by [@mgrover1](https://github.com/mgrover1)
* ENH: Adding global variables and attributes to iris datatree ({pull}`166`) by [@aladinor](https://github.com/aladinor)
* FIX: Fix use of ruff, CI and numpy2 ({pull}`177`) by [@mgrover1](https://github.com/mgrover1) and [@kmuehlbauer](https://github.com/kmuehlbauer).
* ADD: Add Alfonso to citation doc ({pull}`169`) by [@mgrover1](https://github.com/mgrover1).
* ENH: Adding global variables and attributes to iris datatree ({pull}`166`) by [@aladinor](https://github.com/aladinor).
* FIX: Set fillvalue before applying scale/offset when exporting to odim ({issue}`122`) by [@pavlikp](https://github.com/pavlikp), ({pull}`173`) by [@kmuehlbauer](https://github.com/kmuehlbauer).

## 0.5.0 (2024-03-28)
Expand Down
118 changes: 94 additions & 24 deletions examples/notebooks/NexradLevel2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,23 @@
"metadata": {},
"outputs": [],
"source": [
"filename = DATASETS.fetch(\"KLBB20160601_150025_V06\")"
"filename = \"../../../../Downloads/KDMX20200810_154746_V06\""
]
},
{
"cell_type": "markdown",
"cell_type": "code",
"execution_count": null,
"id": "4",
"metadata": {},
"outputs": [],
"source": [
"filename = DATASETS.fetch(\"KATX20130717_195021_V06\")"
]
},
{
"cell_type": "markdown",
"id": "5",
"metadata": {},
"source": [
"## xr.open_dataset\n",
"\n",
Expand All @@ -54,17 +64,39 @@
{
"cell_type": "code",
"execution_count": null,
"id": "5",
"id": "6",
"metadata": {},
"outputs": [],
"source": [
"ds = xr.open_dataset(filename, group=\"sweep_0\", engine=\"nexradlevel2\")\n",
"display(ds)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7",
"metadata": {},
"outputs": [],
"source": [
"ds"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"\n",
"np.testing.assert_almost_equal(ds.sweep_fixed_angle.values, 0.4833984)"
]
},
{
"cell_type": "markdown",
"id": "6",
"id": "9",
"metadata": {},
"source": [
"### Plot Time vs. Azimuth"
Expand All @@ -73,7 +105,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "7",
"id": "10",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -82,7 +114,7 @@
},
{
"cell_type": "markdown",
"id": "8",
"id": "11",
"metadata": {},
"source": [
"### Plot Range vs. Time\n",
Expand All @@ -93,7 +125,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "9",
"id": "12",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -102,7 +134,7 @@
},
{
"cell_type": "markdown",
"id": "10",
"id": "13",
"metadata": {},
"source": [
"### Plot Range vs. Azimuth\n"
Expand All @@ -111,7 +143,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "11",
"id": "14",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -120,7 +152,7 @@
},
{
"cell_type": "markdown",
"id": "12",
"id": "15",
"metadata": {},
"source": [
"## backend_kwargs\n",
Expand All @@ -131,7 +163,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "13",
"id": "16",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -141,7 +173,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "14",
"id": "17",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -151,7 +183,7 @@
},
{
"cell_type": "markdown",
"id": "15",
"id": "18",
"metadata": {},
"source": [
"## open_nexradlevel2_datatree\n",
Expand All @@ -162,7 +194,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "16",
"id": "19",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -172,7 +204,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "17",
"id": "20",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -182,7 +214,7 @@
},
{
"cell_type": "markdown",
"id": "18",
"id": "21",
"metadata": {},
"source": [
"### Plot Sweep Range vs. Time"
Expand All @@ -191,7 +223,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "19",
"id": "22",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -200,7 +232,7 @@
},
{
"cell_type": "markdown",
"id": "20",
"id": "23",
"metadata": {},
"source": [
"### Plot Sweep Range vs. Azimuth"
Expand All @@ -209,7 +241,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "21",
"id": "24",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -219,7 +251,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "22",
"id": "25",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -230,7 +262,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "23",
"id": "26",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -241,15 +273,53 @@
{
"cell_type": "code",
"execution_count": null,
"id": "24",
"id": "27",
"metadata": {},
"outputs": [],
"source": [
"dtree[\"sweep_0\"][\"sweep_fixed_angle\"].values"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "28",
"metadata": {},
"outputs": [],
"source": [
"dtree[\"sweep_1\"][\"sweep_fixed_angle\"].values"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "29",
"metadata": {},
"outputs": [],
"source": [
"dtree = xd.io.open_nexradlevel2_datatree(\n",
" filename, sweep=[\"sweep_1\", \"sweep_2\", \"sweep_8\"]\n",
" filename,\n",
")\n",
"display(dtree)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "30",
"metadata": {},
"outputs": [],
"source": [
"dtree[\"sweep_1\"]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "31",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -263,7 +333,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
"version": "3.11.4"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 89d9a3e

Please sign in to comment.