Skip to content

Commit

Permalink
swap order for h5py<3.8 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Samantha C. Niemoeller authored and Samantha C Niemoeller committed Oct 30, 2024
1 parent 72290a9 commit fe37b32
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/nisarqa/products/product_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,11 @@ def _get_stats_object(component):
return nisarqa.RasterStats(**kwargs)

# Based on the dtype, construct the *RasterStats for the input Dataset
if np.issubdtype(ds.dtype, np.complexfloating) or nisarqa.is_complex32(
dataset=ds
# Note: Check for `.is_complex32()` first so that code works with h5py<3.8.
# In older versions of h5py, even accessing ds.dtype will cause a TypeError
# to be raised if the dataset is complex32.
if nisarqa.is_complex32(dataset=ds) or np.issubdtype(
ds.dtype, np.complexfloating
):
real_stats = _get_stats_object(component="real")
imag_stats = _get_stats_object(component="imag")
Expand Down

0 comments on commit fe37b32

Please sign in to comment.