;***************************************************** ; trimesh_3.ncl ; ; Concepts illustrated: ; - Contouring one-dimensional X, Y, Z data ; - Spanning part of a color map for contour fill ; - Drawing a map using the high resolution map outlines ; - Drawing a variable's lat/lon locations using gsn_coordinates ;***************************************************** ; ; These files are loaded by default in NCL V6.2.0 and newer ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" begin ; ; This data is from the Chesapeake Community Model Program Quoddy ; model: ; ; http://ccmp.chesapeake.org ; ; using the NOAA/NOS standardized hydrodynamic model NetCDF format: ; ; https://sourceforge.net/projects/oceanmodelfiles ; f = addfile("$NCARG_ROOT/lib/ncarg/data/cdf/ctcbay.nc","r") depth = f->depth depth@lat1d = f->lat depth@lon1d = f->lon wks = gsn_open_wks("png","trimesh") cmap = read_colormap_file("rainbow") res = True res@gsnMaximize = True res@gsnDraw = False res@gsnFrame = False res@sfElementNodes = f->ele res@sfFirstNodeIndex = 1 res@cnFillOn = True ; Turn on contour fill. res@cnFillPalette = cmap(13:,:) ; set color map res@cnLinesOn = False ; Turn off contour lines res@lbOrientation = "Vertical" ; Change location of labelbar. res@mpLimitMode = "LatLon" res@mpMinLonF = -77.5 res@mpMaxLonF = -75.5 res@mpMinLatF = 36.6 res@mpMaxLatF = 39.7 res@pmTickMarkDisplayMode = "Always" ; nicer map tickmarks ;---Titles res@tiMainString = "Lat/lon locations drawn w/filled dots" res@tiMainOffsetYF = -0.02 ; Move the title down. res@gsnRightStringOrthogonalPosF = 0.02 ; Move the subtitles down res@gsnLeftStringOrthogonalPosF = 0.02 ; a little bit. ; ; Note: in order to use the high-resolution coastal database ; (mpDataBaseVersion = "HighRes"), you must download and install RANGS ; (Regionally Accessible Nested Global Shorelines), the multi-resolution ; coastline database, developed by Rainer Feistel from Wessel and ; Smith's GSHHS (Global Self-consistent Hierarchical High-resolution ; Shoreline) database. For more information, visit: ; ; http://www.ncl.ucar.edu/Document/Graphics/rangs.shtml ; ; If you don't have this database, or don't want to install it, ; change this resource value to "MediumRes". ; res@mpDataBaseVersion = "HighRes" ; "MediumRes" will run faster. map = gsn_csm_contour_map(wks,depth,res) ; ; Add dots at the lat/lon loccations of the data. ; ; The "depth" variable has lat1d / lon1d attributes attached. ; gsn_coordinates will use these to plot the lat/lon markers. ; mkres = True mkres@gsMarkerSizeF = 2. gsn_coordinates(wks,map,depth,mkres) end