Re: Question about netCDF info as provided by ncdump and ncl

From: AJ Smit <albertus.smit_at_nyahnyahspammersnyahnyah>
Date: Mon, 12 Oct 2009 12:47:46 +0200

Hi Dave,

Thanks, that's exactly it. I knew it was something obvious.

Kind regards,
AJ

On Oct 12, 2009, at 7:57 AM, Dave Allured wrote:

> AJ,
>
> "f" is one of the normal attribute suffixes in ncdump output. It is
> just a data type code meaning "float". This is probably documented
> somewhere with ncdump or on the Netcdf website.
>
> Also, the ncdump output shows that this SST data is in packed
> format, compressed from 32 bit floats to 16 bit integers by a simple
> linear formula. This cuts the file size in half.
>
> After the unpacking formula is applied, you will probably see that
> the SST values are within the expected range. You can apply the
> formula explicitly. This is an array formula:
>
> sst_unpacked = f->sst * sst_at_scale_factor + sst_at_add_offset
>
> But it is better practice to use the NCL unpacking function made for
> this purpose. Also it preserves the coordinates and attributes with
> the data variable:
>
> sst_unpacked = short2flt (f->sst)
>
> http://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml
>
> Packing is discussed here in the CF convention standards:
>
> http://cf-pcmdi.llnl.gov/documents/cf-conventions/1.4/ch08.html
>
> Dave Allured
> CU/CIRES Climate Diagnostics Center (CDC)
> http://cires.colorado.edu/science/centers/cdc/
> NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
> http://www.cdc.noaa.gov/psd1/
>
> AJ Smit wrote:
>> Dear all,
>>
>> I am puzzled by the behaviour of ncl, specifically when comparing the
>> outputs of ncdump vs that of ncl. In short, this is what's worrying
>> me:
>>
>> From ncdump for the sst variable:
>> sst:valid_range = -5.f, 40.f ;
>> sst:actual_range = -1.7999996f, 35.310001f ;
>> From ncl for the sst variable:
>> valid_range : ( -5, 40 )
>> actual_range : ( -1.8, 35.31 )
>>
>> Despite the correct ranges indicated above, in ncl the sst values in
>> this variable are bogus - the values do not make sense at all.
>> Conversely, ndump retains sensible sst values even though the ranges
>> indicated above contain an "f". What does this mean?
>>
>> I am sure there is an obvious solution, but it escapes me for now.
>> How
>> do I correctly read in the data using ncl?
>>
>> The full header info provided by netCDF and ncl is at the end of the
>> message.
>>
>> With kind regards,
>> AJ
>>
>> ncl 7> in = addfile("sst.mnmean.nc","r")
>> ncl 8> print(in)
>> Variable: in (file variable)
>>
>> filename: sst.mnmean
>> path: sst.mnmean.nc
>> file global attributes:
>> title : NOAA Optimum Interpolation (OI) SST V2
>> Conventions : CF-1.0
>> history : Wed Apr 6 13:47:45 2005: ncks -d time,0,278
>> SAVEs/sst.mnmean.nc sst.mnmean.nc
>> Created 10/2002 by RHS
>> comments : Data described in Reynolds, R.W., N.A. Rayner, T.M.
>> Smith, D.C. Stokes, and W. Wang, 2002: An Improved In Situ and
>> Satellite
>> SST Analysis for Climate, J. Climate
>> platform : Model
>> source : NCEP Climate Modeling Branch
>> institution : National Centers for Environmental Prediction
>> references : http://www.emc.ncep.noaa.gov/research/cmb/sst_analysis/
>> http://www.cdc.noaa.gov/cdc/data.noaa.oisst.v2.html
>> dimensions:
>> lon = 360
>> lat = 180
>> nbnds = 2
>> time = 333 // unlimited
>> variables:
>> float lat ( lat )
>> units : degrees_north
>> long_name : Latitude
>> actual_range : ( 89.5, -89.5 )
>> standard_name : latitude_north
>> axis : y
>> coordinate_defines : center
>>
>> float lon ( lon )
>> units : degrees_east
>> long_name : Longitude
>> actual_range : ( 0.5, 359.5 )
>> standard_name : longitude_east
>> axis : x
>> coordinate_defines : center
>>
>> <! Snip: time - display same as ncdump -h; see below >
>>
>> double time_bnds ( time, nbnds )
>> long_name : Time Boundaries
>>
>> short sst ( time, lat, lon )
>> long_name : Monthly Mean of Sea Surface Temperature
>> valid_range : ( -5, 40 )
>> actual_range : ( -1.8, 35.31 )
>> units : degC
>> add_offset : 0
>> scale_factor : 0.01
>> missing_value : 32767
>> precision : 2
>> least_significant_digit : 2
>> var_desc : Sea Surface Temperature
>> dataset : NOAA Optimum Interpolation (OI) SST V2
>> level_desc : Surface
>> statistic : Mean
>> parent_stat : Weekly Mean
>> standard_name : sea_surface_temperature
>> cell_methods : time: mean (monthly from weekly values
>> interpolated to daily)
>> _FillValue : 32767
>>
>> Here is the corresponding ncdump output:
>>
>> Pelagia:OISSTv2 ajsmit$ ncdump -h sst.mnmean.nc
>> netcdf sst.mnmean {
>> dimensions:
>> lon = 360 ;
>> lat = 180 ;
>> nbnds = 2 ;
>> time = UNLIMITED ; // (333 currently)
>>
>> variables:
>> float lat(lat) ;
>> lat:units = "degrees_north" ;
>> lat:long_name = "Latitude" ;
>> lat:actual_range = 89.5f, -89.5f ;
>> lat:standard_name = "latitude_north" ;
>> lat:axis = "y" ;
>> lat:coordinate_defines = "center" ;
>> float lon(lon) ;
>> lon:units = "degrees_east" ;
>> lon:long_name = "Longitude" ;
>> lon:actual_range = 0.5f, 359.5f ;
>> lon:standard_name = "longitude_east" ;
>> lon:axis = "x" ;
>> lon:coordinate_defines = "center" ;
>> double time(time) ;
>> time:units = "days since 1800-1-1 00:00:00" ;
>> time:long_name = "Time" ;
>> time:actual_range = 66443., 76548. ;
>> time:delta_t = "0000-01-00 00:00:00" ;
>> time:avg_period = "0000-01-00 00:00:00" ;
>> time:prev_avg_period = "0000-00-07 00:00:00" ;
>> time:standard_name = "time" ;
>> time:axis = "t" ;
>> double time_bnds(time, nbnds) ;
>> time_bnds:long_name = "Time Boundaries" ;
>> short sst(time, lat, lon) ;
>> sst:long_name = "Monthly Mean of Sea Surface Temperature" ;
>> sst:valid_range = -5.f, 40.f ;
>> sst:actual_range = -1.7999996f, 35.310001f ;
>> sst:units = "degC" ;
>> sst:add_offset = 0.f ;
>> sst:scale_factor = 0.0099999998f ;
>> sst:missing_value = 32767s ;
>> sst:precision = 2s ;
>> sst:least_significant_digit = 2s ;
>> sst:var_desc = "Sea Surface Temperature" ;
>> sst:dataset = "NOAA Optimum Interpolation (OI) SST V2" ;
>> sst:level_desc = "Surface" ;
>> sst:statistic = "Mean" ;
>> sst:parent_stat = "Weekly Mean" ;
>> sst:standard_name = "sea_surface_temperature" ;
>> sst:cell_methods = "time: mean (monthly from weekly values
>> interpolated
>> to daily)" ;
>>
>> // global attributes:
>> :title = "NOAA Optimum Interpolation (OI) SST V2" ;
>> :Conventions = "CF-1.0" ;
>> :history = "Wed Apr 6 13:47:45 2005: ncks -d time,0,278
>> SAVEs/sst.mnmean.nc sst.mnmean.nc\n",
>> "Created 10/2002 by RHS" ;
>> :comments = "Data described in Reynolds, R.W., N.A. Rayner, T.M.\n",
>> "Smith, D.C. Stokes, and W. Wang, 2002: An Improved In Situ and
>> Satellite\n",
>> "SST Analysis for Climate, J. Climate" ;
>> :platform = "Model" ;
>> :source = "NCEP Climate Modeling Branch" ;
>> :institution = "National Centers for Environmental Prediction" ;
>> :references = "http://www.emc.ncep.noaa.gov/research/cmb/sst_analysis/\n
>> ",
>> "http://www.cdc.noaa.gov/cdc/data.noaa.oisst.v2.html" ;
>> }
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dr Albertus J Smit
School of Biological & Conservation Sciences
University of KwaZulu-Natal
Westville Campus
PO Box X54001
Durban, South Africa

E-mail: smitaj_at_ukzn.ac.za
Tel. +27 031 260 7410;
Fax +27 031 260 2029

Web page: http://marinesci.ukzn.ac.za/biology
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Oct 12 2009 - 04:47:46 MDT

This archive was generated by hypermail 2.2.0 : Thu Oct 15 2009 - 09:30:48 MDT