- 积分
- 15726
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-3-8
- 最后登录
- 1970-1-1
|
发表于 2016-3-7 10:42:28
|
显示全部楼层
我查了坑定是有的,可以麻烦帮我看下脚本吗?虽然脚本很长但其实方法很简单,就是对原来的数据处理完之后,提取我要的那些年份画图。
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/csm/shea_util.ncl"
begin
min_lat = -20.0
max_lat = 40.0
min_lon =40.0
max_lon = 180.0
yrStrt = 1871
yrLast = 2000
season = "MAM" ; choose chun seasonal
f=addfile("./sst.mnmean.v4.nc","r")
TIME = f->time
YYYY = cd_calendar(TIME,-1)/100 ; entire file
iYYYY = ind(YYYY.ge.yrStrt .and. YYYY.le.yrLast)
sst = short2flt(f->sst)
st=sst(iYYYY,:,:)
printVarSummary(st)
lat=f->lat
lon=f->lon
s1=month_to_season(st,"MAM" )
;nyrs = dimsizes(lh&time)
printVarSummary(s1)
s=dtrend_leftdim(s1,False)
copy_VarMeta(s1,s)
b = addfile("F:/cygwin/app/ncl/lib/ncarg/data/cdf/landsea.nc","r") ; read in land sea mask basemap file
lsm_s = landsea_mask(b->LSMASK,s&lat,s&lon) ; read in land sea mask, and pass it and
; the t85 lat/lon arrays into landsea_mask
s = mask(s,lsm_s.eq.0,True) ; mask out all ocean points from t85
printVarSummary(s)
srun=runave_Wrap(s(lat|:, lon|:, time|:),11,0)
printVarSummary(srun)
;xLand = s ; 3D
;xLand = mask (s, conform(s, oro, (/1,2/)), 1)
;sd=dtrend(srun,False)
;copy_VarMeta(srun,sd)
;vrAvgTime=dim_avg_n_Wrap(s,0)
;printVarSummary(vrAvgTime)
;s=s1(lat|:, lon|:, time|:)-sd
;copy_VarMeta(sd,s)
;printVarSummary(s)
;saon=(s(8,:,:)+s(11,:,:)+s(16,:,:)+s(19,:,:)+s(27,:,:)+s(30,:,:)+s(33,:,:)+s(36,:,:)+s(42,:,:)+s(45,:,:)+s(49,:,:)+s(56,:,:)+s(61,:,:)+s(72,:,:)+s(82,:,:)+s(84,:,:)+s(88,:,:)+s(94,:,:)+s(96,:,:)+s(100,:,:)+s(103,:,:)+s(107,:,:)+s(108,:,:)+s(110,:,:)+s(113,:,:)+s(118,:,:)+s(122,:,:)+s(125,:,:)+s(128,:,:))/29-sAvgTime
vraon1=s(time|8,lat|:,lon|:)-srun(time|8,lat|:,lon|:)
copy_VarMeta(srun,vraon1)
;printVarSummary(vraon1)
vraon2=s(time|11,lat|:,lon|:)-srun(time|11,lat|:,lon|:)
copy_VarMeta(srun,vraon2)
;printVarSummary(vraon2)
vraon3=s(time|16,lat|:,lon|:)-srun(time|16,lat|:,lon|:)
copy_VarMeta(srun,vraon3)
vraon4=s(time|19,lat|:,lon|:)-srun(time|19,lat|:,lon|:)
copy_VarMeta(srun,vraon4)
vraon5=s(time|27,lat|:,lon|:)-srun(time|27,lat|:,lon|:)
copy_VarMeta(srun,vraon5)
vraon6=s(time|30,lat|:,lon|:)-srun(time|30,lat|:,lon|:)
copy_VarMeta(srun,vraon6)
vraon7=s(time|33,lat|:,lon|:)-srun(time|33,lat|:,lon|:)
copy_VarMeta(srun,vraon7)
vraon8=s(time|36,lat|:,lon|:)-srun(time|36,lat|:,lon|:)
copy_VarMeta(srun,vraon8)
vraon9=s(time|42,lat|:,lon|:)-srun(time|42,lat|:,lon|:)
copy_VarMeta(srun,vraon9)
vraon10=s(time|45,lat|:,lon|:)-srun(time|45,lat|:,lon|:)
copy_VarMeta(srun,vraon10)
vraon11=s(time|49,lat|:,lon|:)-srun(time|49,lat|:,lon|:)
copy_VarMeta(srun,vraon11)
vraon12=s(time|56,lat|:,lon|:)-srun(time|56,lat|:,lon|:)
copy_VarMeta(srun,vraon12)
vraon13=s(time|61,lat|:,lon|:)-srun(time|61,lat|:,lon|:)
copy_VarMeta(srun,vraon13)
vraon14=s(time|72,lat|:,lon|:)-srun(time|72,lat|:,lon|:)
copy_VarMeta(srun,vraon14)
vraon15=s(time|82,lat|:,lon|:)-srun(time|82,lat|:,lon|:)
copy_VarMeta(srun,vraon15)
vraon16=s(time|84,lat|:,lon|:)-srun(time|84,lat|:,lon|:)
copy_VarMeta(srun,vraon16)
vraon17=s(time|88,lat|:,lon|:)-srun(time|88,lat|:,lon|:)
copy_VarMeta(srun,vraon17)
vraon18=s(time|94,lat|:,lon|:)-srun(time|94,lat|:,lon|:)
copy_VarMeta(srun,vraon18)
vraon19=s(time|96,lat|:,lon|:)-srun(time|96,lat|:,lon|:)
copy_VarMeta(srun,vraon19)
vraon20=s(time|100,lat|:,lon|:)-srun(time|100,lat|:,lon|:)
copy_VarMeta(srun,vraon20)
vraon21=s(time|103,lat|:,lon|:)-srun(time|103,lat|:,lon|:)
copy_VarMeta(srun,vraon21)
vraon22=s(time|107,lat|:,lon|:)-srun(time|107,lat|:,lon|:)
copy_VarMeta(srun,vraon22)
vraon23=s(time|108,lat|:,lon|:)-srun(time|108,lat|:,lon|:)
copy_VarMeta(srun,vraon23)
vraon24=s(time|110,lat|:,lon|:)-srun(time|110,lat|:,lon|:)
copy_VarMeta(srun,vraon24)
vraon25=s(time|113,lat|:,lon|:)-srun(time|113,lat|:,lon|:)
copy_VarMeta(srun,vraon25)
vraon26=s(time|118,lat|:,lon|:)-srun(time|118,lat|:,lon|:)
copy_VarMeta(srun,vraon26)
vraon27=s(time|122,lat|:,lon|:)-srun(time|122,lat|:,lon|:)
copy_VarMeta(srun,vraon27)
vraon28=s(time|125,lat|:,lon|:)-srun(time|125,lat|:,lon|:)
copy_VarMeta(srun,vraon28)
vraon29=s(time|128,lat|:,lon|:)-srun(time|128,lat|:,lon|:)
copy_VarMeta(srun,vraon29)
;copy_VarMeta(srun,vraon1)
;printVarSummary(l)
;temp&lon@units = "degrees_east" ; 加上单位
;temp&lat@units = "degrees_north"
;temp = temp - 273.15 ; Convert Kelvin -> Celsius
;pres = pres * 0.01
;temp@units = "(C)" ; Change units to reflect
;pres@units = "(mb)"
wks = gsn_open_wks("ps","sst291")
gsn_define_colormap(wks,"rainbow")
res=True
res@gsnDraw = False
res@gsnFrame=False
;res@gsnAddCyclic = False
;res@cnLevelSelectionMode = "ManualLevels"
;res@cnMinLevelValF = 195 ; 最小值
;res@cnMaxLevelValF = 328 ; 最大值
;res@cnLevelSpacingF = 2.25 ; 间距
res@mpFillOn = False ; Turn off map fill.
res@mpCenterLonF = 180.0
res@mpMinLatF = min_lat
res@mpMaxLatF = max_lat
res@mpMinLonF = min_lon
res@mpMaxLonF = max_lon
;res@mpPerimDrawOrder = "PostDraw"
res@mpOutlineSpecifiers = (/"land"/)
res@mpAreaMaskingOn = True ;使能填充覆盖
res@mpMaskAreaSpecifiers = (/"land"/) ;China:states
res@mpOceanFillColor = 0 ;用白色填充海洋 0是colormap的索引值
res@mpInlandWaterFillColor = 0 ;用白色填充内陆湖水
res@gsnLeftString="MAMSSTA"
res@cnFillPalette = "BlueYellowRed"
;res@gsnContourZeroLineThicknessF = 3
res@cnLinesOn = False ; 关闭等值线线条
res@lbBoxLinesOn = False ; 关闭lbar box 线条
res@lbLabelBarOn = False
res@cnLevelSelectionMode = "ManualLevels"
res@cnMinLevelValF = -0.6
res@cnMaxLevelValF = 0.6
res@cnLevelSpacingF = 0.2
res@cnFillOn = True
; res@cnFillDrawOrder = "Predraw"
;res@tiMainString = "temperature" ; Title for the XY plot
; res@tiXAxisString = "lon" ; Label for the X axis
;res@tiYAxisString = "lat" ; Label for the Y axis
plot = new(29,graphic)
plot(0) = gsn_csm_contour_map(wks,vraon1,res)
plot(1) = gsn_csm_contour_map(wks,vraon2,res)
plot(2) = gsn_csm_contour_map(wks,vraon3,res)
plot(3) = gsn_csm_contour_map(wks,vraon4,res)
plot(4) = gsn_csm_contour_map(wks,vraon5,res)
plot(5) = gsn_csm_contour_map(wks,vraon6,res)
plot(6) = gsn_csm_contour_map(wks,vraon7,res)
plot(7) = gsn_csm_contour_map(wks,vraon8,res)
plot(8) = gsn_csm_contour_map(wks,vraon9,res)
plot(9) = gsn_csm_contour_map(wks,vraon10,res)
plot(10) = gsn_csm_contour_map(wks,vraon11,res)
plot(11) = gsn_csm_contour_map(wks,vraon12,res)
plot(12) = gsn_csm_contour_map(wks,vraon13,res)
plot(13) = gsn_csm_contour_map(wks,vraon14,res)
plot(14) = gsn_csm_contour_map(wks,vraon15,res)
plot(15) = gsn_csm_contour_map(wks,vraon16,res)
plot(16) = gsn_csm_contour_map(wks,vraon17,res)
plot(17) = gsn_csm_contour_map(wks,vraon18,res)
plot(18) = gsn_csm_contour_map(wks,vraon19,res)
plot(19) = gsn_csm_contour_map(wks,vraon20,res)
plot(20) = gsn_csm_contour_map(wks,vraon21,res)
plot(21) = gsn_csm_contour_map(wks,vraon22,res)
plot(22) = gsn_csm_contour_map(wks,vraon23,res)
plot(23) = gsn_csm_contour_map(wks,vraon24,res)
plot(24) = gsn_csm_contour_map(wks,vraon25,res)
plot(25) = gsn_csm_contour_map(wks,vraon26,res)
plot(26) = gsn_csm_contour_map(wks,vraon27,res)
plot(27) = gsn_csm_contour_map(wks,vraon28,res)
plot(28) = gsn_csm_contour_map(wks,vraon29,res)
pres = True
pres@gsnPanelRowSpec = True ;tell panel what order to plt
pres@gsnPanelLabelBar = True
pres@lbBoxLinesOn = False
pres@lbOrientation= "Vertical";
;pres@txString = "A common title"
;pres@gsnPanelFigureStrings= (/"(a)","(b)","(c)","(d)","(e)"/) ; add strings to panel
gsn_panel(wks,plot,(/5,5,5,5,5,4/),pres)
;pres = False
;gsn_panel(wks,plot,(/2,2/),pres)
;draw(wks)
frame(wks)
;plot = gsn_csm_contour_map(wks,saon,res)
end
|
|