python high-level handling of scalars (GlobalValue)
Created by: germasch
While working on the python HL API, I noticed this (small) issue:
When reading a GlobalValue, the API will return a 1-d numpy array with one element, ie., array([value])
.
Current behavior:
def test_GlobalValue1d(self):
with adios2.open(filename, 'r') as fh:
for fh_step in fh:
t = fh_step.current_step()
val = fh_step.read('global_value')
self.assertTrue(np.array_equal(val, np.array([global_values[t]])))
I'd propose changing this to returning a 0-d array, which is numpy's way of handling scalars. That'll make is possible to just say
self.assertTrue(val == global_values[t])
and generally will be less confusing for users of the HL API, as they won't have to unpack the scalar value from the 1-d array first.