Skip to content

Commit 44980b7

Browse files
author
Bryan Lawrence
committed
Fixed HDF5 NetCDF attribute issue
1 parent afe3546 commit 44980b7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

activestorage/active.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ def __get_missing_attributes(self):
133133
Load all the missing attributes we need from a netcdf file
134134
"""
135135

136+
def hfix(x):
137+
'''
138+
return item if single element list/array
139+
see https://github.com/h5netcdf/h5netcdf/issues/116
140+
'''
141+
if not np.isscalar(x) and len(x) == 1:
142+
return x[0]
143+
136144
if self.ds is None:
137145
self.__load_nc_file()
138146

@@ -151,7 +159,7 @@ def __get_missing_attributes(self):
151159
elif valid_range is not None:
152160
valid_min, valid_max = valid_range
153161

154-
return _FillValue, missing_value, valid_min, valid_max
162+
return hfix(_FillValue), hfix(missing_value), hfix(valid_min), hfix(valid_max)
155163

156164
def __getitem__(self, index):
157165
"""

0 commit comments

Comments
 (0)