- 积分
- 1109
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-3-27
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2016-1-19 14:35:21
|
显示全部楼层
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"
load "$NCARG_ROOT/lib/ncarg/nclscripts/cnmap/cnmap.ncl"
begin
data = asciiread("/home/lhz/sta_final/final_ave.txt",156,"float")
sta = asciiread("/home/lhz/sta_final/station156.txt",(/156,3/),"float")
final_ave = data(:)
lon = sta(:,1)
lat = sta(:,2)
olon = fspan(97,109,52)
olat = fspan(26,35,40)
olon!0 = "lon"
olon@long_name = "lon"
olon@units = "degrees-east"
olon&lon = olon
olat!0 = "lat"
olat@long_name = "lat"
olat@units = "degrees_north"
olat&lat = olat
final_ave@_FillValue = -999.000000
rscan = (/10,7,4,1/)
final = obj_anal_ic_deprecated(lon,lat,final_ave,olon,olat,rscan,False)
wks = gsn_open_wks ("ps","sta_final_ave")
res = True
res@gsnMaximize = True
res@gsnDraw = False
res@gsnFrame = False
res@gsnLeftString = "Annual_Precipitation"
;>--------------------------------------------<
; set for the map
;>--------------------------------------------<
res@mpMinLatF = 26.
res@mpMaxLatF = 35.
res@mpMinLonF = 97.
res@mpMaxLonF = 109.
res@tmXBMode = "Explicit"
res@tmXBValues = (/97,99,101,103,105,107,109/)
res@tmXBLabels = (/"97~S~o~N~E","99~S~o~N~E","101~S~o~N~E","103~S~o~N~E","105~S~o~N~E","107~S~o~N~E","109~S~o~N~E"/)
res@tmXBMinorValues = fspan(97,109,31)
res@tmXBMinorOn = True
res@tmYLMode = "Explicit"
res@tmYLValues = (/26,28,30,32,34,36/)
res@tmYLLabels = (/"26~S~o~N~N","28~S~o~N~N","30~S~o~N~N","32~S~o~N~N","34~S~o~N~N","36~S~o~N~N"/)
res@tmYLMinorValues = fspan(26,36,26)
res@tmYLMinorOn = True
res@mpFillOn = True
res@mpOutlineOn = False
res@cnFillDrawOrder = "PreDraw"
res@mpDataBaseVersion = "MediumRes"
res@mpDataSetName = "Earth..4"
res@mpAreaMaskingOn = True
res@mpMaskAreaSpecifiers = (/"China","Taiwan","Disputed area between India and China","India:Arunachal Pradesh"/)
res@mpLandFillColor = "white"
res@mpInlandWaterFillColor = "white"
res@mpOceanFillColor = "white"
res@mpOutlineBoundarySets = "NoBoundaries"
;>--------------------------------------------<
; set for the plot
;>--------------------------------------------<
res@cnFillOn = True
res@cnLinesOn = False
res@cnLevelSpacingF = 10.0
res@gsnSpreadColors = True
res@lbLabelAutoStride = True
res@gsnAddCyclic = False
map=gsn_csm_contour_map(wks,final,res)
;>------------------------------------------------------------<
; add China map
;>------------------------------------------------------------<
cnres = True
cnres@china = True
cnres@river = False
cnres@province = True
cnres@nanhai = False
cnres@diqu = True
chinamap = add_china_map(wks,map,cnres)
;>------------------------------------------------------------<
station = asciiread("/home/lhz/sta_final/station156.txt",(/156,3/),"float")
res2 = True
res2@gsMarkerIndex = 16
res2@gsMarkerSizeF = 6.
res2@gsMarkerColor = "black"
res2@tfPolyDrawOrder = "PostDraw"
res2@cnFillDrawOrder = "PostDraw"
plots=gsn_add_polymarker(wks,map,station(:,1),station(:,2),res2)
delete(res2)
;>------------------------------------------------------------<
; add SiChuan map
;>------------------------------------------------------------<
filename = "/home/lhz/SHP/shengjie/bou2_4p.shp"
f = addfile(filename, "r")
NAME=(/f->NAME/)
asciiwrite ("/home/lhz/SHP/NAME.txt", NAME)
sichuan=(/NAME(205)/)
geometry = f->geometry
segments = f->segments
geomDims = dimsizes(geometry)
segsDims = dimsizes(segments)
geom_segIndex = f@geom_segIndex
geom_numSegs = f@geom_numSegs
segs_xyzIndex = f@segs_xyzIndex
segs_numPnts = f@segs_numPnts
lines = new(segsDims(0),graphic)
numFeatures = geomDims(0)
dlon = f->x
dlat = f->y
plres = True
plres@gsEdgesOn = True
plres@gsEdgeColor = "black"
plres@cnFillDrawOrder = "PostDraw"
plres@tfPolyDrawOrder = "draw"
segNum = 0
do i=0, numFeatures-1
plres@gsFillColor = "gray"
if( NAME(i).eq.sichuan) then
plres@gsFillColor = "transparent"
end if
startSegment = geometry(i, geom_segIndex)
numSegments = geometry(i, geom_numSegs)
do seg=startSegment, startSegment+numSegments-1
startPT = segments(seg, segs_xyzIndex)
endPT = startPT + segments(seg, segs_numPnts)-1
lines(segNum) = gsn_add_polygon(wks, map, dlon(startPT:endPT), dlat(startPT:endPT), plres)
segNum = segNum + 1
end do
end do
delete(plres)
draw(map)
frame(wks)
end |
|