> I want to draw filled contours over a filled map. I want to fill only a few
> of the contours, so that the filled background map shows through. When I try
> this with gsn_contour_map, all I get is a filled map, with the contours
> presumably buried beneath. Can someone tell me how to bring the filled
> contours up using the gsn routines? Note that I do not want to do any sort
> of land/ocean masking. Thank you.
> Richard Carpenter
By default, if you call gsn_contour_map and turn on fill for both maps
(mpFillOn = True) and contours (cnFillOn = True), the map fill should
be done first, *then* the contour fill. Therefore, it should
be the map fill that is hidden. It is possible to change this
behavior as Sylvia pointed out by using the DrawOrder resources,
like "mpFillDrawOrder" and "cnFillDrawOrder".
However, in this case, if all you want to do is fill a few of the
contours and have the fill map show beneath the non-filled ones, then
you can set the "cnFillColors" array, and use a value of "-1" for
those contours that you don't want filled (-1 means "transparent").
Below is an example that doesn't create a pretty plot, but it shows
how to make some of the contour levels transparent.
cdf_file = addfile("$NCARG_ROOT/lib/ncarg/data/cdf/941110_P.cdf","r")
psl = cdf_file->Psl ; Pull a variable off the file.
wks = gsn_open_wks("x11","gsun05n")
res = True
res@gsnMaximize = True ; Maximize plot in the window.
res@sfXArray = psl&lon ; Set some coordinate arrays.
res@sfYArray = psl&lat
; Turn on map and contour fill, and define colors for land, ocean,
; and inland water.
res@cnFillOn = True
res@mpFillOn = True
res@mpFillColors = (/"background","transparent","LightGray",\
; Define our own contour levels, and then indicate which ones
; should be filled transparent (-1) and with color.
res@cnLevelSelectionMode = "ExplicitLevels"
res@cnLevels = (/950,960,970,980,990,1000,1010,1020,1030,1040/)
res@cnFillColors = (/ -1, -1, 2, 20, 38, 56, 74, 92, -1, -1/)
map = gsn_contour_map(wks,psl,res)
ncl-talk mailing list
ncl-talk AT ucar.edu
This archive was generated by hypermail 2b29 : Tue Oct 01 2002 - 08:30:56 MDT