Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #KVA-176810]: problems with ncdump



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
russ@xxxxxxxxxxxxxxxx                     http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: KVA-176810
Department: Support netCDF
Priority: Normal
Status: Closed


 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Office of Programs University Corporation for Atmospheric Research (UCAR)   Unidata is a member of the UCAR Office of Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690