; Ryan Pavlick: 14 Oct ; Is there a way to create a blank map with gsn_csm_map_ce and have a ; different land fill color between two latitudes? ; ; The end result would be a map of the earth where all of the land between ; 50S and 50N was red, and the land above/below 50 degrees is grey. ;================================================== 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/contributed.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl" a = addfile("$NCARG_ROOT/lib/ncarg/data/cdf/landsea.nc","r") lsm_byte = a->LSMASK printVarSummary(lsm_byte) printMinMax(lsm_byte,1) lsm = toint(lsm_byte) copy_VarCoords(lsm_byte, lsm) lsm@_FillValue = -999 ; add _FillValue for later use printVarSummary(lsm) printMinMax(lsm,1) print("==================") delete(lsm_byte) dimlsm = dimsizes(lsm) lat2d = conform_dims(dimlsm, lsm&lat, 0) lon2d = conform_dims(dimlsm, lsm&lon, 1) latS = -50.0 latN = 50.0 land = lsm land = (/ where ((lat2d.ge.latS .and. lat2d.le.latN .and. \ lsm.eq.1), 0 , lsm@_FillValue) /) land = where (((lat2d.lt.latS .or. lat2d.gt.latN) .and. \ lsm.eq.1), 1, land) printVarSummary(land) printMinMax(land,1) print("==================") ;.............................................. wks = gsn_open_wks("x11","pavlick") res = True res@gsnMaximize = True res@mpFillOn = False ; do not color-fill the map res@cnFillOn = True ; turn on color fill res@cnLinesOn = False ; turn off the contour lines res@cnLineLabelsOn = False ; turn off the contour line labels res@cnLevelSelectionMode = "ExplicitLevels" ; explicitly set the levels via cnLevels res@cnFillMode = "RasterFill" ; use raster fill res@cnLevels = (/1./) ; set the levels (1 less than # colors) res@cnFillPalette = (/"red","gray"/) ; distinct colors for categories ncolors = dimsizes(res@cnFillPalette ) nlevels = dimsizes(res@cnLevels) if ((nlevels+1).ne.ncolors) then ; make sure # of colors match categories/classes/levels print("size mismatch: nlevels="+nlevels+" ncolors="+ncolors) exit end if res@gsnCenterString = "NCL land sea mask @1x1 resolution" res@tiMainString = "Pavlick Bands" ; labelbar title plot = gsn_csm_contour_map_ce(wks,land,res)