load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" begin f = addfile ("ruc2.bgrb.20020418.i12.f00.grb","r") vpt = f->VPTMP_252_HYBL(0,:,:) lat2d = f->gridlat_252 ; 2D latitude grid lon2d = f->gridlon_252 ; 2D longitude grid ; ; Instead of attaching lat2d and lon2d, if we know the exact projection ; that the native data is on, we can draw the data directly on then ; plot. This is faster than using 2D lat/lon coordinates, but you ; have to be *sure* you know the correct map projection and limits. ; ; For more information, see the tfDoNDCOverlay resource below. ; ; vpt@lat2d = lat2d ; Must attach lat2d and ; vpt@lon2d = lon2d ; lon2d as special attributes. wks = gsn_open_wks("ps","contour6f") ; Open "contour6f.ps" PS file. gsn_define_colormap(wks,"gui_default") ; Change color map. res = True ; Plot options desired. res@cnFillOn = True ; Turn on contour fill res@cnLinesOn = False ; Contour lines off res@gsnSpreadColors = True ; Span full color map res@mpLimitMode = "Corners" ; Choose range of map. res@mpLeftCornerLatF = lat2d@corners(0) res@mpLeftCornerLonF = lon2d@corners(0) res@mpRightCornerLatF = lat2d@corners(2) res@mpRightCornerLonF = lon2d@corners(2) res@mpOutlineBoundarySets = "GeophysicalAndUSStates" ; State boundaries res@pmTickMarkDisplayMode = "Always" ; Map tickmarks ; ; Native lambert grids read in from grib files are different than ; those read in from netCDF files. NCL automatically looks for the ; parallel and meridian information on the grib file and attaches ; this information as attributes to the lon2d array. ; res@mpProjection = "LambertConformal" res@mpLambertParallel1F = lon2d@Latin1 res@mpLambertParallel2F = lon2d@Latin2 res@mpLambertMeridianF = lon2d@Lov ; ; When data is overlaid on a map, it is transformed to the specified ; projection. Since this model is already on a native lambert ; conformal grid, and we knew the exact projection, we can turn off the ; transformation by setting res@tfDoNDCOverlay = True ; res@tfDoNDCOverlay = True plot = gsn_csm_contour_map(wks,vpt,res) ; Call gsn_csm function for ; drawings contours over a map. end