Skip to content

Commit 8290b5f

Browse files
committed
Merge branch 'dev' of https://github.com/MeteoSwiss/pyart into dev
2 parents fe760bf + 192d562 commit 8290b5f

File tree

6 files changed

+41
-53
lines changed

6 files changed

+41
-53
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.4.0 # Use the latest stable version
3+
rev: v5.0.0 # Use the latest stable version
44
hooks:
55
- id: trailing-whitespace
66
- id: end-of-file-fixer
77
- id: check-yaml
8+
9+
- repo: https://github.com/charliermarsh/ruff-pre-commit
10+
rev: v0.9.3 # Use the latest stable version of ruff-pre-commit
11+
hooks:
12+
- id: ruff
13+
args: ["--fix"]
14+
files: "pyart" # Automatically fix issues when possible
15+
816
- repo: https://github.com/psf/black
917
rev: 23.1.0
1018
hooks:

=0.8.0

Lines changed: 0 additions & 35 deletions
This file was deleted.

pyart/aux_io/metranet_reader.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ def read_metranet_c(
533533
radar_id = ret.header["RadarName"].decode("utf-8")
534534

535535
metadata["instrument_name"] = radar_id
536+
metadata["sweep_quality"] = ret.header["quality"]
536537

537538
# hardcoded radar dependent metadata
538539
latitude["data"] = np.array([ret.header["RadarLat"]], dtype=dtype)
@@ -993,6 +994,7 @@ def read_metranet_python(
993994
radar_id = ret.header["radarname"].decode("utf-8")
994995

995996
metadata["instrument_name"] = radar_id
997+
metadata["sweep_quality"] = ret.header["quality"]
996998

997999
# hardcoded radar dependent metadata
9981000
latitude["data"] = np.array([ret.header["radarlat"]], dtype=dtype)
@@ -1034,7 +1036,6 @@ def read_metranet_python(
10341036
for i in range(0, nmoments):
10351037
field_name = filemetadata.get_field_name(momnames[i])
10361038
if field_name is not None:
1037-
10381039
# create field dictionary
10391040
field_dic = filemetadata(field_name)
10401041
if momnames[i] not in ret.data:

pyart/core/radar_spectra.py

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -287,20 +287,35 @@ def add_field(self, field_name, dic, replace_existing=False):
287287
raise ValueError(err)
288288
if "data" not in dic:
289289
raise KeyError("dic must contain a 'data' key")
290-
if dic["data"].shape != (self.nrays, self.ngates, self.npulses_max):
291-
t = (
292-
self.nrays,
293-
self.ngates,
294-
self.npulses_max,
295-
dic["data"].shape[0],
296-
dic["data"].shape[1],
297-
dic["data"].shape[2],
298-
)
299-
err = (
300-
"'data' has invalid shape, "
301-
+ f"should be ({t[0]}, {t[1]}, {t[2]}) but is ({t[3]}, {t[4]}, {t[5]})"
302-
)
303-
raise ValueError(err)
290+
# Check if field is in spectral shape (self.nrays, self.ngates, self.npulses_max)
291+
if len(dic["data"]) == 3:
292+
if dic["data"].shape != (self.nrays, self.ngates, self.npulses_max):
293+
t = (
294+
self.nrays,
295+
self.ngates,
296+
self.npulses_max,
297+
dic["data"].shape[0],
298+
dic["data"].shape[1],
299+
dic["data"].shape[2],
300+
)
301+
err = (
302+
"'data' has invalid shape, "
303+
+ f"should be ({t[0]}, {t[1]}, {t[2]}) but is ({t[3]}, {t[4]}, {t[5]})"
304+
)
305+
raise ValueError(err)
306+
elif len(dic["data"]) == 2:
307+
if dic["data"].shape != (self.nrays, self.ngates):
308+
t = (
309+
self.nrays,
310+
self.ngates,
311+
dic["data"].shape[0],
312+
dic["data"].shape[1],
313+
)
314+
err = (
315+
"'data' has invalid shape, "
316+
+ f"should be ({t[0]}, {t[1]}) but is ({t[2]}, {t[3]})"
317+
)
318+
raise ValueError(err)
304319
# add the field
305320
self.fields[field_name] = dic
306321

pyart/retrieve/_gecsx_functions.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,6 @@ def visibility(
777777
rrmax = rr + dr / 2
778778

779779
if np.any(indseta):
780-
781780
indsetr = np.logical_and(rmap[indseta] >= rrmin, rmap[indseta] < rrmax)
782781

783782
indsetr = tuple(

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
PLATFORMS = ["Linux", "Mac OS-X", "Unix"]
7575
MAJOR = 2
7676
MINOR = 0
77-
MICRO = 3
77+
MICRO = 4
7878
ISRELEASED = False
7979
VERSION = f"{int(MAJOR)}.{int(MINOR)}.{int(MICRO)}"
8080
SCRIPTS = glob.glob("scripts/*")

0 commit comments

Comments
 (0)