Describe the bug
Incorrect reading of patches (probably, incorrect datatype).
An incorrect result is returned while reading patches. Records "numParticles", "numParticlesOffset" have wrong datatypes.
Patch_Record_Component.load() returned incorrect values
([ 40235664 140320876527616 1441437753781782131
15708555500268357122])
insead of ([321792, 76800, 321792, 76800])
To Reproduce
Python:
import openpmd_api
series = openpmd_api.Series("checkpoint_0_err.h5", openpmd_api.Access_Type.read_only)
iteration = series.iterations[0]
carbon = iteration.particles["C"]
dataset = carbon.particle_patches["numParticles"][openpmd_api.Mesh_Record_Component.SCALAR].load()
print(dataset)
Software Environment
Thank you for the report!
Are you sure you are using openPMD-api 0.5.0-dev and not 0.9.0-alpha or 0.10.0-dev?
Otherwise can you please update to the latest release?
I think I spotted an little bug in the usage. You have to call series.flush() before you can access the loaded data, otherwise it is still allocated but uninitialized (random).
import openpmd_api
SCALAR = api.Mesh_Record_Component.SCALAR
series = openpmd_api.Series("checkpoint_0_err.h5", openpmd_api.Access_Type.read_only)
iteration = series.iterations[0]
carbon = iteration.particles["C"]
numParticles = carbon.particle_patches["numParticles"][SCALAR].load()
series.flush() # read all the data
print(numParticles)
(I am working on making this more comfortable in the future via #484, but a logic issue needs to be decluttered first inside some internal routines.)
Yes, now it works. Thank you for answer.:)
Great, glad this helped! :)
Feel free to open more issues if anything does not work as expected or if something is undocumented.
Most helpful comment
Yes, now it works. Thank you for answer.:)