This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
He Eduardo,
When I run
  ncdump humedad_850_00h_1jan07.nc
I see the declaration and attributes of the rhum variable:
        short rhum(time, level, lat, lon) ;
                rhum:long_name = "4xDaily relative humidity" ;
                rhum:valid_range = -25.f, 125.f ;
                rhum:actual_range = 0.f, 100.f ;
                rhum:units = "%" ;
                rhum:add_offset = 302.66f ;
                rhum:scale_factor = 0.01f ;
                rhum:missing_value = 32766s ;
                rhum:precision = 2s ;
                rhum:least_significant_digit = 0s ;
                rhum:GRIB_id = 52s ;
                rhum:GRIB_name = "RH" ;
                rhum:var_desc = "Relative humidity\n",
                        "R" ;
                rhum:dataset = "NMC Reanalysis\n",
                        "L" ;
                rhum:level_desc = "Multiple levels\n",
                        "F" ;
                rhum:statistic = "Individual Obs\n",
                        "I" ;
                rhum:parent_stat = "Other\n",
                        "-" ;
The "add_offset" and "scale_factor" attributes means this variable is floating
point but
packed into short 16-bit integers so that it uses only half as many bits.  See
the
documentation here:
  
http://www.unidata.ucar.edu/software/netcdf/docs/netcdf.html#Attribute-Conventions
for the explanation of how to recover the original values using the add_offset
and scale_factor.
I think you only need to compute
  rh = rhum*scale_factor + add_offset
which gives values between 0 and 100 for % relative humidity.  For example, the
first value is
-21266 and -21266*0.01+302.66 = 90.0.
--Russ
Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu
Ticket Details
===================
Ticket ID: KVA-176810
Department: Support netCDF
Priority: Normal
Status: Closed