Re: shade contour

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Mon Jul 08 2013 - 09:05:46 MDT

Hi Nancy,
You cannot force ShadeGtContour to shade in Raster mode. The best way to
do what you want is to set the appropriate resources in your res20
resource list. See example 10 here:
http://www.ncl.ucar.edu/Applications/coneff.shtml#ex10
Note the following resources used to shade:

  res@cnMonoFillColor = True ; default color is fground [black]
  res@cnMonoFillPattern = False ; want multiple patterns
  res@cnMonoFillScale = False ; want patterns w/ diff densities
  res@cnFillPatterns = (/ 3, 3, 3 \ ; 3=slant lines
                           ,-1 ,-1 ,-1 \ ; -1=transparent
                           , 17, 17, 17, 17, 17/) ; stipling
  res@cnFillScales = (/0.3,0.45,0.6 \ ; line density
                           , 1., 1., 1. \ ; default [no op]
                           ,0.7,0.6,0.5,0.40,0.3/) ; stiple density

and further note that the contour levels are being chosen as well:

  res@cnLevelSelectionMode = "ManualLevels" ; manually specify contour levels
  res@cnMinLevelValF = -4. ; min level
  res@cnMaxLevelValF = 5. ; max level
  res@cnLevelSpacingF = 1. ; contour interval

By choosing the contour levels one knows how many
cnFillPatterns/cnFillScales to set.

With regards to your question about how can one dot be plotted per grid
box, that cannot be forced using any of the NCL resources. You can
change the spacing of the stippling (dots) using cnFillScales as the
above coding snippet does, however. If you want 1 dot per grid box, then
it is likely best to use gsn_add_polymarker to draw a dot in each grid box.

For example:
; (untested!)
t&lat = where(t.lt..9,-999,t&lat) ; set coordinates to -999 (=not in
-90:90 range) when t is less than .9
t&lon = where(t.lt..9,-999,t&lon) ; set coordinates to -999 (=not in
0:360 range) when t is less than .9

polyres = True
polyres@gsMarkerIndex = 17 ; polymarker style
polyres@gsMarkerSizeF = 1. ; polymarker size

_plot = gsn_csm_contour_map_ce(wks,ts,res)_
dum1 = gsn_add_polymarker(wks,plot,t&lon,t&lat,polyres)
draw(plot)
frame(wks)

Make sure the above coding does what you expect, as it is untested. See
example #3 here for an example of using gsn_add_polymarker:
http://www.ncl.ucar.edu/Applications/polyg.shtml#ex3

If the above does not answer your question, please respond to the
ncl-talk email list.
Adam

On 07/08/2013 07:56 AM, tzp2005011042 wrote:
> Hi,
> I have plotted a shaded figure with the setting of
> res@cnFillMode <mailto:res@cnFillMode> = "RasterFill"
> _plot = gsn_csm_contour_map_ce(wks,ts,res)_
> Then I want to overlay a figure with the t value larger than 0.9 using
> the fill pattern of 17 (dotted):
> plot2 = gsn_csm_contour(wks,gsn_add_cyclic_point(t,res20)
> plot2 = ShadeGtContour(plot2,0.9,17)
> overlay(plot,plot2)
> ?How can the dotted area on plot2 be drawn out also with "RasterFill"
> type, or how can the value larger than 0.9 be filled with only one dot
> in one grid box?
> Thank you! And looking forward to your kind reply!
> Nancy
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
______________________________________________________________
Adam Phillips                                asphilli@ucar.edu
NCAR/Climate and Global Dynamics Division       (303) 497-1726
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jul 8 09:06:03 2013

This archive was generated by hypermail 2.1.8 : Fri Jul 12 2013 - 16:37:39 MDT