PYTHON: Reduce dimensions for 2D datasets in AmunH5.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
Grzegorz Kowal 2021-10-06 18:02:16 -03:00
parent 9a7235b72d
commit 0d4e955eb0

View File

@ -137,4 +137,8 @@ class AmunH5(Amun):
cname = os.path.join(self.dirname, self.chunks[chunk_number]['filename'])
with h5py.File(cname, 'r') as h5:
return numpy.array(h5['variables'][dataset_name])
dset = numpy.array(h5['variables'][dataset_name])
if self.attributes['ndims'] == 3:
return dset
else:
return dset[0,:,:,:]