difference between 2 geopotential heights

From: Alexander Semenov <asemenov_at_nyahnyahspammersnyahnyah>
Date: Tue Jan 17 2012 - 17:07:41 MST

hi!

I have a problem with a script. I need to plot B - the difference between 2
interpolated geopotential heights for 600 and 900 hPa based on WRF output
data.

 The error message I've encountered says

fatal:Variable (z_plane2) is undefined
fatal:Execute: Error occurred at or near line 99 in file B_parameter2.ncl

I highlighted 99th line in my script:

; Example script to produce plots for a WRF real-data run,
; with the ARW coordinate dynamics option.
; Interpolating to specified pressure levels

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

begin
;
; The WRF ARW input file.
; This needs to have a ".nc" appended, so just do it.
  a =
addfile("/import/wrkdir1/asemenov/WRF/WRFV3/10_25.03_res_30_10km/wrfout_d02_2011-03-10_00:00:00"+".nc",
"r")

  wks = gsn_open_wks("x11","plt_PressureLevel1")

  res = True

  res@Footer = False

  pltres = True
  mpres = True

  times = wrf_user_list_times(a) ; get times in the file
  ntimes = dimsizes(times) ; number of times in the file

; The specific pressure levels that we want the data interpolated to.
  pressure_levels = (/ 900., 600./) ; pressure levels to plot
  nlevels = dimsizes(pressure_levels) ; number of pressure
levels

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  do it = 0,ntimes-1,2 ; TIME LOOP

    print("Working on time: " + times(it) )
    res@TimeLabel = times(it) ; Set Valid time to use on plots

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need

    tc = wrf_user_getvar(a,"tc",it) ; T in C
    u = wrf_user_getvar(a,"ua",it) ; u averaged to mass points
    v = wrf_user_getvar(a,"va",it) ; v averaged to mass points
    p = wrf_user_getvar(a, "pressure",it) ; pressure is our vertical
coordinate
    z = wrf_user_getvar(a, "z",it) ; grid point height
    rh = wrf_user_getvar(a,"rh",it) ; relative humidity

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    do level = 0,nlevels-1 ; LOOP OVER LEVELS

      pressure = pressure_levels(level)

  if ( pressure .eq. 900 ) then
    p1 = wrf_user_getvar(a, "pressure",it) ; pressure is our vertical
coordinate
      tc_plane1 = wrf_user_intrp3d(tc,p1,"h",pressure,0.,False)
      z_plane1 = wrf_user_intrp3d( z,p1,"h",pressure,0.,False)
      rh_plane1 = wrf_user_intrp3d(rh,p1,"h",pressure,0.,False)
      u_plane1 = wrf_user_intrp3d( u,p1,"h",pressure,0.,False)
      v_plane1 = wrf_user_intrp3d( v,p1,"h",pressure,0.,False)
      spd1 = (u_plane1*u_plane1 + v_plane1*v_plane1)^(0.5) ; m/sec
      spd1@description = "Wind Speed"
      spd1@units = "m/s"
end if

 if ( pressure .eq. 600) then
    p2 = wrf_user_getvar(a, "pressure",it) ; pressure is our vertical
coordinate
      tc_plane2 = wrf_user_intrp3d(tc,p2,"h",pressure,0.,False)
      z_plane2 = wrf_user_intrp3d( z,p2,"h",pressure,0.,False)
      rh_plane2 = wrf_user_intrp3d(rh,p2,"h",pressure,0.,False)
      u_plane2 = wrf_user_intrp3d( u,p2,"h",pressure,0.,False)
      v_plane2 = wrf_user_intrp3d( v,p2,"h",pressure,0.,False)
      spd2 = (u_plane2*u_plane2 + v_plane2*v_plane2)^(0.5) ; m/sec
      spd2@description = "Wind Speed"
      spd2@units = "m/s"

end if

B = z_plane2 - z_plane1

Thermal_wind = spd2 -spd1

 ; Plotting options for B
        opts = res
        opts@cnFillOn = True
        contour_B = wrf_contour(a,wks,B,opts)
        delete(opts)

      ; Plotting options for Wind Speed
        opts = res
        opts@cnLineColor = "MediumSeaGreen"
        opts@ContourParameters = (/ 10. /)
        opts@cnInfoLabelOrthogonalPosF = 0.07 ; offset second label
information
        opts@gsnContourLineThicknessesScale = 3.0
        contour_spd = wrf_contour(a,wks,Thermal_wind,opts)
        delete(opts)

   ; opts_z@ContourParameters = (/ 20.0 /)
; contour_height = wrf_contour(a,wks,z_plane,opts_z)
          plot = wrf_map_overlays(a,wks,(/contour_B, \
                                    contour_spd/),pltres,mpres)

    end do ; END OF LEVEL LOOP

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  end do ; END OF TIME LOOP

end

-- 
regards
*******************************************************
*Alexander Semenov*
PhD Student - Research Assistant
International Arctic Research Center
Department of atmospheric sciences
University of Alaska Fairbanks

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jan 17 17:07:52 2012

This archive was generated by hypermail 2.1.8 : Wed Jan 18 2012 - 09:21:55 MST