- 积分
- 5670
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-8-26
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
先生成了一个月一个txt文件,总共3年,每年10个月的,把它们整合到一个2维txt里面。
树立了很多遍,总是提示循环有错误,不知道到底哪里错了,求教大神。
错误提示如图:
fatal:syntax error:line 78 in file 8.ncl before or near do end do
fatal:error in statement
fatal:syntax error:line 79 in file 8.ncl before or near do end do
fatal:error in statement
fatal:syntax error:line 132 in file 8.ncl before or near \n end
fatal:error in statement
语句如下:
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
lonL = 80
lonR = 120
latN = 50
latS = 10
nn=lonR-lonL+1
mm=latN-latS+1
len_grid=mm*nn
;print(mm)
;print(nn)
;print(len_grid)
;len_t=1
yearnum=3
monthnum=8
sta_year=2016
sta_month=3
anualDaynum=245
Daynum=anualDaynum*yearnum
rawdata=new((/len_grid,Daynum/),"float")
outdir="/mnt/d/fx/"
indir="/mnt/d/fx/"
;datapath="/mnt/d/fx/"
startj=0
do iyear=0,yearnum-1
do imonth=0,monthnum-1
yeartmp=sta_year+iyear
monthtmp=sta_month+imonth
years=sprinti("%0.2i",yeartmp)
months=sprinti("%0.2i",monthtmp)
yearstr=years+months;actually it is yearmonthstr
print(yearstr)
;end do
;end do
;yearstr="201603"
datapath=indir+"hgt500mb"+yearstr+"mn1D.txt"
print(datapath)
if (monthtmp.eq.3) then
endj=startj+30
len_t=31
end if
if (monthtmp.eq.4) then
endj=startj+29
len_t=30
end if
if (monthtmp.eq.5) then
endj=startj+30
len_t=31
end if
if (monthtmp.eq.6) then
endj=startj+29
len_t=30
end if
if (monthtmp.eq.7) then
endj=startj+30
len_t=31
end if
if (monthtmp.eq.8) then
endj=startj+30
len_t=31
end if
if (monthtmp.eq.9) then
endj=startj+29
len_t=30
end if
if (monthtmp.eq.10) then
endj=startj+30
len_t=31
rawdata(:,startj:endj)=asciiread(datapath,(/len_grid,len_t/),"float")
startj=endj+1
delete(datapath)
delete(len_t)
end do
end do
;printVarSummary(rawdata)
;printMinMax(rawdata,True)
rawdata!0="grid"
rawdata!1="day";time in columns
printVarSummary(rawdata)
outdata=rawdata(day|:,grid|:);time in lows
printVarSummary(outdata)
s=dimsizes(outdata)
print(s(0))
print(s(1))
;print(outdata(:,1))
ncol=s(1)
;fmtf="501f9.4"
fmtf = ncol + "f12.4";s(1) number of columns
opt =True
opt@fout=outdir+"hgt500mbnm2D.txt"
write_matrix(outdata,fmtf,opt)
;ncol=s(0)
;fmtf="501f9.4"
;fmtf = ncol + "f12.4";s(1) number of columns
;opt =True
;opt@fout=outdir+"hgt500mb_201404Dailyavg_nm2D.txt"
;write_matrix(rawdata,fmtf,opt)
;**************************************************************************;
if (1.eq.0) then
wks=gsn_open_wks("eps",picdir+"hgt925")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
gsn_define_colormap(wks,"GMT_polar")
res = True ; plot mods desired
;res@gsnDraw = False ; don't draw yet
;res@gsnFrame = False ; don't advance frame yet
res@gsnAddCyclic =False
;res@cnLevelSelectionMode = "ExplicitLevels" ; set explicit contour levels
;res@cnLevels = (/232.7,234.2,238,240,244,248.4,252,258.3,276,286.5,292.1,300,306/)
res@tiMainOn = False
res@cnFillOn = True ; turn on color
; res@cnFillPalette = "gui_default" ; set color map
res@lbLabelBarOn = False ; will draw a panel label bar instead
res@cnLinesOn = False ; turn off contour lines
res@cnLineLabelsOn = False ; tuen off line labels
res@lbLabelBarOn=True
res@mpMaxLatF =latN
res@mpMinLatF =latS
res@mpMaxLonF =lonR
res@mpMinLonF =lonL
;plot= gsn_csm_contour_map_ce(wks,hgt0({lv_ISBL0|ilev},{lat_0|-90:90},{lon_0|0:359}), res)
;plot= gsn_csm_contour_map_ce(wks,hgt, res)
end if
end
|
-
|