Did something change in VIIRS day_night_flag in 2017?

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
blesht
Posts: 86
Joined: Mon Sep 19, 2005 3:06 pm America/New_York
Answers: 0

Did something change in VIIRS day_night_flag in 2017?

by blesht » Wed Jul 24, 2019 5:56 pm America/New_York

Hi - This seems strange.  I've been running through the entire VIIRS mission doing match-ups with in situ observations collected in the Great Lakes.  My match-up routine is coded in IDL.  The code happily chunks through the data from 2012-2016 but then stops with an error ("H5A_READ: unable to read attribute: Object ID:....") when it gets to 2017.  The attribute I am trying to read when the error occurs is "day_night_flag."   None of the other attributes (e.g. "easternmost_longitude") I'm reading in the code has a problem.  When I bypass checking the day_night_flag, the code runs through all the data without error.  Here are example code snippets (using a 2016 file and a 2018 file as examples).  I have checked the header dumps and don't see any differences.  Any idea what is going on?  Thanks, Barry

IDL> thisSat = '/Volumes/4TBDrive/VIIRS/L2/Erie/2018/V2018226181800.L2_SNPP_OC.x.nc'
IDL> hid = H5F_OPEN(thisSat)
IDL> ag_id = H5G_OPEN(hid,'/')
IDL> day_id = H5A_OPEN_NAME(ag_id, 'day_night_flag')
IDL> dayflag = H5A_READ(day_id)
% H5A_READ: unable to read attribute: Object ID:100663322
IDL> H5A_CLOSE, day_id
IDL> H5G_CLOSE, ag_id
IDL> H5F_CLOSE, hid

IDL> thatSat = '/Volumes/4TBDrive/VIIRS/L2/Superior/2016/V2016110180000.L2_SNPP_OC.x.nc'
IDL> hid = H5F_OPEN(thatSat)
IDL> ag_id = H5G_OPEN(hid, '/')
IDL> day_id = H5A_OPEN_NAME(ag_id, 'day_night_flag')
IDL> dayflag = H5A_READ(day_id)
IDL> print, dayflag
Day

.

Tags:

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

Did something change in VIIRS day_night_flag in 2017?

by gfireman » Tue Jul 30, 2019 11:47 am America/New_York

Hi, Barney -

There is a problem with reading string attributes with the H5 interface.

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.

Our version of IDL (and, apparently, yours) doesn't seem to handle this properly with the H5 interface.
But you can read string attributes using the NetCDF interface:

IDL> filename='V2018226181800.L2_SNPP_OC.nc'
IDL> ncid = ncdf_open(filename, /NOWRITE)             
IDL> ncdf_attget, ncid, 'day_night_flag', attr, /global
IDL> help, attr
ATTR            BYTE      = Array[4]
IDL> print, attr, string(attr)
  68  97 121   0
Day


HTH!

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

Did something change in VIIRS day_night_flag in 2017?

by gfireman » Tue Jul 30, 2019 11:53 am America/New_York

P. S. - Use "h5dump -A" to see the datatype of attributes; "ncdump -h" won't do it.

blesht
Posts: 86
Joined: Mon Sep 19, 2005 3:06 pm America/New_York
Answers: 0

Did something change in VIIRS day_night_flag in 2017?

by blesht » Tue Jul 30, 2019 7:11 pm America/New_York

Hi Gene - thanks for both the explanation and the fix.   I do appreciate it.   Regards, Barry

Post Reply