Skip to content

Commit cfd9a56

Browse files
committed
Fix bug where untensorized data could be extracted as a 0D numpy array instead of a python scalar (int or float)
1 parent eabbecf commit cfd9a56

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

imas/backends/netcdf/nc2ids.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ def run(self, lazy: bool) -> None:
206206

207207
elif metadata.path_string not in self.ncmeta.aos:
208208
# Shortcut for assigning untensorized data
209-
self.ids[target_metadata.path]._IDSPrimitive__value = data
209+
# Note: var[()] can return 0D numpy arrays. Instead of handling this
210+
# here, we'll let IDSPrimitive.value.setter take care of it:
211+
self.ids[target_metadata.path].value = data
210212

211213
else:
212214
for index, node in tree_iter(self.ids, target_metadata):

0 commit comments

Comments
 (0)