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

[netCDF #JWG-630753]: Decoding NC_INT data



Hello,

Using `ncdump` to look at the data you provided, I see the following:

        int air_temperature_ml(time, hybrid, ensemble_member, y, x) ;
                air_temperature_ml:_FillValue = -2147483647 ;
                air_temperature_ml:long_name = "Air temperature model levels" ;
                air_temperature_ml:standard_name = "air_temperature" ;
                air_temperature_ml:units = "K" ;
                air_temperature_ml:grid_mapping = "projection_lambert" ;
                air_temperature_ml:coordinates = "longitude latitude" ;
                air_temperature_ml:scale_factor = 0.001 ;
                air_temperature_ml:_ChunkSizes = 1, 1, 1, 949, 739 ;

I suspect you will need to apply the scale factor of 0.001 to the integer 
values to get the appropriate measurement in K, which you can then convert to 
the desired unit of temperature.

I hope this helps!

-Ward

> Full Name: Ilkka Karasalo
> Email Address: address@hidden
> Organization: KTH
> Package Version: 4.5.0
> Operating System: Ubuntu 14.04.4
> Hardware:
> Description of problem:
> 
> I want to read atmospheric data from the file
> 
> 'http://thredds.met.no/thredds/dodsC/meps25epsarchive/2017/01/06/meps_full_2_5km_20170106T00Z.nc'
> 
> using the C functions of NETCDF. For example, I read the air temperature
> (the variable "air_temperature_ml") by doing
> 
> nc_inq_varid(ncid, "air_temperature_ml", &varid)
> 
> followed by
> 
> nc_inq_var(ncid, varid, varname,
> &vartyp, &ndims, dimids, &numatt)
> 
> Surpisingly, the variable type turns out to be NC_INT , i.e. the
> real-valued temperature appears to be encoded as a 32-bit integer !? How
> are real values decoded from the data ?
> 
> I hope you can assist in this.
> 
> 
> 


Ticket Details
===================
Ticket ID: JWG-630753
Department: Support netCDF
Priority: Normal
Status: Closed
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.