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 ;*******1. read in the ascii data********* nrow=37 ncol=47 Ts=asciiread("Ts_matrix.txt",(/nrow,ncol/),"integer") ;******1.1 exame the readin data ********** ts_line=new(nrow,string) do i=0,nrow-1 ts_line(i)=str_concat(sprinti ("%1i,", Ts(i,:))) end do asciiwrite("ts_line.txt",ts_line) ;******2. give the cordination************ lat =fspan(28.875,37.875,37) lat!0 ="lat" lat&lat =lat lat@units = "degrees_north" lat@long_name = "Latitude" lon=fspan(110.875,122.375,47) lon!0 ="lon" lon&lon =lon lon@units ="degrees_east" lon@long_name ="Longtitude" Ts!0 ="lat" Ts&lat =lat Ts!1 ="lon" Ts&lon =lon ;******3.plot the data********************* wks= gsn_open_wks("png","Ts_results") res = True res@gsnAddCyclic = False res@gsnMaximize = False ;res@gsnFrame = False res@mpMaxLatF = max(lat) res@mpMinLatF = min(lat) res@mpMinLonF = min(lon) res@mpMaxLonF = max(lon) res@mpFillOn =True res@mpLandFillColor ="gray" res@mpOceanFillColor ="SkyBlue" res@mpInlandWaterFillColor ="blue" res@mpOutlineOn =True res@mpOutlineBoundarySets ="Geophysical" res@mpDataBaseVersion="MediumRes" res@mpDataSetName="Earth..4" res@mpOutlineSpecifiers = "China:states" ;set cn res@cnFillOn =True res@cnFillMode ="RasterFill" res@cnLevelSelectionMode ="ExplicitLevels" res@cnLevels =(/0.5,1.5,2.5,3.5/); Use a value that's between the two values in the data. data includs (0,1,2,3,4,) res@cnFillColors =(/"white","green","brown1","magenta1","grey"/) res@cnLinesOn =False ;set the label ;res@lbLabelPosition ="center" res@lbLabelAlignment ="InteriorEdges" ; res@lbLabelStrings =(/"A","B","C","D"/) res@lbLabelFont =25 ; times-roman res@lbLabelFontHeightF =0.01 ; height in NDC res@lbFillColors =(/"white","green","brown1","magenta1","grey"/) res@lbBoxLinesOn = False res@pmLabelBarWidthF =0.3 res@pmLabelBarHeightF =0.1 ;simply set the tick mark res@pmTickMarkDisplayMode = "Always" ;set the grid line ;using the tm setting the grid line,it is in line with the tick mark.suggested res@tmXMajorGrid =True res@tmXMajorGridLineDashPattern =11 res@tmXMajorGridLineColor ="grey" res@tmXMajorGridThicknessF =1.0 ; 1.0 is the default res@tmYMajorGrid =True res@tmYMajorGridLineDashPattern =11 res@tmYMajorGridLineColor ="grey" res@tmYMajorGridThicknessF =1.0 ; 1.0 is default ; set the title res@tiMainString ="Ts evaluation" res@tiMainFontHeightF =0.015 res@tiMainOffsetYF =0.01 res@tiMainPosition ="Center" plot=gsn_csm_contour_map(wks,Ts,res) ;set for the blank and table resb = True resb@gsnDraw = False resb@gsnFrame = False resb@vpYF = 0.20 resb@vpXF = 0.10 resb@vpHeightF = 0.10 resb@vpWidthF = 0.5 ; Explicitly label X axis. The blank plot goes from 0 to 1, by default. resb@tmXBMode = "Explicit" resb@tmXBValues = (/0,0.2,0.4,0.6,0.8,1/) resb@tmXBOn = True ; to draw the x major gird line resb@tmXBMajorLengthF = 0 resb@tmXMajorGrid =True resb@tmXMajorGridLineColor ="black" resb@tmXMajorGridThicknessF =1.0 ; Explicitly label Y axis. resb@tmYLMode = "Explicit" resb@tmYLValues = (/0,0.5,1/) resb@tmXBOn = True resb@tmXBMajorLengthF = 0 resb@tmYMajorGrid =True resb@tmXMajorGridLineColor ="black" resb@tmXMajorGridThicknessF =1.0 ; Turn off right and top tickmarks resb@tmYROn = False resb@tmXTOn = False blank = gsn_csm_blank_plot(wks,resb) ;set the table ncr =(/2,5/) x =(/0.1,0.6/) y =(/0.1,0.2/) text =(/ (/"BIAS","FAR","POD","POFD","HSS"/),\ (/"0","0","0","0","0"/)/) restbl =True restbl@txFontHeightF =0.03 restbl@gsFillColor ="transparent" gsn_table(wks,ncr,x,y,text,restbl) frame(wks) ;****************************************** end