Int16 Reading Temperature from NARR values around 1600/1700??

Feb 5, 2014 at 8:02 PM
Hi, we are reading data from a NARR data sets, from the file ftp.cdc.noaa.gov_Datasets_NARR_pressure_air.201201.nc, that contains temperature by time/pressure/location. the program runs well with no exceptions but we are puzzled by the numbers. Temperatures are negative numbers between -16000 and -18000. IT does nto make too much sense. Looks like a singed/unsigned type of problem but tried to convert and still does not make sense to me.
According to metadata, the temperature comes in variable with the following schema:

{<[8]air of type Int16 (time:248) (level:29) (y:277) (x:349)>

So, we read a small sample of the file with the following statements:

var dataset1 = Microsoft.Research.Science.Data.DataSet.Open(inputFile1 + "?openMode=open");

Int16[,,,] airSample = dataset1.GetData<Int16[,,,]>("air",
         Microsoft.Research.Science.Data.DataSet.Range(0, 1, 7),
         Microsoft.Research.Science.Data.DataSet.Range(0, 1, 7),
         Microsoft.Research.Science.Data.DataSet.Range(0, 1, 7),
         Microsoft.Research.Science.Data.DataSet.Range(0, 1, 7));

/* Temperature readings for first values (same happens to all values)
t: 0 l: 0 y: 0 x: 0 -16869
t: 0 l: 0 y: 0 x: 1 -16875
t: 0 l: 0 y: 0 x: 2 -16877
t: 0 l: 0 y: 0 x: 3 -16874
t: 0 l: 0 y: 0 x: 4 -16864
t: 0 l: 0 y: 0 x: 5 -16858
t: 0 l: 0 y: 0 x: 6 -16847

*/


Any idea how to interpret this values?

Thanks!, Pablo.
Feb 5, 2014 at 9:03 PM
I think I may answer this myself, seems that the NARR did pack the data and needs to be unpacked.

http://www.esrl.noaa.gov/psd/data/gridded/faq.html#2


I look at the data with ncdump and they look like a bunch of large negative integers. The parameter should range from -6 to 40. What's going on here?
The vast majority of the data that we distribute in netCDF files have been packed into short integers to save space. You must unpack that data to get the correct floating point representation of the data. Each netCDF variable that has been packed has an add_offset and scale_factor attribute associated with it. The scale_factor and add_offset can vary with each netCDF file even for the same variable from the same data set, though this doesn't happen often.
The formula to unpack the data is:
unpacked value = add_offset + ( (packed value) * scale_factor )
NCL has this builtin. Use the function short2flt to read the netCDF fileswhere the data is packed.

Will reply myself when I figure out