I'm making cylindrical equidistant maps of sea ice area from some CCSM
ice history files. It all works great until I try to switch the
foreground and background colors such that I have white text on a
black background (request by the end user). However, this messes up
the default masking colors such that I get black ice shelf areas down
off Antarctica. I can see from the examples in "Masking" section on
the web site that there are rather detailed ways of masking/filling
certain subareas, but so far what I've tried has not worked.
Any suggestions would be greatly appreciated!
Thanks,
Mark
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/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
begin
;------------------------------------------------------------------------------------;
; add files
;fList = systemfunc("ls /Volumes/xraid3/endworld/ice/endworld*.nc")
fList = systemfunc("ls /Volumes/xraid3/endworld/ice/endworld3.csim.h.
0011-07.nc")
nFiles = dimsizes(fList)
month = (/
"Jan
","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" /)
imo = 6
iyr = 1
do iFile = 0, nFiles-1
b = addfile(fList(iFile), "r")
data = b->aice
lat2d = b->TLAT
lon2d = b->TLON
data_at_lon2d = lon2d
data_at_lat2d = lat2d
;----------------------------------------------------------------------------------------;
;create plot
;***************************************************************************************
;***************************************************************************************
outfile = "icearea" + sprinti("%0.3i",iFile)
wks = gsn_open_wks("ps",outfile) ; open a postscript file
color_map = (/(/1.00,1.00,1.00/),(/0.00,0.00,0.00/), \
(/0.1411765,0.,0.8470588/), (/
0.09411765,0.1098039,0.9686275/), \
(/0.1568628,0.3411765,1./), (/
0.2392157,0.5294118,1./), \
(/0.3372549,0.6901961,1./),(/
0.4588235,0.827451,1.00/), \
(/0.6,0.9176471,1./), (/0.7372549,0.9764706,1.0/), \
(/0.9176471,1.0,1.0/),(/1.00,1.00,1.00/)/)
gsn_define_colormap(wks,color_map)
i = NhlNewColor(wks,0.8,0.8,0.8) ; add gray to
colormap
;***************************************************************************************
;***************************************************************************************
; resources for all plots
res = True
res_at_gsnDraw = False ; Do not draw plot
res_at_gsnFrame = False ; Do not advance
frame
setvalues wks
"wkBackgroundColor" : (/0.,0.,0./)
"wkForegroundColor" : (/1.,1.,1./)
end setvalues
;*** from mask_4.ncl example, try to explicit set the fill areas we want
;fill_specs = (/"ice_shelf","land"/)
;res_at_mpFillBoundarySets = "NoBoundaries"
;res_at_mpFillAreaSpecifiers = fill_specs
;res_at_mpSpecifiedFillColors = (/12,12/)
res_at_cnFillOn = True ; Fill contours
res_at_cnLinesOn = False
res_at_cnLineLabelsOn = False
; select which colors out of the colormap to use. These are the colors
of
; the contours only. They do not effect the missing value, continental
fill
; color etc. The -1 is no color or "transparent"
res_at_cnFillColors = (/2,3,4,5,6,7,8,9,10,11,12/)
res_at_cnFillDrawOrder = "PreDraw" ; make sure fill map
on top
res_at_cnLevelSelectionMode = "ExplicitLevels" ; set manual contour
levels
res_at_cnLevels = (/0.2, 20., 30., 40., 50., 60., 70.,
80., 90./)
res_at_gsnAddCyclic = True
res_at_mpOutlineOn = False
res_at_gsnRightString = "percent"
res_at_gsnLeftString = month(imo) + " Year " + iyr
res_at_tiMainString = "Sea Ice Area"
res_at_tmXBTickSpacingF = 60. ; every 60 degrees
;***************************************************************************************
plot = gsn_csm_contour_map(wks,data(0,:,:),res)
draw(plot)
frame(wks)
delete(wks)
delete(b)
if (imo .eq. 11) then
imo = 0
iyr = iyr+1
else
imo = imo+1
end if
end do
end
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed May 06 2009 - 15:07:56 MDT
This archive was generated by hypermail 2.2.0 : Wed May 06 2009 - 16:48:59 MDT