Re: Wrf_contour() not showing colored contours

From: Rick Brownrigg <brownrig_at_nyahnyahspammersnyahnyah>
Date: Tue Aug 13 2013 - 11:52:52 MDT

Hi,

I think the issue might be that "wrf_contour" recognizes special resources, and in particular has "gsnContourNegLineDashPattern" which as a default of "dashed". Your contour intervals are certainly <= 0 for the CIN overlay.

Check out the docs at:

    http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_contour.shtml

HTH -- Rick

On Aug 13, 2013, at 11:38 AM, "A.J. Eiserloh" <arthur.eiserloh@gmail.com> wrote:

> OK, sorry about that,
>
> I put the resources that you recommended but I still have dashed lines for some reason. I attached an image for you to help you see.
>
> ------------------------------------------------------------------------------------
>
> 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,:,:)*(-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., 5
> 000., 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 = (/-300,-200,-100,0/)
> opts@cnMonoLineColor = False
> opts@cnLineColors = (/"red4","blue4","black","black"/)
> opts@cnMonoLineDashPattern = True
> opts@cnLineDashPattern = "SolidLine"
> opts@cnLineLabelPlacementMode = "Computed"
> opts@cnLineLabelPerimOn = False
> 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
>
>
>
> -A.J.
>
>
> On Tue, Aug 13, 2013 at 10:19 AM, David Brown <dbrown@ucar.edu> wrote:
> Hi Arthur,
> You are correct that the default is solid. I don't know why this would not be true in this case, but I suggest setting cnLineDashPattern to SolidLine and cnMonoLineDashPattern to True. If this fixes the problem
> then we can look into why it was not working by default.
> -dave
>
> P.S. In the future please reply to the list, and not to me personally. Thanks.
>
> On Aug 12, 2013, at 11:00 PM, A.J. Eiserloh <arthur.eiserloh@gmail.com> wrote:
>
>> Thanks, it worked but now, I somehow can't get solid contour lines for my CIN. Now, it wants to only put dashed contour lines? I thought the default was solid.
>>
>> Here is my new script:
>>
>> 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,:,:)*(-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 = (/-300,-200,-100,0/)
>> opts@cnMonoLineColor = False
>> opts@cnLineColors = (/"red4","blue4","black","black"/)
>> opts@cnLineLabelPlacementMode = "Computed"
>> opts@cnLineLabelPerimOn = False
>> 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
>>
>>
>>
>>
>>
>>
>> On Mon, Aug 12, 2013 at 6:01 PM, David Brown <dbrown@ucar.edu> wrote:
>> Probably you just need to set cnMonoLineColor to False.
>> -dave
>>
>> On Aug 12, 2013, at 5:42 PM, "A.J. Eiserloh" <arthur.eiserloh@gmail.com> wrote:
>>
>>> 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
>>
>>
>>
>>
>> --
>> Arthur J. Eiserloh, Jr.
>> San Jose State University
>> Graduate Student
>> Dept. of Meteorology and Climate Science
>
>
>
>
> --
> Arthur J. Eiserloh, Jr.
> San Jose State University
> Graduate Student
> Dept. of Meteorology and Climate Science
> <CAPE-0.png>_______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Aug 13 11:53:05 2013

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