Variable definition problem

From: Helen Parish <hparish_at_nyahnyahspammersnyahnyah>
Date: Tue, 1 Sep 2009 21:49:59 -0700

I am trying to do some averaging on variables, and want to store the
results into another variable and plot the results. I cannot find a
way to do this without getting an error from gsn_csm_pres_hgt, which
does not accept the variables the way I have defined them. I have
tried many different ways of getting around this, some of which
appeared to work in other scripts, but which for some reason do not
work here.

The error I am currently getting is as follows :

(0) gsn_csm_pres_hgt: Fatal: The first dimension of the input
data must
(0) have a coordinate variable called 'lev.'
(0) Cannot create plot.
fatal:Illegal right-hand side type for assignment
fatal:Execute: Error occurred at or near line 74

Does anyone have any ideas as to what I need to do to get my script
to work ?. I enclose my current script below.

Thanks,
Helen.

;***********************
; first.ncl
;***********************
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

; Keep all files open when have a lot of files :
   setfileoption("nc","SuppressClose",False)

   diri = "./"
   fili = systemfunc("cd "+diri+" ; ls azeusrand09125*.cam2.h0*nc")

   f = addfiles (fili,"r")
   U = addfiles_GetVar(f,fili,"U")
   V = addfiles_GetVar(f,fili,"V")
   printVarSummary( U )
   printVarSummary( V )

   dimu = dimsizes( U ) ; (time,lev,lat,lon)
   ntim = dimu(0)
   klvl = dimu(1)
   nlat = dimu(2)
   mlon = dimu(3)

   dimv = dimsizes( V ) ; (time,lev,lat,lon)
   ntimv = dimv(0)
   klvlv = dimv(1)
   nlatv = dimv(2)
   mlonv = dimv(3)

   ureorder = U(lev | :, lat | :, lon | :, time | :) ;
(lev,lat,lon,time)
   vreorder = V(lev | :, lat | :, lon | :, time | :) ;
(lev,lat,lon,time)

   utime = dim_avg_Wrap(ureorder) ; (lev,lat,lon)
   vtime = dim_avg_Wrap(vreorder) ; (lev,lat,lon)

   utime_reorder = utime(lev | :, lat | :, lon | :) ; (lev,lat,lon)
   vtime_reorder = vtime(lev | :, lat | :, lon | :) ; (lev,lat,lon)

   utimeavg = dim_avg_Wrap(utime_reorder) ; (lev,lat)
   vtimeavg = dim_avg_Wrap(vtime_reorder) ; (lev,lat)

   uvproduct = new ( (/klvl,nlat/) , double)
   uvproduct!0 = "lev"
   uvproduct!1 = "lat"
; uvproduct&lev = utimeavg_at_lev
; uvproduct&lat = utimeavg&lat

   uvproduct = utimeavg * vtimeavg ; (lev,lat)

;***********************
; Create Plot
;***********************
  wks = gsn_open_wks ("pdf", "angmom1" ) ; open workstation
   gsn_define_colormap(wks,"rainbow") ; choose colormap

   res = True
   res_at_cnFillOn = True
   res_at_lbLabelAutoStride = True
   res_at_gsnMaximize = True ; if [ps, eps, pdf] make large
   res_at_gsnSpreadColors = True ; span color map

      res_at_gsnLeftString = ""
      res_at_gsnCenterString = "First angular momentume term, year 164"
      res_at_gsnRightString = ""

      res_at_tiXAxisString = "Latitude (degrees)"
      res_at_tiYAxisString = "Pressure (mb)"

     plot = gsn_csm_pres_hgt(wks, uvproduct(lev | :,lat | :),
res ) ; (lev,lat)

      res_at_trYReverse = True

end

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Sep 01 2009 - 22:49:59 MDT

This archive was generated by hypermail 2.2.0 : Thu Sep 03 2009 - 07:55:08 MDT