Reflectivity

From: Jonathan Smith <jwsmith_at_nyahnyahspammersnyahnyah>
Date: Sat, 11 Oct 2008 17:06:22 -0600

Hello,

Does anyone have a good reflectivity script that is compatible with the
latest addition of WRFUserARW.ncl? I am having trouble with the
attached script.

;
; Script to produce standard plots for a WRF real-data run,
; with the MASS coordinate dynamics option.

   load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
; load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
   load "/ptmp/jwsmith/NCLscripts/WRFUserARW.ncl"

load "/ptmp/jwsmith/NCLscripts/wrf_plot.ncl"
;load "/ptmp/jwsmith/NCLscripts/wrf_user_mass.ncl"
;load "/ptmp/jwsmith/NCLscripts/gsn_code.ncl"

; What kind of plots do we prefer?

; type = "x11"
; type = "pdf"
   type = "ps"
; type = "ncgm"

; We know the data ia big, so we will increase the workstation space
  wks = gsn_open_wks(type,"Reflectivity")

  dirname = "/ptmp/jwsmith/WRFChem3/run/"
  filename = "wrfout_d01_2006-05-01_00:00:00.nc"
  print(" reading from file "+dirname+filename)

  a = addfile (dirname + filename, "r")

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

  do it = 0, ntimes-1
  time = it

  rhosn = wrf_user_getvar(a, "RHOSN",time)
  tc = wrf_user_getvar(a, "tc",time)
  tc = tc + 273.15

  qr = wrf_user_getvar(a, "QRAIN",time)
  qs = wrf_user_getvar(a, "QSNOW",time)
  qg = wrf_user_getvar(a, "QGRAUP",time)
  nm = 3

  x = wrf_user_getref(rhosn, tc, qr, qs, qg, nm )
  dims_qr = dimsizes(qr)
  nx = dims_qr(1)
  ny = dims_qr(2)
  refmax = new((/nx,ny/), "float")
  do i=0,nx-1
  do j=0,ny-1
     refmax(i,j) = max(x(:,i,j))
  end do
  end do
  refmax_at_units = "dBZ" ; upgrade attribute
  print(" max of refmax "+max(refmax))

  print(" ntimes "+ntimes)
  print(" times "+times)

;************************************************
; create the plot
;************************************************

        opts_ref = True
        opts_ref_at_MainTitle = "Max Reflectivity (dBZ)"
        opts_ref_at_UnitLabel = ""
        opts_ref_at_TimeLabel = times(it)
        opts_ref_at_LevelLabel = ""

        opts_ref_at_ContourParameters = (/ 5., 75., 10./);
        opts_ref_at_LineThickness = 2.
        opts_ref_at_cnInfoLabelOn = False
        opts_ref_at_cnLineLabelsOn = False
        opts_ref_at_lbAutoManage = False
        opts_ref_at_lbBottomMarginF = .4
        opts_ref_at_lbTitleFontHeightF = .02
        opts_ref_at_lbLabelFontHeightF = .02
        opts_ref_at_pmLabelBarOrthogonalPosF = -.08
        opts_ref_at_pmLabelBarSide = "Bottom"
        opts_ref_at_lbOrientation = "horizontal"
        opts_ref_at_lbLabelAlignment = "InteriorEdges"

        ; Map options

 ; opts_mp = False
        opts_mp = True
        opts_mp_at_mpGeophysicalLineThicknessF = 0.5
        opts_mp_at_mpGeophysicalLineColor = "gray"
        opts_mp_at_mpUSStateLineThicknessF = 0.5
        opts_mp_at_mpUSStateLineColor = "gray"
        opts_mp_at_mpNationalLineThicknessF = 0.5
        opts_mp_at_mpNationalLineColor = "purple"
        opts_mp_at_mpGridLineThicknessF = 0.1
        opts_mp_at_mpGridLineColor = "gray"
        opts_mp_at_mpLimbLineThicknessF = 0.5
        opts_mp_at_mpLimbLineColor = "gray"
        opts_mp_at_mpPerimOn = True
        opts_mp_at_mpPerimLineThicknessF = 1.0
        opts_mp_at_mpPerimLineColor = "purple"
        opts_mp_at_mpGridSpacingF = 2.5
        opts_mp_at_mpGridMaskMode = 3

        map = wrf_map(wks,a,opts_mp)

        ;if(max(refmax).gt.5.) then
        ; contour_ref = wrf_new_fill_contour(wks,refmax,opts_ref)
        ; wrf_mapoverlay(map,contour_ref)
        ;else
        ; print(" max(refmax) < 5 ")
        ;end if

        ; Put on the map last, and then close the metacode frame.

        draw(map)
        frame(wks)

        delete(opts_ref) ; zap the old options, start anew
        delete(refmax)
        ;delete(x)
        ; ************************************************************

   end do ; end of the it loop (time)

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat Oct 11 2008 - 17:06:22 MDT

This archive was generated by hypermail 2.2.0 : Fri Oct 17 2008 - 10:06:33 MDT