- 积分
- 11275
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-9-9
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 muggle 于 2017-11-24 11:33 编辑
在同学的帮忙下,我写了一个统计高温日数的脚本,但是运行的时候在站点插值函数处报错,说左右数组维数不等,可是同学他那边同样的写法却可以运行,所以我是哪里错了。。。麻烦各位指点一下
报错结果如下
fatal:Dimension size mismatch on subscript #1, left-hand and right-hand side dimensions do not match
fatal:["Execute.c":8578]:Execute: Error occurred at or near line 88 in file /cygdrive/f/192/ncl/sta_num_of_tmax.ncl
下面是我的脚本
;----------------------------------------------------------------------
; sta_num_0f_tmax.ncl
;高温日数的统计及计算
;
; These files are loaded by default in NCL V6.2.0 and newer
; 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
; 读取站点逐日资料
filename = "/cygdrive/f/192/1/EOF/data/35summer153dayobs.txt"
; Calculate the number of columns.
ncols = numAsciiCol(filename)
; Given the # of columns, we can use readAsciiTable to read this file.
data = readAsciiTable(filename,ncols,"float",0)
nrows = dimsizes(data(:,0)) ; calculate # of rows
print("'" + filename + "' has " + nrows + " rows and " + ncols + \
" columns of data.")
data_daily = new((/35,191,153/),"float")
do i=1,35
do j=1,191
data_daily ((i-1),(j-1),:)= data(((i-1)*191*153+(j-1)*153+0):((i-1)*191*153+(j-1)*153+152),4)
end do
end do
; printVarSummary(data)
; 读取阈值资料
data_yz = asciiread("/cygdrive/f/192/1/yuzhi/r95t35-54909.txt",(/35,191/),"float")
data_yz!0 = "time"
data_yz!1 = "sta"
; print(data_yz(0,190))
; 读取站点经纬度信息
temp = asciiread("/cygdrive/f/192/1/EOF/lon_lat-54909.txt",(/191,3/),"float")
lat = temp(:,2)
lon = temp(:,1)
; print(lat(0))
; print(lon(1))
; 判断大于阈值的高温日数
num_tmax = new ((/35,191/),"float")
do i=0,34
do j=0,190
num_tmax (i,j) = num (data_daily(i,j,:) .gt. data_yz(i,j) )
end do
end do
print(num_tmax(34,190))
; 构造格点
olon =new(29,"float")
olat =new(17,"float")
data1 =new((/35,17,29/),"float")
do i=0,28
olon(i)=70+i*2.5
end do
do j=0,16
olat(j)=15+j*2.5
end do
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
rscan=(/10,5,3/)
do i=0,34
data1(i,:,:) = obj_anal_ic_Wrap(lon,lat,num_tmax(i,:),olon,olat,rscan,False)
end do
end
|
|