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("pdf","Ts_results") ;colors =(/"grey","green","brown1","magenta1","white"/) ;gsn_define_colormap(wks,colors) ;gsn_define_colormap(wks,"gui_default") res = True res@gsnAddCyclic = False res@gsnMaximize = False ;True res@mpMaxLatF = max(lat) ; Set accordingly 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" ;label the position of the charater in the center of the box res@lbLabelAlignment ="InteriorEdges" ; "BoxCenters",the alignment way of the charaters res@lbLabelStrings =(/"A","B","C","D"/) ; 可以改变label的标注 res@lbLabelFont =25 ; times-roman res@lbLabelFontHeightF =0.01 ; height in NDC res@lbFillColors =(/"white","green","brown1","magenta1","grey"/); set as white than 0 can't been seen res@lbBoxLinesOn = False res@pmLabelBarWidthF =0.3 ; in NDC units, depending on the setting of certain resources belonging to the LabelBar res@pmLabelBarHeightF =0.1 ; the same with the pmLabelBarWidthF ;simply set the tick mark res@pmTickMarkDisplayMode = "Always" ;设为Always时可以生成较好的Tick Mark,不用单独设置XB,YL具体属性 ;且可以自动标注经纬度,如要设置XT,YR,就用tm属性 ;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@tiMainFont = ; when the filled font(21-22,25-26,29-30,33-37) is set, the fontThicknessF is ignored ;res@tiMainFontThicknessF =0.2 res@tiMainPosition ="Center" ; Left Right plot=gsn_csm_contour_map(wks,Ts,res) ;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