;************************************************* ; ce_3.ncl ; ; Concepts illustrated: ; - Drawing color-filled contours over a cylindrical equidistant map ; - Selecting a different color map ; - Changing the contour level spacing ; - Turning off contour lines ; - Comparing styles of map tickmarks labels ; - Changing the stride of the labelbar labels ; - Zooming in on a particular area on the map ; - Turning off the addition of a longitude cyclic point ; ;************************************************ ; ; 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" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" ;************************************************ begin ;************************************************ ; open file and read in data ;************************************************ fname = "may.txt" n_col = numAsciiCol(fname) n_var = n_col n_pt = numAsciiRow(fname) ; mydata = asciiread(fname,(/n_pt,n_var/),"float") ;other way of reading mydata=readAsciiTable("may.txt",5,"float",0) longitude = mydata(:,2) latitude = mydata(:,1) variable = mydata(:,3) ;************************************************ ; create plot ;************************************************ ; wks = gsn_open_wks("png" ,"ce") ; send graphics to PNG file wks = gsn_open_wks("x11","ce") res = True ; plot mods desired res@gsnMaximize = True ; Make plot fit the frame res@cnFillOn = True ; turn on color fill res@cnLinesOn = False ; turn of contour lines res@cnLevelSpacingF = 0.5 ; contour spacing res@cnFillPalette = "BlAqGrYeOrRe" res@lbOrientation = "Vertical" res@gsnAddCyclic = False ; data already has cyclic point ; this must also be set for any zoom ; ; Note that the gsn_csm_*map* templates automatically set ; res@mpLimitMode="LatLon" for you. If you are plotting a ; different projection, you may have to set this resource. ; res@mpMinLatF = -30 ; range to zoom in on res@mpMaxLatF = 30. res@mpMinLonF = -70. res@mpMaxLonF = 100. res@mpCenterLonF = 60. res@tiMainString = "Default map tickmark labels" ; plot = gsn_csm_contour_map(wks,variable(0,0,{-30:30},{-70:100}), res) res@tiMainString = "pmTickMarkDisplayMode = 'Always'" res@pmTickMarkDisplayMode = "Always"; use NCL default lat/lon labels res@pmTitleZone = 4 ; plot = gsn_csm_contour_map(wks,variable(0,0,{-30:30},{-70:100}), res) contour = gsn_csm_contour_map(wks,variable,res) end