Trouble reading files from 7.5

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
khyde
Posts: 39
Joined: Mon Dec 04, 2006 11:01 am America/New_York
Answers: 0

Trouble reading files from 7.5

by khyde » Wed Jul 11, 2018 2:49 pm America/New_York

Hello again,

Is there anything different between how the files were written using 7.4 and 7.5?  I can read attributes with numerical data, however I am having problems reading the string attributes.  I am using IDL 8.7 to read the files and one thing I did find when looking for a solution is that the "string must be encoded in order for it to be readable".  https://groups.google.com/forum/#!topic/idl-pvwave/23xKGl6APJA

This particular issue in the link above was related to differences between Python 2 and 3, but I didn't know if there might be a similar issue with SeaDAS 7.5.  I have no problem reading files generated with 7.4 and so I was wondering if there is anything different with how SeaDAS was writing out the files.

Thanks again for your help,
Kim
PS I am using Python 2.7.3

Tags:

gfireman
Posts: 64
Joined: Thu Jan 07, 2010 2:59 pm America/New_York
Answers: 0

Trouble reading files from 7.5

by gfireman » Wed Jul 11, 2018 3:33 pm America/New_York

The new netcdf library (netcdflibversion=xx.xxx.xx.xx|hdf5libversion=1.8.18) writes strings with type CSET H5T_CSET_UTF8; the older version wrote them as CSET H5T_CSET_ASCII.
IDL doesn't seem to handle this properly with the H5 interface.

Here's an example of how to read variable attributes using the IDL NetCDF interface:

function readncatt, filename, grpname, varname, attname
  ncid = ncdf_open(filename, /NOWRITE)
  grpid = ncdf_ncidinq(ncid, grpname)
  varid = ncdf_varid(grpid, varname)
  ncdf_attget, grpid, varid, attname, attr
  ncdf_close, ncid
  return, attr
end

filename='V2017103190600.L2_SNPP_OC.nc'
grpname='geophysical_data'
varname='l2_flags'
attname='flag_meanings'
att = readncatt(filename, grpname, varname, attname)
help, att
print, string(att)
end

Post Reply