Re: NCEP/NCAR 4x reanalysis of PW

From: Dennis Shea (shea AT ucar.edu)
Date: Tue Nov 09 2004 - 23:11:31 MST


> I have been attempting to read in and plot 4x daily NCEP/NCAR
> reanalysis precipitable water data. I found a previous message in this
> list from 2 years ago concerning temperature data, and it was helpful
> in including the add_offset and scale_factor attributes, but the
> numbers still don't make sense. I assume it has something to do with
> the way I am calculating PW using the offset and scale factor, but none
> of my other results make sense either. The values would ideally range
> from ~10 - 60 mm (kg/m2). I've included my script and the output
> below.

Hello,

What Adam sent is correct. There is one other way to convert
variables of type "short" to float. You can use a function
in contributed.ncl called 'short2flt'. It does all of the required
work for you.

I have no idea why you used "lat2d" and "lon2d".

I am appending a script that:

[1] reads/unpacks the data
[2] prints out min/max
[3] convert the "time" variable which has "units since ..."
    to the more readily understood "yyyymmddhh".
    *** Read about the built-in function "ut_calendar" ***
[4] It plot the 1st time step on a global map.

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

begin
   diri = "./"
   fili = "pr_wtr.eatm.2002.nc"
   f = addfile (diri+fili , "r")
                                 ; contributed.ncl
   pwat = short2flt(f->pr_wtr) ; convert variable from
                                 ; type short to float
   min_pwat = min( pwat )
   max_pwat = max( pwat )
   printVarSummary(pwat)
   print ("Minimum PWV = "+min_pwat+" Maximum PWV = "+max_pwat)
                                 ; convert time to yyyymmddhh
   ymdh = ut_calendar(f->time, -3)
  ;print (ymdh(0:20)) ; print 1st 21 values
                                 ; print out data for a region
   latS = 42.5 ; whatever
   latN = 28.5 ; whatever
   lonL = 280
   lonR = 300
  ;print (pwat(1:4,{latS:latN},{lonL:lonR}))
; ------------------------------------------------------
; plot
; ------------------------------------------------------
   wks = gsn_open_wks("ps", "pwat")
   gsn_define_colormap(wks,"BlAqGrYeOrRe")

   res = True ; plot mods desired
   res@gsnMaximize = True
   res@gsnSpreadColors = True ; use full range of color map

   res@cnFillOn = True ; turn on color fill
   res@cnLinesOn = False
  ;res@cnRasterModeOn = True ; use raster mode

   nt = 0 ; 1st time step
   res@gsnCenterString = ymdh(nt)
   plot = gsn_csm_contour_map_ce(wks,pwat(nt,:,:),res)

end

_______________________________________________
ncl-talk mailing list
ncl-talk AT ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk



This archive was generated by hypermail 2b29 : Wed Nov 10 2004 - 08:06:54 MST