ornladios / ADIOS

The old ADIOS 1.x code repository. Look for ADIOS2 for new repo
https://csmd.ornl.gov/adios
Other
54 stars 40 forks source link

Python API: add support for per-variable attributes #143

Closed pnorbert closed 6 years ago

pnorbert commented 6 years ago

Can we have f.var['varname'].attr return the attributes that belong to that variable? The C API has that now by adios_inq_var(). For example:

f=ad.file('re.bp'); f AdiosFile (path='re.bp', nvars=5, vars=['demo/Pressure', 'gndy', 'gndx', 'dT', 'T'], nattrs=1, attrs=['T/unit'], current_step=0, last_step=9, file_size=28935979) a=f.attr['T/unit'] a AdiosAttr (name='T/unit', dtype=dtype('S1'), value=array('C', dtype='|S1')) a.value 'C' v=f.var['T'] v AdiosVar (varid=2, name='T', dtype=dtype('float64'), ndim=2, dims=(300L, 400L), nsteps=10)

It would be nice to have something like v.attrs a=v.attr['unit'] functions

pnorbert commented 6 years ago

Oh Blimey, this is already supported.

v.attrs['unit'].value 'C'