- 积分
- 165
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2018-9-13
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
已经定义了变量啊?错误提示确实没有定义。代码附上
$ ncl /cygdrive/d/ncl/script/pr/pr-plot-model-cycle-lat-annual.ncl
Copyright (C) 1995-2017 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 6.4.0
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.
Variable: prtla
Type: float
Total Size: 29760 bytes
7440 values
Number of Dimensions: 2
Dimensions and sizes: [240] x [31]
Coordinates:
Number Of Attributes: 1
_FillValue : 1e+20
fatal:["Execute.c":7776]:pr is undefined, can not subscript an undefined variable
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 72 in file /cygdrive/d/ncl/script/pr/pr-plot-model-cycle-lat-annual.ncl
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"
;..........................................................
;中国大陆范围内的经纬度
;..........................................................
lon1 = 72
lon2 = 136
lat1 = 17
lat2 = 55
;...............................................................
;绘图
;...............................................................
wks = gsn_open_wks("png", "pr-models-lat")
plot = new(16, graphic)
do x = 0,15
modelname =(/"ACCESS1-0","BCC_CSM1-1","BNU-ESM","CanCM4","CanESM2","CCSM4",\
"CESM1-BGC","CESM1-CAM5","CNRM-CM5","CSIRO-Mk360","FGOALS-s2",\
"FIO-ESM","GISS-E2-H","HadCM3","HadGEM2-AO","INMCM4"/)
dir="/cygdrive/e/ncl1/data/pr/pr-historical/"
filename=(/"pr_Amon_ACCESS1-0_historical_r1i1p1_185001-200512.nc",\
"pr_Amon_bcc-csm1-1_historical_r1i1p1_185001-201212.nc",\
"pr_Amon_BNU-ESM_historical_r1i1p1_185001-200512.nc",\
"pr_Amon_CanCM4_historical_r10i1p1_196101-200512.nc",\
"pr_Amon_CanESM2_historical_r1i1p1_185001-200512.nc",\
"pr_Amon_CCSM4_historical_r1i1p1_185001-200512.nc",\
"pr_Amon_CESM1-BGC_historical_r1i1p1_185001-200512.nc",\
"pr_Amon_CESM1-CAM5_historical_r1i1p1_185001-200512.nc",\
"pr_Amon_CNRM-CM5_historical_r1i1p1_195001-200512.nc", \
"pr_Amon_CSIRO-Mk3-6-0_historical_r1i1p1_185001-200512.nc",\
"pr_Amon_FGOALS-s2_historical_r1i1p1_185001-200512.nc",\
"pr_Amon_FIO-ESM_historical_r1i1p1_185001-200512.nc",\
"pr_Amon_GISS-E2-H_historical_r1i1p1_195101-200512.nc",\
"pr_Amon_HadCM3_historical_r1i1p1_198412-200512.nc",\
"pr_Amon_HadGEM2-AO_historical_r1i1p1_186001-200512.nc", \
"pr_Amon_inmcm4_historical_r1i1p1_185001-200512.nc"/)
fi=addfile(dir+filename(x),"r")
timex:= fi->time
tim:= cd_calendar(timex, 1)
ntim:= dimsizes(tim)
do a=0,ntim-1
if tim(a).eq.198601 then
begin_date = a
else if tim(a).eq.200512 then
end_date = a
end if
end if
end do
pr0 := fi->pr(begin_date:end_date, {lat1:lat2}, {lon1:lon2})
pr0@missing_Value = 1e+020
pr0@_FillValue = 1e+020
latn := dimsizes(pr0(0,:,0))
lonn := dimsizes(pr0(0,0,:))
n = latn
xx := fspan(15, 60, n)
;print(latn)
;print(nlat)
pr1 := pr0*24*60*60
prtla := dim_avg_n(pr1, 2)
pr := new((/20,12,n/), float)
;printVarSummary(prtla)
pr(0,:,:) := prtla(0:11,:)
pr(1,:,:) := prtla(12:23,:)
pr(2,:,:) := prtla(24:35,:)
pr(3,:,:) := prtla(36:47,:)
pr(4,:,:) := prtla(48:59,:)
pr(5,:,:) := prtla(60:71,:)
pr(6,:,:) := prtla(72:83,:)
pr(7,:,:) := prtla(84:95,:)
pr(8,:,:) := prtla(96:107,:)
pr(9,:,:) := prtla(108:119,:)
pr(10,:,:) := prtla(120:131,:)
pr(11,:,:) := prtla(132:143,:)
pr(12,:,:) := prtla(144:155,:)
pr(13,:,:) := prtla(156:167,:)
pr(14,:,:) := prtla(168:179,:)
pr(15,:,:) := prtla(180:191,:)
pr(16,:,:) := prtla(192:203,:)
pr(17,:,:) := prtla(204:215,:)
pr(18,:,:) := prtla(216:227,:)
pr(19,:,:) := prtla(228:239,:)
;printVarSummary(prt)
prla := dim_avg_n(prt, 1)
prlax := new((/21,nlat/), float)
prlax(0:19,:) := prla
prlax(20,:) := dim_avg_n(prla, 0)
;wks(x) =gsn_open_wks("png","prtrend-lat-2005-2014")
res = True
;res@gsnMaximize = True
res@gsnDraw = False
res@gsnFrame = False
res@vpXF = 0.15
res@vpYF = 0.85
res@vpHeightF = 0.6
res@vpWidthF = 0.8
res@xyExplicitLegendLabels = (/"1986","1987","1988","1989","1990","1991","1992","1993","1994","1995","1996",\
"1997","1998","1999","2000","2001","2002","2003","2004","2005","mean"/)
res@xyLineColors = (/"grey57","grey56","grey55","grey54","grey53","grey52","grey51","grey50","grey49","grey48","grey57",\
"grey56","grey55","grey54","grey53","grey52","grey51","grey50","grey49","grey48","red"/)
res@xyDashPatterns = (/10,9,8,7,6,5,4,3,2,1,10,9,8,7,6,5,4,3,2,1,0/)
res@xyLineThicknessF = 4
super = "mm/day"
res@tiYAxisString = "Precipitation "+ super
res@tiYAxisFont = 21
;res@tiYAxisFontHeightF = 0.012
;res@tiYAxisFontAspectF = 1.3
res@tiYAxisFontHeightF = 0.016;纵坐标标题字体大小
res@tmXTOn = False
res@tmXTBorderOn = False
res@tmXTLabelsOn = False
res@tmYROn = False
res@tmYRBorderOn = False
res@tmYRLabelsOn = False;关闭右坐标轴
;res@tmXBMode = "Explicit" ; explicit labels
;res@tmXBValues = ispan(1,12,1)
;res@tmXBLabels = (/"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep", \
;"Oct","Nov","Dec"/)
;res@tiXAxisString = "month"
;res@tiXAxisFont = 21
res@tmXBLabelFontAspectF = 1.2
res@tmXBLabelFontHeightF = 0.012
res@tmYLLabelFontHeightF = 0.012
res@pmLegendDisplayMode = "Always"
res@pmLegendSide = "Top"
res@lgLabelFontHeightF = 0.01
res@pmLegendWidthF = 0.08 ;-- set legend width
res@pmLegendHeightF = 0.28 ;-- set legend height
res@pmLegendOrthogonalPosF = -1;-- move legend up(+up;-down)
res@pmLegendParallelPosF = 0.06;-- move legend right(+right;-left)
;res@gsnPanelBottom = 0.05;底部留白
;String = "Precipitation changes with dimensions from 1986 to 2005,data from GPCP"
;ndcres = True
;ndcres@txFontColor = "black"
;ndcres@txFontHeightF = 0.015
;gsn_text_ndc(wks, String, 0.5, 0.13, ndcres)
;print(nlat)
plot(x) = gsn_csm_xy(wks,xx,prla,res)
end do
gsn_panel(wks,plot,(/4,4/),False)
frame(wks)
|
|