- 积分
- 194
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-6-20
- 最后登录
- 1970-1-1
|
发表于 2013-4-8 14:38:15
|
显示全部楼层
尽头的尽头 发表于 2013-4-8 11:04
直接运行sh.function.ncl肯定不行,你把你的代码贴上来吧,我看看
好的,谢谢!我的代码里本来也有底图的,但我想换成你们这个,请看下代码,非常感谢!
; Load NCL scripts
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
;/'CDD','CSDI','CWD','FD','GSL','ID','SU'/
;/'PRCPTOT','R10mm','R20mm','R95p','R99p','Rnnmm','SDII','TR','WSDI'/
;/'TNn','TNx','TXn','TXx',,'DTR','RX1day','RX5day'/
;/'TN10p','TN50p','TN90p','TX10p','TX50p','TX90p'/
;*********************************read data*****************************************************
wks = gsn_open_wks("eps","E:/NCL/djf/DTR") ; open a ps file
c=asciiread("E:/NCL/djf/DTR.txt",(/2129,4/),"float")
;************************************************************************************************************
res = True ; plot mods desired
res@gsnDraw = False ; don't draw
res@gsnFrame = False ; don't advance frame
res@mpFillOn = False ; turn off gray continents
res@mpCenterLonF =100.0 ;center lon 180.0
res@mpMinLatF = 15
res@mpMaxLatF = 60
res@mpMinLonF = 70
res@mpMaxLonF = 140
;res@mpOutlineBoundarySets = "National" ; plot borders of the nations
res@tmXBMode = "Explicit"
res@tmYLMode = "Explicit"
res@tmXBLabelFontHeightF = 0.018
res@tmYLLabelFontHeightF = 0.018
res@tmYLValues = (/"20","30","40","50","60"/)
res@tmYLLabels = (/"20","30","40","50","60~S~o~N~N"/)
res@tmXBValues = (/"70","80","90","100","110","120","130","140"/)
res@tmXBLabels = (/"70","80","90","100","110","120","130","140~S~o~N~E"/)
res@tmXTOn = False
res@tmYROn = False
res@tmXBMinorOn = False
res@tmYLMinorOn = False
res@mpDataSetName = "Earth..4"
res@mpDataBaseVersion = "MediumRes" ; Medium resolution database
res@mpOutlineSpecifiers = (/"China:states"/)
map = gsn_csm_map_ce(wks,res)
;************************************plot cyclone track in mam*****************
lat=c(:,1)
lon=c(:,2)
pre=c(:,3)
lat@_FillValue=-99.9
lon@_FillValue=-99.9
gsres = True
gsres@gsMarkerIndex = 1
do i=0,2128
if(pre(i).le.-12.0)then
gsres@gsMarkerSizeF = 0.04
gsres@gsMarkerColor = "Blue"
end if
if(pre(i).gt.-12.0.and.pre(i).le.-9.0)then
gsres@gsMarkerSizeF = 0.035
gsres@gsMarkerColor = "Blue"
end if
if(pre(i).gt.-9.0.and.pre(i).le.-6.0)then
gsres@gsMarkerSizeF = 0.03
gsres@gsMarkerColor = "Blue"
end if
if(pre(i).gt.-6.0.and.pre(i).le.-3.0)then
gsres@gsMarkerSizeF = 0.025
gsres@gsMarkerColor = "Blue"
end if
if(pre(i).gt.-3.0.and.pre(i).le.0.0)then
gsres@gsMarkerSizeF = 0.02
gsres@gsMarkerColor = "Blue"
end if
if(pre(i).gt.0.0.and.pre(i).le.3.0)then
gsres@gsMarkerSizeF = 0.02
gsres@gsMarkerColor = "Red"
end if
if(pre(i).gt.3.0.and.pre(i).le.6.0)then
gsres@gsMarkerSizeF = 0.025
gsres@gsMarkerColor = "Red"
end if
if(pre(i).gt.6.0.and.pre(i).le.9.0)then
gsres@gsMarkerSizeF = 0.03
gsres@gsMarkerColor = "Red"
end if
if(pre(i).gt.9.0.and.pre(i).le.12.0)then
gsres@gsMarkerSizeF = 0.035
gsres@gsMarkerColor = "Red"
end if
if(pre(i).ge.12.0)then
gsres@gsMarkerSizeF = 0.04
gsres@gsMarkerColor = "Red"
end if
gsn_polymarker(wks,map,lon(i),lat(i),gsres)
end do
delete(lon)
delete(lat)
delete(pre)
;*********************draw changjinag huanghe***********************************************
river1=asciiread("E:\NCL\river1.data",(/87,2/),"float")
river2=asciiread("E:\NCL\river2.data",(/89,2/),"float")
x1=river1(:,0:0)
y1=river1(:,1:1)
x2=river2(:,0:0)
y2=river2(:,1:1)
xx1=x1(:,0)
yy1=y1(:,0)
xx2=x2(:,0)
yy2=y2(:,0)
rres = True ; polyline resources
rres@gsLineThicknessF = 2.0 ; line thickness
rres@gsLineColor = "Black" ; line color for this traj
gsn_polyline(wks,map,xx1(:),yy1(:),rres) ; draw polymarkers
gsn_polyline(wks,map,xx2(:),yy2(:),rres) ; draw polymarkers
;***************************add marker and text for the legend***********************************
labels = new(10,string) ; Labels for legend.
xleg = (/0.30,0.35,0.40,0.45,0.50,0.55,0.60,0.65,0.70,0.75/)
yleg = (/0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20/)
xtxt = (/0.325,0.375,0.425,0.475,0.525,0.575,0.625,0.675,0.725/)
ytxt = (/0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18/)
txres = True
txres@txFontHeightF = 0.015
gsres = True
gsres@gsMarkerIndex = 1 ; Use filled dots for markers.
arr = (/-12.,-9.,-6.,-3.,0.,3.,6.,9.,12./)
do k=0,8
labels(k)= arr(k)
end do
do k=0,4
gsres@gsMarkerColor = "Blue"
gsres@gsMarkerSizeF = 0.04-k*0.005
gsn_polymarker_ndc(wks,xleg(k),yleg(k),gsres)
end do
do k=0,4
gsres@gsMarkerColor = "Blue"
gsn_text_ndc (wks,labels(k),xtxt(k),ytxt(k),txres)
end do
do k=5,9
gsres@gsMarkerColor = "Red"
gsres@gsMarkerSizeF = 0.02+(k-5)*0.005
gsn_polymarker_ndc(wks,xleg(k),yleg(k),gsres)
end do
do k=5,8
gsres@gsMarkerColor = "Red"
gsn_text_ndc (wks,labels(k),xtxt(k),ytxt(k),txres)
end do
draw(map)
frame(wks)
end
|
|