Here is a section of code that will convert the data to the correct form, and
>change the array from short to float (easier to use NCL functions that way):
>
>begin
>
>fdir="/data/matt/reanalysis/"
>fnam="air.2m.gauss.1987.nc"
>f = addfile(fdir+fnam,"r")
>
>air=f->air
>printVarSummary(air)
>
>airnew = new ((/dimsizes(air)/),float,1.e+20)
>
>airnew = (/ (air*air@scale_factor)+air@add_offset /)
------------
What Adam has is correct. Some further comments:
(1) Note the variable is of type "short". this means
numeric values of 16 bits. this is often used
to 'pack' [compress] data so that files are smaller.
(2) the one minor correctio Adam's example is that you do *not*
have to explicitly allocate the target array. NCL 'knows'
the size ... [It's magic! :-) ]
(3) also the "contributed.ncl" must be loaded. It contains
the function "copyVarCoords"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
begin
fdir="/data/matt/reanalysis/"
fnam="air.2m.gauss.1987.nc"
f = addfile(fdir+fnam,"r")
air=f->air
printVarSummary(air) ; original array
airnew = (air*air@scale_factor) + air@add_offset
copy_VarAtts (air,airnew)
copy_varCoords (air,airnew)
; optional (clean-up)
delete (air) ; no longer needed
delete (airnew@scale_factor) ; no longer needed
delete (airnew@add_offset) ; no longer needed
====
In the *next* release of NCL ( 4.2.0.a023 )
announced by Mary Haley there will be about 20
new functions/procedures. One new function will be " copy_VarMeta "
It can be used to replace the pair of procedures:
copy_VarAtts and copy_varCoords
Regards
Dennis Shea
This archive was generated by hypermail 2b29 : Tue Feb 19 2002 - 08:48:13 MST