Skip to content

Commit

Permalink
FIX: use datastore._group instead of variable["sweep_number"] (#123)
Browse files Browse the repository at this point in the history
* FIX: use datastore._group instead of variable["sweep_number"] (might be empty/corrupt) for iris reader
* DOC: add history.md entry
* STY: E721 - Do not compare types, use `isinstance()`
  • Loading branch information
kmuehlbauer committed Aug 30, 2023
1 parent 5d6a3b8 commit 2176a6e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions docs/history.md
@@ -1,5 +1,9 @@
# History

## development version

* FIX: use datastore._group instead of variable["sweep_number"] ({issue}`121`) by [@aladinor](https://github.com/aladinor) , {pull}`123`) by [@kmuehlbauer](https://github.com/kmuehlbauer)

## 0.3.0 (2023-07-11)
* ENH: Add new examples using radar data on AWS s3 bucket ({pull}`102`) by [@aladinor](https://github.com/aladinor)
* FIX: Correct DB_DBTE8/DB_DBZE8 and DB_DBTE16/DB_DBZE16 decoding for iris-backend ({pull}`110`) by [@kmuehlbauer](https://github.com/kmuehlbauer)
Expand Down
4 changes: 2 additions & 2 deletions tests/georeference/test_projection.py
Expand Up @@ -47,7 +47,7 @@ def test_get_crs():
"false_northing": 0.0,
}
for key, value in crs.items():
if type(value) == float:
if isinstance(value, float):
assert proj_crs_cf[key] == pytest.approx(value)
else:
assert proj_crs_cf[key] == value
Expand Down Expand Up @@ -78,7 +78,7 @@ def test_write_crs():
"false_northing": 0.0,
}
for key, value in crs.items():
if type(value) == float:
if isinstance(value, float):
assert ds.spatial_ref.attrs[key] == pytest.approx(value)
else:
assert ds.spatial_ref.attrs[key] == value
2 changes: 1 addition & 1 deletion tests/georeference/test_transforms.py
Expand Up @@ -78,7 +78,7 @@ def test_get_x_y_z():
"false_northing": 0.0,
}
for key, value in crs.items():
if type(value) == float:
if isinstance(value, float):
assert ds.spatial_ref.attrs[key] == pytest.approx(value)
else:
assert ds.spatial_ref.attrs[key] == value
8 changes: 6 additions & 2 deletions xradar/io/backends/iris.py
Expand Up @@ -3744,7 +3744,12 @@ class IrisArrayWrapper(BackendArray):

def __init__(self, datastore, name, var):
self.datastore = datastore
self.group = var["sweep_number"]
self.group = datastore._group
if self.group != var["sweep_number"]:
warnings.warn(
f"sweep_{self.group - 1} empty or corrupted.",
RuntimeWarning,
)
self.name = name
# get rays and bins
nrays = var["number_rays_file_written"]
Expand Down Expand Up @@ -3889,7 +3894,6 @@ def open_store_coordinates(self, var):
range_attrs["meters_to_center_of_first_gate"] = task["range_first_bin"]

rtime = Variable((dim,), rtime, rtime_attrs, encoding)
azimuth = Variable((dim,), azimuth, {}, encoding)

ing_head = self.ds["ingest_data_hdrs"]
data = ing_head[list(ing_head.keys())[0]]
Expand Down

0 comments on commit 2176a6e

Please sign in to comment.