;************************************************* ; mask_8.ncl ; ; Concepts illustrated: ; - Drawing the counties of Wisconsin ; - Masking out particular areas in a map ; - Using draw order resources to make sure filled map areas are drawn last ; - Explicitly setting the areas in a map to fill ; - Explicitly setting contour levels ; - Explicitly setting the fill colors for land, ocean, and inland water ; - Turning off tickmarks on the right and top axes ; - Turning off the addition of a longitude cyclic point ; - Increasing the thickness of map outlines ; ; This script was contributed by Dr. Michael Notaro, a scientist at the ; Center for Climatic Research, University of Wisconsin-Madison. ; ;************************************************* load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" begin a = addfile("data_wi.nc","r") var = a->var lat = var&lat lon = var&lon wks = gsn_open_wks ("ps", "mask") gsn_define_colormap(wks, "rainbow+white") ; Set up resource list for plot options. res = True res@gsnAddCyclic = False res@gsnMaximize = True res@cnLevelSelectionMode = "ExplicitLevels" res@cnLevels = (/4.4, 4.55, 4.7, 4.85, 5.0, 5.15, 5.3/) res@cnLinesOn = False ; Turn off contour lines res@cnFillOn = True ; Turn on contour fill res@cnFillColors = (/44,78,100,130,176,188,203,237/) res@cnFillDrawOrder = "PreDraw" ; Make sure map fill happens ; last. res@lbOrientation = "vertical" ; default is horizontal res@mpDataBaseVersion = "Ncarg4_1" res@mpDataSetName = "Earth..2" ; For counties ; Zoom in on Wisconsin, United States res@mpMaxLatF = max(lat) res@mpMaxLonF = max(lon) res@mpMinLatF = min(lat) res@mpMinLonF = min(lon) res@mpCenterLonF = avg(lon) ; ; Specify which areas to fill, and what to fill them with. This allows ; us to make sure Wisconsin is not filled (transparent). ; res@mpFillAreaSpecifiers = (/"Land", "Wisconsin:counties","Water"/) res@mpSpecifiedFillColors = (/"white","transparent", "white"/) res@mpInlandWaterFillColor = 238 res@mpLandFillColor = -1 ; transparent res@mpOutlineOn = True res@mpUSStateLineThicknessF = 2.5 ; 2-1/2 times as thick. res@mpGeophysicalLineThicknessF = 2.5 res@mpOutlineBoundarySets = "GeophysicalAndUSStates" res@mpOutlineSpecifiers = (/"Land","Wisconsin:counties"/) res@mpMaskOutlineSpecifiers = (/"water"/) res@tiMainString = "Change in Temperature" res@tiMainFontHeightF = 0.035 res@tmXTOn = False ; Turn off top and right res@tmYROn = False ; tickmarks. plot = gsn_csm_contour_map_ce(wks,var, res) end