On 11/16/10 8:44 AM, Gerrit Holl wrote: > [Gerrit Holl] >>> I am moving from NetCDF to HDF5. In NetCDF, I can assign attributes to >>> each variable/column. That is very useful for self-documenting the >>> file like this: >>> >>> double AVHRR_LONG(Collocations) ; >>> AVHRR_LONG:long_name = "AVHRR Longitude" ; >>> AVHRR_LONG:units = "degrees_east" ; >>> AVHRR_LONG:valid_range = -180., 180. ; >>> >>> I know that in HDF5, I can assign attributes to each node. But I think >>> the columns of a table are not nodes. Is there an equivalent in HDF5 >>> to NetCDF's variable attributes? How would I use this in pytables? > [Jeff Whitaker] >> Gerrit: Are you aware that if you use netcdf 4, then your data is >> actually saved in an HDF5 file (readable by hdf5 and netcdf clients)? > A bit, but I don't understand the details of it. I should specify that > I was using NetCDF 3 before. > > But then how would I use all of pytables' nice HDF5 features (blosc > compression, fast searching, possibly indexing if I buy the > professional version) in a NetCDF4 file? Some combination of your > netcdf4-python with pytables?
Gerrit: You can use zlib compression (with the shuffle filter) with netcdf, but not those other features you mention. It's possible that a netcdf 4 compatible HDF file can be opened with pytables, but I've never tried that. The main benefit of sticking to the netcdf api for creating HDF5 is interoperability - netcdf is pretty much the de-facto standard in the geophysical sciences. -Jeff > [David E. Sallis] >> You can store arbitrary key/value pairs on a node by using the node's >> _f_setAttr() method. I use this frequently and in much the same way as in >> your >> example. The key is the column name, and the value is a Python dictionary >> containing the long name, units, etc. >> >> Example: n._f_setAttr('AVHRR_LONG':{'long_name':'AVHRR_Longitude', >> 'units':'degrees_east', 'valid_range':(-180.0,180.0)}) > What is 'n' in this case? The table containing those columns? So then > I actually set the properties to the table, with property names equal > to the column, rather than setting properties to the variable, or am I > misunderstanding things? > > Gerrit. > -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : jeffrey.s.whita...@noaa.gov 325 Broadway Office : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today http://p.sf.net/sfu/msIE9-sfdev2dev _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users