[Thread Prev][Thread Next][Index]

[ferret_users] get attributes with pyferret



Hi pyferreters,

How do you get variable attributes with pyferret ?

You have the getdata method to get a title but it correponds to the variable name
not the long_name that is present as an attribut.

In [45]: vardict = pyferret.getdata('gpp', False)

In [46]: vardict.keys()
Out[46]:
['axis_coords',
 'axis_types',
 'data_unit',
 'axis_units',
 'title',
 'axis_names',
 'missing_value',
 'data']

In [47]: vardict['title']
Out[47]: 'gpp'

In [48]: (a, b) = pyferret.run('show att gpp')
     attributes for dataset: https://xxxx/xxxxx/gpp.nc
 gpp.units = kg C  s-1
 gpp.long_name = Gross Primary Production
 gpp._ChunkSizes = 1, 46

The previous command shows attributs but how to capture them
as python variable.

Same question, if I want to get global attributs.

For info, the ncdump is like this:
       float gpp(time, reg) ;
                gpp:units = "kg C  s-1" ;
                gpp:long_name = "Gross Primary Production" ;

Lert me know if I have missed something.

Best regards
Patrick

--
Data Analysis and Visualization Engineer / Project Manager
LSCE/IPSL, CEA-CNRS-UVSQ laboratory
LSCE - Climate and Environment Sciences Laboratory
IPSL - Institut Pierre Simon Laplace
--

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement