[ncl-talk] Can NCL automatically read in an integer variable with scale_factor and add_offset?

Yongxin Zhang yongxin.fred at gmail.com
Thu May 17 11:05:49 MDT 2018


I have a netCDF file, soil_m.nc, that contains only integer variables with
scale_factor and add_offset, for example, SOIL_M looks like this:

int SOIL_M(time, y, soil_layers_stag, x) ;

SOIL_M:_FillValue = -999900 ;

SOIL_M:missing_value = -999900 ;

SOIL_M:long_name = "volumetric soil moisture" ;

SOIL_M:units = "m3 m-3" ;

SOIL_M:scale_factor = 0.01f ;

SOIL_M:add_offset = 0.f ;

SOIL_M:valid_range = 0, 100 ;

After I opened the data file by issuing "fin=addfile("soil_m.nc","r")" in
ncl and then I did "data1=fin->SOIL_M", "data2=tofloat(fin->SOIL_M)", and
"data3=int2flt(fin->SOIL_M)" but in all cases the data range from 0 to 100
instead of 0 to 1 or 0.0 to 1.0. I am just wondering if there is a way that
NCL can automatically read in an integer variable with the scale_factor and
add_offset applied.

Thanks,
Yongxin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180517/fb2f4cf2/attachment.html>


More information about the ncl-talk mailing list