FAQ on reading and interpreting the netCDF data file

FAQ on reading and interpreting the netCDF data file

Postby yiboj » Mon Apr 24, 2017 4:42 pm

Users are often asking that they get wrong values from the netcdf files, such as the GHRSST Level 4 AVHRR_OI Global Blended Sea Surface Temperature Analysis (GDS version 2) from NCEI. The variables in netcdf files can be stored with their attributes such as units, add_offset, scale_factor and comments. The attributes of analysed_sst variable in NCEI data file are shown here:

units = "kelvin" ;
_FillValue = -32768s ;
add_offset = 273.15f ;
scale_factor = 0.01f ;
valid_min = -300s ;
valid_max = 4500s ;

User could retrieve the correct analysed_sst value by using the following formula:

analysed_sst = analysed_sst (from file) * scale_factor + add_offset

Some of the script languages such as python, matlab, IDl etc. have already used this formula internally when read the netcdf file, but most of low level languages such as c, c++, java and Fortran will only read value from the netcdf file and users are responsible for interpreting the output by using the above formula manually in order to get correct values.
Posts: 124
Joined: Mon Mar 30, 2015 11:22 am

Return to Data Recipes