;************************************************ load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" ;************************************************ begin ;************************************************ ; open netCDF file ;************************************************ a = addfile("Aug_35yr.nc","r") ;************************************************ ; Read in variable(s) ;************************************************ var = a->cz(0,:,:) printVarSummary(var) ;************************************************ ; create plot ;************************************************ ;---Fix the fill value var@_FillValue = default_fillvalue(typeof(var)) wks = gsn_open_wks("x11","raster") ; open a ps file gsn_define_colormap(wks, "MPL_RdPu") res = True ; plot mods desired ;=================================== ; you can have the contour lines on in raster mode, but their thickness ; actually make the plot look like is was contoured normally. res@cnFillOn = True ; color Fill res@cnFillMode = "CellFill" ; Raster Mode res@cnLinesOn = False ; Turn off contour lines res@cnCellFillEdgeColor = "black" ;================================ ; these three resources make the continents look nice. The first two ; make them color, and the later adds continental outlines when ; raster mode is used. res@cnLineDrawOrder = "Predraw" ; Draw lines and filled res@cnFillDrawOrder = "Predraw" ; areas before map gets set ;================================= ;res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels ;res@cnMinLevelValF = -2.0 ; set min contour level ;res@cnMaxLevelValF = 0.0 ; set max contour level ;res@cnLevelSpacingF = 0.5 ; set contour spacing res@mpLandFillColor = -1 ; choose color of continents. ; must be in colormap res@cnMissingValFillColor="white" ;;;;;;;;;;;;;;;;;;;;;;;;;; res@gsnAddCyclic = False ;;;;;;;;;;;;;;ZOOM res@mpMinLatF = 0. res@mpMaxLatF = 55. res@mpMinLonF = 80. res@mpMaxLonF = 195. res@mpCenterLonF = 137.5 res@pmTickMarkDisplayMode = "Always" ; 默认是每隔5°出现一次坐标数字 res@gsnLeftString = "" ;=================================== plot = gsn_csm_contour_map(wks,var,res) ; create plot ; ; Create 1D arrays of lat,lon,var values so we can ; put a text string at each value that is not missing. ; lat1d = ndtooned(conform(var,var&lat,0)) lon1d = ndtooned(conform(var,var&lon,1)) var1d = ndtooned(var) ii = ind(.not.ismissing(var1d)) ntext = dimsizes(ii) txres = True txres@txFontHeightF = 0.008 txres@txJust = "CenterCenter" txid = gsn_add_text(wks,plot,""+var1d(ii),lon1d(ii),lat1d(ii),txres) draw(plot) frame(wks) end