Wrf_contour() not showing colored contours

From: A.J. Eiserloh <arthur.eiserloh_at_nyahnyahspammersnyahnyah>
Date: Mon Aug 12 2013 - 17:42:28 MDT

Hi,

I am trying to plot CAPE and CIN values on the same plot. I want the CAPE
to be filled contours, and I want to overlay the contours of CIN ontop of
the CAPE with cnFillon=false. But, I want CIN to have colored contours.
Unfortunately my script only gives me contours in black even though I
define cnLineColors. Would you happen to know where my error is? My code is
below:

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/wrf/WRFUserARW.ncl"

begin
;
print("Working on WRF d03 CAPE")
; The WRF ARW input file.
  a = addfile("./wrfout_d03_2013-08-11_00:00:00.nc","r")

; We generate plots, but what kind do we prefer?
; type = "x11"
; type = "pdf"
  type = "ps"
; type = "ncgm"
; type = "png"
  type@wkOrientation= "landscape"
  wks = gsn_open_wks(type,"plt_CAPE")
  gsn_define_colormap(wks,"ktc_coltbl")

; Set some Basic Plot options
  res = True
  res@MainTitle = " "
  res@Footer = False
  MTOPosF = -0.05

  pltres = True
  mpres = True
  mpres@gsnMaximize = True
  mpres@mpGeophysicalLineColor = "Black"
  mpres@mpNationalLineColor = "Black"
  mpres@mpUSStateLineColor = "Black"
  mpres@mpLimbLineColor = "Black"
  mpres@mpPerimLineColor = "Black"
  mpres@mpOutlineBoundarySets = "AllBoundaries"
  mpres@mpGeophysicalLineThicknessF = 2.0
  mpres@mpGridLineThicknessF = 2.0
  mpres@mpLimbLineThicknessF = 2.0
  mpres@mpNationalLineThicknessF = 2.0
  mpres@mpUSStateLineThicknessF = 2.0
  mpres@mpDataBaseVersion = "HighRes"
  mpres@mpDataSetName = "Earth..4"

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

; What times and how many time steps are in the data set?
  times = wrf_user_list_times(a) ; get times in the file
  ntimes = dimsizes(times) ; number of times in the file

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

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

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need
  cape2d = wrf_user_getvar(a,"cape_2d",it) ; CAPE
  cape3d = wrf_user_getvar(a,"cape_3d",it) ; CAPE

  cape = cape3d(0,:,:,:)
  cin = cape3d(1,:,:,:)
  mcape = cape2d(0,:,:)
  mcin = cape2d(1,:,:)
  lcl = cape2d(2,:,:)
  lfc = cape2d(3,:,:)

  mcape@description = "CAPE"
  mcape@units = "J/kg"
; mcape@_FillValue = 0
  mcin@description = "Convective Inhibition"
  mcin@units = "J/kg"
; mcin@_FillValue = 0

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; Plotting Time

      res@InitTime = False
      res@ValidTime = False
      res@NoHeaderFooter = True
      tt=lcl
      tt@description = " Init " + times(0) +" / Valid " + times(it)
      tt@units = "UTC"
      opts=res
      opts@ContourParameters = (/0.5, 1.5, 1./)
      opts@cnFillColors = -1
      opts@lbTitleOn = False
      opts@cnInfoLabelOn = False
      title = wrf_contour(a,wks,tt,opts)
      title2= title
      delete(opts)

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

if(.not.all(ismissing(mcape)) .and. .not.all(ismissing(mcin))) then

      ; Plotting options for CAPE
        opts = res
        opts@cnFillOn = True
        opts@cnInfoLabelOrthogonalPosF = 0.07 ; offset second label
information
        opts@pmLabelBarOrthogonalPosF = -0.07 ; offset second label
information
        opts@lbOrientation = "Vertical"
        opts@pmLabelBarSide = "Right"
        opts@lbTitleOn = False
        opts@cnLevelSelectionMode = "ExplicitLevels"
        opts@cnLevels = (/100., 250., 500., 750., 1000., 1500.,
2000., 2500., 3000., 3500., 4000., 4500., 5000., 5500.
/)
        opts@cnFillColors =
(/0,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21/)
        opts@cnConstFLabelOn = False
        contour_cape = wrf_contour(a,wks,mcape,opts)
        delete(opts)

; Plotting options for CIN

        gsn_define_colormap(wks,"ktc_coltbl")
        opts = res
        opts@cnFillOn = False
        opts@lbOrientation = "Vertical"
        opts@pmLabelBarSide = "Right"
        opts@cnLevelSelectionMode = "ExplicitLevels"
        opts@cnLevels = (/-200,-100,0,100,200/)
        opts@cnLineColors = (/14,14,14,14,14,14/)
        opts@cnLineLabelPerimOn = False
        opts@cnLineLabelFontThicknessF = 0.98
        ;opts@cnLineLabelPlacementMode = "Computed"
        contour_cin = wrf_contour(a,wks,mcin,opts)
        delete(opts)

end if

if(.not.all(ismissing(mcape)) .and. .not.all(ismissing(mcin))) then
      ; MAKE PLOTS
          plot =
wrf_map_overlays(a,wks,(/title,contour_cape,contour_cin/),pltres,mpres)
else
          plot = wrf_map_overlays(a,wks,(/title,title2/),pltres,mpres)
end if
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  end do ; END OF TIME LOOP

  delete(wks)
  system("convert plt_CAPE.ps -rotate '-90<' CAPE.png")

end

Thanks,

-- 
Arthur J. Eiserloh, Jr.
San Jose State University
Graduate Student
Dept. of Meteorology and Climate Science

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Aug 12 17:42:38 2013

This archive was generated by hypermail 2.1.8 : Wed Aug 14 2013 - 18:35:09 MDT