ADIOS
ADIOS copied to clipboard
Numpy: Read vs [] Inconsistent
dear @yyalli,
while the slice [] operators work great, read() calls seem to behave a bit different when slicing variables with it. Maybe we want to adjust read() to behave correctly like [] already does (see our discussion last year).
With this example file:
import adios as ad
f = ad.file("data_compressed.bp")
f["xy"].dims
# (400L, 200L)
# correct
f["xy"][:,100].shape
# (400,)
# weird
f["xy"].read((0,100),(400,1)).shape
# (400, 1)
# very weird
f["xy"].read((0,100),(400,0)).shape
# (400, 0)
I intentionally separated the output style in the following way
- using [] makes the output style close to numpy
- However, read() remains close to the Adios representation.
I thought someone who is not familiar with numpy can get confused with the output of read() function.
Do you have any specific reason to use them together in a same script?
Do you have any specific reason to use them together in a same script?
I was just using them as synonyms and realized they are not :)
I intentionally separated the output style in the following way [...] read() remains close to the Adios representation
But wouldn't the ADIOS C-API just fill you a contigous memory chunk behind a void*? In that case, the interpretation of the dimensionality via [][][] access would be agnostic of the API and created by the user (the dims/ndims in the C-API always regard the full variable, selections are still the same in the input).
Or am I missing something?