求助啊
海棠哥以前发的一个surfer to 3dec的例子,为什么我的操作实现不了啊。版主大哥给我看下,不胜感激啊 这面是代码new
def para_set
suferfile = 'Sufer_Data.dat' ;File from Sufer which contains the layers' coords.
Tablefile = 'Table_data.dat' ;File which contains the table.
D3DECFile = 'D3dec_Model.dat';3dec Model
Col_Num = 36 ;sufer中插值网格x方向上的插值点个数
Row_Num = 26 ;sufer中插值网格y方向上的插值点个数
dx_size = 2 ;X方向上的单元的大小(m)
dy_size = 2 ;Y方向上的单元的大小(m)
z_base = 0 ;模型z方向底座高程
z_size = 10
xor = 0 ;模型左下角的x坐标(最小x坐标)
yor = 0 ;模型左下角的y坐标(最小y坐标)
n_zon_col = Col_Num - 1
n_zon_row = Row_Num - 1
end
para_set
;cal 01_Surfer_To_Table.fis
def setup
a_size = 100000
IO_READ = 0
IO_WRITE = 1
IO_FISH = 0
IO_ASCII = 1
IN_FILE_NAME = suferfile ;the data file from sufer!
end
setup
;----------------SOMETHING SHOULD BE PREDIFINED----------------
;----------------DEFINE THE FUNCTIN TO LOAD DATAFILE---------------
def read_data
;read the data file!
array x_cor(a_size) ;DIFINE ARRAY TO STORE THE X_COR
array y_cor(a_size) ;DIFINE ARRAY TO STORE THE Y_COR
array zg_cor(a_size) ;DIFINE ARRAY TO STORE THE Z_COR
array sData(a_size) ;DEFINE ARRAY TO STORE FILE INFO
array sOut(a_size) ;DEFINE ARRAY TO STORE FILE TO BE SAVED(Optional,for debug)
status = open(IN_FILE_NAME, IO_READ, IO_ASCII)
status = read(sData, a_size)
ReciveNum = status
if status >= a_size then
oo = out('Array is not big enough! Please Adjust the dimension of the array!')
command
pause
endcommand
endif
status = close
;check the results and initialize the coordinate
loop n (1,ReciveNum)
caseof pre_parse(sData(n), 1)
case 1
x_cor(n)=parse(sData(n), 1)
case 2
x_cor(n)=parse(sData(n), 1)
case 3
oo = out('Error,input x_cor')
exit
case 0
oo = out('Error,input x_cor')
exit
endcase
caseof pre_parse(sData(n), 2)
case 1
y_cor(n)=parse(sData(n), 2)
case 2
y_cor(n)=parse(sData(n), 2)
case 3
oo = out('Error,input y_cor')
exit
case 0
oo = out('Error,input y_cor')
exit
endcase
caseof pre_parse(sData(n), 3)
case 1
zg_cor(n)=parse(sData(n), 3)
case 2
zg_cor(n)=parse(sData(n), 3)
case 3
oo = out('Error,input zg_cor')
exit
case 0
oo = out('Error,input zg_cor')
exit
endcase
endloop
end
read_data ;------------ [ read sufer network information! ]
;cal 02_creat_table.fis
def creat_table
;paremeters list
;TAB_NUM---the number of the tabs created
; the tab_num here equals to the number
; of colums(y).Ref to the topotab.dat
;ROW_NUM,COL_NUM
status = open(Tablefile, IO_WRITE, IO_ASCII)
Index=1
;for debud
n_zone_col=Col_Num
n_zone_row=Row_Num
;prepare for the data to be exported
loop ii (1,ROW_NUM)
loop kk (1,COL_NUM)
n=ii*ROW_NUM+kk
sOut(Index)='Table'+''+string(ii)+''+string(x_cor(Index))+ ''+ string(zg_cor(Index))
Index=Index+1
endloop
endloop
startnum = ROW_NUM + 1
endnum = ROW_NUM*2
totalnum = ROW_NUM*COL_NUM
loop ii (startnum,endnum)
loop kk (1,COL_NUM)
sOut(Index)='Table'+''+string(ii)+''+string(x_cor(Index - totalnum))
Index=Index+1
endloop
endloop
TotalWriteNum=n_zone_col*n_zone_row
status=write(sOut,TotalWriteNum)
if status >= TotalWriteNum then
oo = out('Bad number of lines')
endif
status = close
end
creat_table;------------ [ creat table " MyTopoTab.dat " ! ]
cal Tablefile
def Write3DEC
status = open(D3DECFile, IO_WRITE, IO_ASCII)
array Block1(1)
array Block2(1)
loop i (1,n_zon_col)
loop j(1,n_zon_row)
x1=xor+dx_size*(i-1)
x2=x1+dx_size
y1=yor+dy_size*(j-1)
y2=y1+dy_size
zg1=table(j,x1)
zg2=table(j+1,x1)
zg3=table(j+1,x2)
zg4=table(j,x2)
zb=z_base
Block1(1) = 'poly pr re 1 & ' + '\n'
Block1(1) = Block1(1) + 'a '+ string(x1) + ' ' + string(y1)
Block1(1) = Block1(1) + string(x2) + ' ' + string(y1)
Block1(1) = Block1(1) + string(x1) + ' ' + string(y2) + '&'+ '\n'
Block1(1) = Block1(1) + 'b '+ string(x1) + ' ' + string(z1) + ' ' + string(y1)
Block1(1) = Block1(1) + string(x2) + ' ' + string(zg4) + ' ' + string(y1)
Block1(1) = Block1(1) + string(x1) + ' ' + string(zg2) + ' ' + string(y2) + ' \n'
Block1(1) = Block1(1) + 'poly pr re 1 & ' + '\n'
Block1(1) = Block1(1) + 'a '+ string(x2) + ' ' + string(y1)
Block1(1) = Block1(1) + string(x2) + ' ' + string(y2)
Block1(1) = Block1(1) + string(x1) + ' ' + string(y2) + '& '+ '\n'
Block1(1) = Block1(1) + 'b '+ string(x2) + ' ' + string(zg4) + ' ' + string(y1)
Block1(1) = Block1(1) + string(x2) + ' ' + string(zg3) + ' ' + string(y2)
Block1(1) = Block1(1) + string(x1) + ' ' + string(zg2) + ' ' + string(y2) + '\n'
Block1(1) = Block1(1) + 'poly pr re 2 & ' + '\n'
Block1(1) = Block1(1) + 'a '+ string(x1) + ' ' + string(zb)+ ' ' + string(y1)
Block1(1) = Block1(1)+ string(x2) + ' ' + string(zb)+ ' ' + string(y1)
Block1(1) = Block1(1)+ string(x1) + ' ' + string(zb)+ ' ' + string(y2) + ' & '+ '\n'
Block1(1) = Block1(1) + 'b '+ string(x1) + ' ' + string(y1)
Block1(1) = Block1(1)+ string(x2) + ' ' + string(y1)
Block1(1) = Block1(1)+ string(x1) + ' ' + string(y2) + '\n'
Block1(1) = Block1(1) + 'poly pr re 2 & ' + '\n'
Block1(1) = Block1(1) + 'a '+ string(x2) + ' ' + string(zb) + ' ' + string(y1)
Block1(1) = Block1(1) + string(x2) + ' ' + string(zb) + ' ' + string(y2)
Block1(1) = Block1(1) + string(x1) + ' ' + string(zb) + ' ' + string(y2) + ' & '+ '\n'
Block1(1) = Block1(1) + 'b '+ string(x2) + ' ' + string(y1)
Block1(1) = Block1(1) + string(x2) + ' ' + string(y2)
Block1(1) = Block1(1) + string(x1) + ' ' + string(y2) + '\n'
if i = n_zon_col then
if j = n_zon_row then
Block1(1) = Block1(1) + '\n '
Block1(1) = Block1(1) + 'set bac 15' + '\n '
Block1(1) = Block1(1) + 'pl col reg mag 1.5 hold'
endif
endif
status = write(Block1,1)
end_loop
end_loop
status = close
end
Write3DEC
cal d3dec_Model.dat 为什么出现错误说:输入参数过多呢~~~~ 海棠大牛的源代码见附件。
帖子链接是http://forum.simwe.com/thread-763915-1-1.html,大牛们给指导下,毕业论文急用
页:
[1]