Skip to content

Commit 89d9a3e

Browse files
FIX: Fix use of ruff, CI and numpy2 (#177)
* 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]>
1 parent 5ed1f43 commit 89d9a3e

File tree

8 files changed

+151
-69
lines changed

8 files changed

+151
-69
lines changed

.github/workflows/ci.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
black --check .
2828
- name: Lint with ruff
2929
run: |
30-
ruff .
30+
ruff check .
3131
3232
build_0:
3333
name: xradar unit tests - linux
@@ -42,6 +42,7 @@ jobs:
4242
fail-fast: false
4343
matrix:
4444
python-version: ["3.10", "3.11", "3.12"]
45+
numpy-version: ["1", "2"]
4546
steps:
4647
- uses: actions/checkout@v4
4748
with:
@@ -55,6 +56,7 @@ jobs:
5556
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
5657
create-args: >-
5758
python=${{matrix.python-version}}
59+
numpy=${{matrix.numpy-version}}
5860
conda
5961
- name: Install xradar
6062
run: |
@@ -88,6 +90,7 @@ jobs:
8890
fail-fast: false
8991
matrix:
9092
python-version: ["3.10", "3.11", "3.12"]
93+
numpy-version: ["1", "2"]
9194
steps:
9295
- uses: actions/checkout@v4
9396
with:
@@ -101,6 +104,7 @@ jobs:
101104
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
102105
create-args: >-
103106
python=${{matrix.python-version}}
107+
numpy=${{matrix.numpy-version}}
104108
conda
105109
- name: Install xradar
106110
run: |

docs/history.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# History
22

33
## Development Version (unreleased)
4-
5-
* ADD: Add Alfonso to citation doc ({pull}`169`) by [@mgrover1](https://github.com/mgrover1)
6-
* ENH: Adding global variables and attributes to iris datatree ({pull}`166`) by [@aladinor](https://github.com/aladinor)
4+
* FIX: Fix use of ruff, CI and numpy2 ({pull}`177`) by [@mgrover1](https://github.com/mgrover1) and [@kmuehlbauer](https://github.com/kmuehlbauer).
5+
* ADD: Add Alfonso to citation doc ({pull}`169`) by [@mgrover1](https://github.com/mgrover1).
6+
* ENH: Adding global variables and attributes to iris datatree ({pull}`166`) by [@aladinor](https://github.com/aladinor).
77
* 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).
88

99
## 0.5.0 (2024-03-28)

examples/notebooks/NexradLevel2.ipynb

+94-24
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,23 @@
3838
"metadata": {},
3939
"outputs": [],
4040
"source": [
41-
"filename = DATASETS.fetch(\"KLBB20160601_150025_V06\")"
41+
"filename = \"../../../../Downloads/KDMX20200810_154746_V06\""
4242
]
4343
},
4444
{
45-
"cell_type": "markdown",
45+
"cell_type": "code",
46+
"execution_count": null,
4647
"id": "4",
4748
"metadata": {},
49+
"outputs": [],
50+
"source": [
51+
"filename = DATASETS.fetch(\"KATX20130717_195021_V06\")"
52+
]
53+
},
54+
{
55+
"cell_type": "markdown",
56+
"id": "5",
57+
"metadata": {},
4858
"source": [
4959
"## xr.open_dataset\n",
5060
"\n",
@@ -54,17 +64,39 @@
5464
{
5565
"cell_type": "code",
5666
"execution_count": null,
57-
"id": "5",
67+
"id": "6",
5868
"metadata": {},
5969
"outputs": [],
6070
"source": [
6171
"ds = xr.open_dataset(filename, group=\"sweep_0\", engine=\"nexradlevel2\")\n",
6272
"display(ds)"
6373
]
6474
},
75+
{
76+
"cell_type": "code",
77+
"execution_count": null,
78+
"id": "7",
79+
"metadata": {},
80+
"outputs": [],
81+
"source": [
82+
"ds"
83+
]
84+
},
85+
{
86+
"cell_type": "code",
87+
"execution_count": null,
88+
"id": "8",
89+
"metadata": {},
90+
"outputs": [],
91+
"source": [
92+
"import numpy as np\n",
93+
"\n",
94+
"np.testing.assert_almost_equal(ds.sweep_fixed_angle.values, 0.4833984)"
95+
]
96+
},
6597
{
6698
"cell_type": "markdown",
67-
"id": "6",
99+
"id": "9",
68100
"metadata": {},
69101
"source": [
70102
"### Plot Time vs. Azimuth"
@@ -73,7 +105,7 @@
73105
{
74106
"cell_type": "code",
75107
"execution_count": null,
76-
"id": "7",
108+
"id": "10",
77109
"metadata": {},
78110
"outputs": [],
79111
"source": [
@@ -82,7 +114,7 @@
82114
},
83115
{
84116
"cell_type": "markdown",
85-
"id": "8",
117+
"id": "11",
86118
"metadata": {},
87119
"source": [
88120
"### Plot Range vs. Time\n",
@@ -93,7 +125,7 @@
93125
{
94126
"cell_type": "code",
95127
"execution_count": null,
96-
"id": "9",
128+
"id": "12",
97129
"metadata": {},
98130
"outputs": [],
99131
"source": [
@@ -102,7 +134,7 @@
102134
},
103135
{
104136
"cell_type": "markdown",
105-
"id": "10",
137+
"id": "13",
106138
"metadata": {},
107139
"source": [
108140
"### Plot Range vs. Azimuth\n"
@@ -111,7 +143,7 @@
111143
{
112144
"cell_type": "code",
113145
"execution_count": null,
114-
"id": "11",
146+
"id": "14",
115147
"metadata": {},
116148
"outputs": [],
117149
"source": [
@@ -120,7 +152,7 @@
120152
},
121153
{
122154
"cell_type": "markdown",
123-
"id": "12",
155+
"id": "15",
124156
"metadata": {},
125157
"source": [
126158
"## backend_kwargs\n",
@@ -131,7 +163,7 @@
131163
{
132164
"cell_type": "code",
133165
"execution_count": null,
134-
"id": "13",
166+
"id": "16",
135167
"metadata": {},
136168
"outputs": [],
137169
"source": [
@@ -141,7 +173,7 @@
141173
{
142174
"cell_type": "code",
143175
"execution_count": null,
144-
"id": "14",
176+
"id": "17",
145177
"metadata": {},
146178
"outputs": [],
147179
"source": [
@@ -151,7 +183,7 @@
151183
},
152184
{
153185
"cell_type": "markdown",
154-
"id": "15",
186+
"id": "18",
155187
"metadata": {},
156188
"source": [
157189
"## open_nexradlevel2_datatree\n",
@@ -162,7 +194,7 @@
162194
{
163195
"cell_type": "code",
164196
"execution_count": null,
165-
"id": "16",
197+
"id": "19",
166198
"metadata": {},
167199
"outputs": [],
168200
"source": [
@@ -172,7 +204,7 @@
172204
{
173205
"cell_type": "code",
174206
"execution_count": null,
175-
"id": "17",
207+
"id": "20",
176208
"metadata": {},
177209
"outputs": [],
178210
"source": [
@@ -182,7 +214,7 @@
182214
},
183215
{
184216
"cell_type": "markdown",
185-
"id": "18",
217+
"id": "21",
186218
"metadata": {},
187219
"source": [
188220
"### Plot Sweep Range vs. Time"
@@ -191,7 +223,7 @@
191223
{
192224
"cell_type": "code",
193225
"execution_count": null,
194-
"id": "19",
226+
"id": "22",
195227
"metadata": {},
196228
"outputs": [],
197229
"source": [
@@ -200,7 +232,7 @@
200232
},
201233
{
202234
"cell_type": "markdown",
203-
"id": "20",
235+
"id": "23",
204236
"metadata": {},
205237
"source": [
206238
"### Plot Sweep Range vs. Azimuth"
@@ -209,7 +241,7 @@
209241
{
210242
"cell_type": "code",
211243
"execution_count": null,
212-
"id": "21",
244+
"id": "24",
213245
"metadata": {},
214246
"outputs": [],
215247
"source": [
@@ -219,7 +251,7 @@
219251
{
220252
"cell_type": "code",
221253
"execution_count": null,
222-
"id": "22",
254+
"id": "25",
223255
"metadata": {},
224256
"outputs": [],
225257
"source": [
@@ -230,7 +262,7 @@
230262
{
231263
"cell_type": "code",
232264
"execution_count": null,
233-
"id": "23",
265+
"id": "26",
234266
"metadata": {},
235267
"outputs": [],
236268
"source": [
@@ -241,15 +273,53 @@
241273
{
242274
"cell_type": "code",
243275
"execution_count": null,
244-
"id": "24",
276+
"id": "27",
277+
"metadata": {},
278+
"outputs": [],
279+
"source": [
280+
"dtree[\"sweep_0\"][\"sweep_fixed_angle\"].values"
281+
]
282+
},
283+
{
284+
"cell_type": "code",
285+
"execution_count": null,
286+
"id": "28",
287+
"metadata": {},
288+
"outputs": [],
289+
"source": [
290+
"dtree[\"sweep_1\"][\"sweep_fixed_angle\"].values"
291+
]
292+
},
293+
{
294+
"cell_type": "code",
295+
"execution_count": null,
296+
"id": "29",
245297
"metadata": {},
246298
"outputs": [],
247299
"source": [
248300
"dtree = xd.io.open_nexradlevel2_datatree(\n",
249-
" filename, sweep=[\"sweep_1\", \"sweep_2\", \"sweep_8\"]\n",
301+
" filename,\n",
250302
")\n",
251303
"display(dtree)"
252304
]
305+
},
306+
{
307+
"cell_type": "code",
308+
"execution_count": null,
309+
"id": "30",
310+
"metadata": {},
311+
"outputs": [],
312+
"source": [
313+
"dtree[\"sweep_1\"]"
314+
]
315+
},
316+
{
317+
"cell_type": "code",
318+
"execution_count": null,
319+
"id": "31",
320+
"metadata": {},
321+
"outputs": [],
322+
"source": []
253323
}
254324
],
255325
"metadata": {
@@ -263,7 +333,7 @@
263333
"name": "python",
264334
"nbconvert_exporter": "python",
265335
"pygments_lexer": "ipython3",
266-
"version": "3.11.5"
336+
"version": "3.11.4"
267337
}
268338
},
269339
"nbformat": 4,

0 commit comments

Comments
 (0)