[ncl-talk] Contour shading below thresold value on map

Adam Phillips asphilli at ucar.edu
Fri May 17 10:14:28 MDT 2019


Hi Sourav,
gsn_contour_shade will simply alter the existing contour field to do what
is specified. Thus, you cannot have both color shaded and pattern filled
contours for the same set of contours. I recommend creating a second plot
(for the pattern filled plot), calling gsn_contour_shade for the 2nd plot,
and then overlaying the 2nd plot on the first plot:

plot = gsn_csm_contour_map(wks,e_new,res)

res2 = True
res2 at gsnDraw = False
res2 at gsnFrame = False
res2 at cnLinesOn = False
res2 at cnLineLabelsOn = False
res2 at cnLevelSelectionMode = res at cnLevelSelectionMode
res2 at cnMinLevelValF = res at cnMinLevelValF
res2 at cnMaxLevelValF = res at cnMaxLevelValF
res2 at cnLevelSpacingF = res at cnLevelSpacingF

oplot = gsn_csm_contour_wks,e_new,res2)

opt = True
opt at gsnShadeFillType = "pattern"
opt at gsnShadeLow = 3
oplot = gsn_contour_shade(oplot,0,-999,opt)

overlay(plot,oplot)
lat_spacing = 5   ; use integers here
lon_spacing = 5
add_lc_labels(wks,plot,minlat,maxlat,minlon,maxlon,lat_spacing,lon_spacing)
draw(plot)
frame(wks)

end

That should at least get you going in the right direction. Hope that helps!
Adam

On Fri, May 17, 2019 at 8:50 AM Sourav Chatterjee <srvsxc at outlook.com>
wrote:

> Hi Users
>
> I am trying to shade the negative contour values with specified pattern
> over a map. Although the shade appears correctly but the
> colour contours are not coming up in the figure. Below is the part of the
> script and the figure is attached. When gsn_contour_shade
> is not used it produces the coloured contour plot.
>
> Any help is appreciated!
>
>
> wks = gsn_open_wks("eps","shade_negative")
> gsn_define_colormap(wks,"amwg256")
>
>     res                       = True
> res at cnFillOn              = True
>     res at cnLinesOn             =False
> res at gsnDraw = False
> res at gsnFrame = False
>  res at mpDataBaseVersion    = "MediumRes"    ; better map outlines
>   res at mpGridAndLimbOn      = True           ; turn on limb and grid lines
> ;  res at mpGridLineColor      = -1             ; ...but don't draw grid
> lines...
> ;  res at mpPerimOn            = False          ; turn off map perimeter
> res at mpFillOn = True
>   res at mpFillDrawOrder      = "PreDraw"     ; draw map fill last
>
> res at mpProjection            = "LambertConformal"
>       res at gsnMaskLambertConformal = True
>       res at mpMinLatF               = 60
>       res at mpMaxLatF               = 75
>       res at mpMinLonF               = -15
>       res at mpMaxLonF               = 15
>       res at mpOutlineBoundarySets   = "AllBoundaries"
>  res at mpDataSetName           = "Earth..3"
> res at tiMainString = ""
> res at cnLevelSelectionMode = "ManualLevels"
> res at cnMinLevelValF = -0.3
> res at cnMaxLevelValF = 0.8
> res at cnLevelSpacingF = 0.02
> res at gsnAddCyclic = False
> res at mpGridLatSpacingF       = 5
>   res at mpGridLonSpacingF       =  5
> res at gsnLeftString = ""
> ;res at gsnContourZeroLineThicknessF = 3.5
>
>
>
> plot = gsn_csm_contour_map(wks,e_new,res)
>
> opt = True
> opt at gsnShadeFillType = "pattern"
> opt at gsnShadeLow = 3
> plot = gsn_contour_shade(plot,0,-999,opt)
> delete(opt at gsnShadeLow)
>
> ;---Attach latitude labels
>   lat_spacing = 5   ; use integers here
>  lon_spacing = 5
>
> add_lc_labels(wks,plot,minlat,maxlat,minlon,maxlon,lat_spacing,lon_spacing)
>
>
>
> ;---Drawing the plot will also draw all the attached labels.
>   draw(plot)
>   frame(wks)
>
> exit
> end
>
>
>
>
> Regards
> Sourav
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>


-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190517/772b0b1f/attachment.html>


More information about the ncl-talk mailing list