本文整理汇总了Python中catalog.Catalog.append方法的典型用法代码示例。如果您正苦于以下问题:Python Catalog.append方法的具体用法?Python Catalog.append怎么用?Python Catalog.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类catalog.Catalog
的用法示例。
在下文中一共展示了Catalog.append方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: read_excel
# 需要导入模块: from catalog import Catalog [as 别名]
# 或者: from catalog.Catalog import append [as 别名]
def read_excel(file='slab++.xlsx'):
wb = open_workbook(file)
sheet = wb.sheets()[0]
number_of_rows = sheet.nrows
number_of_columns = sheet.ncols
items = []
rows = []
slabs= Catalog()
for row in range(4, number_of_rows):
slab= Slab()
values = []
for col in range(number_of_columns):
par=str(sheet.cell(3,col).value)
if par:
print(par)
value = sheet.cell(row,col).value
print(par,value)
try:
slab.params[par]= float(value)
except:
slab.params[par] = str(value)
# save temperature at 600 km using thermal parameter
phi = slab.params['thermalPar']
z = 6.0
Ta = 1338.0
Tz = Ta * (1.0 - ( (2.0/np.pi)*np.exp(-1.0*( (np.power(np.pi,2.0)*z)/ (np.power(2.32,2.0) * phi) )) ) )
slab.params['Temp600'] = Tz
print(Tz)
print(slab.params)
slabs.append(slab)
return slabs
示例2: read_syracuse_thermal
# 需要导入模块: from catalog import Catalog [as 别名]
# 或者: from catalog.Catalog import append [as 别名]
def read_syracuse_thermal(sub='d80'):
file = open('data/syracuseetal_parameters_'+sub+'.txt','r')
slabs=Catalog() # Initialize Catalog object
for line in file.readlines():
val = line.split()
if val[0]!= '#':# skip comments at top of file
name = val[0]
savei=0
for i in range(1,4): # Read in slab names that are more than one string in lenght
try:
float(val[i])
break
except:
savei=i
name = name + ' ' +val[i]
slab=Slab(name) # Initialize slab object
slab.params['transition_depth'] = float(val[savei+1])
slab.params['transition_T'] = float(val[savei+2])
slab.params['slab_T'] = float(val[savei+3])
slab.params['moho_T'] = float(val[savei+4])
slab.params['max_mantle_T'] = float(val[savei+5])
slab.params['max_mantle_T_depth'] = float(val[savei+6])
slab.params['transition_offset'] = float(val[savei+7])
slab.params['slab_surface_T_30km']= float(val[savei+8])
slab.params['slab_surface_T_240km'] = float(val[savei+9])
slab.params['min_slab_T_240km'] = float(val[savei+10])
slabs.append(slab) # Add slab object to catalot
return slabs
示例3: read_syracuse
# 需要导入模块: from catalog import Catalog [as 别名]
# 或者: from catalog.Catalog import append [as 别名]
def read_syracuse():
file = open('data/syracuseetal_table1.txt','r')
slabs=Catalog() # Initialize Catalog object
for line in file.readlines():
val = line.split()
if val[0]!= '#':# skip comments at top of file
name = val[0]
savei=0
for i in range(1,4): # Read in slab names that are more than one string in lenght
try:
float(val[i])
break
except:
savei=i
name = name + ' ' +val[i]
print(val,savei)
slab=Slab(name) # Initialize slab object
slab.params['lon']= float(val[savei+1])
slab.params['lat'] = float(val[savei+2])
slab.params['H'] = float(val[savei+3])
slab.params['arc_trench_distance'] = float(val[savei+4])
slab.params['slab_dip'] = float(val[savei+5])
slab.params['Vc'] = float(val[savei+6])
slab.params['age'] = float(val[savei+7])
slab.params['decent_rate'] = float(val[savei+8])
slab.params['thermal_parameter'] = float(val[savei+9])
slab.params['sediment_thickness'] = float(val[savei+10])
slab.params['subducted_sediment_thickness'] = float(val[savei+11])
slab.params['upper_plate_type'] = val[savei+12]
#slab.upper_plate_thickness = float(val[savei+12])
#slab.upper_plate_age = float(val[savei+13])
slabs.append(slab) # Add slab object to catalot
return slabs
示例4: read_seracuse
# 需要导入模块: from catalog import Catalog [as 别名]
# 或者: from catalog.Catalog import append [as 别名]
def read_seracuse():
file = open('data/syracuseetal_parameters.txt','r')
slabs=Catalog()
for line in file.readlines():
val = line.split()
name = val[0]
savei=0
for i in range(1,4):
try:
float(val[i])
break
except:
savei=i
name = name + ' ' +val[i]
slab=Slab(name)
slab.transition_depth = float(val[savei+1])
slab.transition_T = float(val[savei+2])
slab.slab_T = float(val[savei+3])
slab.moho_T = float(val[savei+4])
slab.max_mantle_T = float(val[savei+5])
slab.max_mantle_T_depth = float(val[savei+6])
slab.transition_offset = float(val[savei+7])
slab.slab_surface_T_30km = float(val[savei+8])
slab.slab_surface_T_240km = float(val[savei+9])
slab.min_slab_T_240km = float(val[savei+10])
slabs.append(slab)
return slabs
示例5: read_slabdata
# 需要导入模块: from catalog import Catalog [as 别名]
# 或者: from catalog.Catalog import append [as 别名]
def read_slabdata(slabcat=None):
'''
Creates slab objects for the slabs identified by Fukao & Obayashi (2013)
'''
slabs = {}
#This dictionary contains information about the boundaries of the slabs mentioned in the
#Fukao and Obayashi paper
#The coordinates are entered as follows:
#[minlon,minlat,maxlon,maxlat]
slabs['Honshu'] = {'Bounds' : [109,35,159,45]}
slabs['Bonin'] = {'Bounds' : [109,23,159,35]}
slabs['Mariana'] = {'Bounds' : [120,8.3,152,25]}
slabs['Java'] = {'Bounds' : [89,-10,129,19]}
slabs['Phillippine'] = {'Bounds' : [114,5,128,18]}
slabs['Tonga'] = {'Bounds' : [157,-26,190,-10]}
slabs['Kermadec'] = {'Bounds' : [157,-37,190,-26]}
slabs['Peruvian'] = {'Bounds' : [270,-15,307,6.7]}
slabs['Chilean'] = {'Bounds' : [270,-45,307,-15]}
slabs['Central_American'] = {'Bounds' : [249,4.5,282,33]}
#For these two regions, we need an oblique box. The coodinates are entered as follows
#[upper left,lower left,lower right,upper right]
slabs['Kurile_N'] = {'Bounds' : [134.5,65.5,130.5,61.5,158.5,43,162.5,47]}
slabs['Kurile_S'] = {'Bounds' : [127.5,58.5,123.5,54.5,151.5,36,155.5,40]}
if slabcat:
FukaoSlabs = slabcat
else:
FukaoSlabs = Catalog()
for slabname in slabs:
newslab = Slab(slabname)
#add directory to the slabs
newslab.add_Fukao_slab_details(slabs[slabname])
FukaoSlabs.append(newslab)
return FukaoSlabs
示例6: read_slabdata
# 需要导入模块: from catalog import Catalog [as 别名]
# 或者: from catalog.Catalog import append [as 别名]
def read_slabdata(slabcat=None):
'''
Read in the slab1.0 data as a catalog of slabs object. The argument options allows one to
append these slabs to an existing catalog
'''
slabdir='data/slab1.0/'
#Names given to the slab 1.0 slabs
slabbounds = {}
slabbounds['Alaska'] = {'Filename' : 'alu_slab1.0_clip.grd'}
slabbounds['Cascadia'] = {'Filename' :'cas_slab1.0_clip.grd'}
slabbounds['Izu-Bonin'] = {'Filename' : 'izu_slab1.0_clip.grd'}
slabbounds['Mexico'] = {'Filename' : 'mex_slab1.0_clip.grd'}
slabbounds['Tonga'] = {'Filename' : 'ker_slab1.0_clip.grd'}
slabbounds['Japan'] = {'Filename' : 'kur_slab1.0_clip.grd'}
slabbounds['Philippines'] = {'Filename' : 'phi_slab1.0_clip.grd'}
slabbounds['Ryukyu'] = {'Filename' : 'ryu_slab1.0_clip.grd'}
slabbounds['Vanautu'] = {'Filename' : 'van_slab1.0_clip.grd'}
slabbounds['Scotia'] = {'Filename' : 'sco_slab1.0_clip.grd'}
slabbounds['Solomon'] = {'Filename' : 'sol_slab1.0_clip.grd'}
slabbounds['South_America'] = {'Filename' : 'sam_slab1.0_clip.grd'}
slabbounds['Sumatra'] = {'Filename' : 'sum_slab1.0_clip.grd'}
#try:
# os.chdir(slabdir)
#except:
# print('Data directory %s does not exist!' %slabdir)
slab_ncs = glob.glob(slabdir+'*.grd')
#Create a catalog object for the slab1.0 slabs
if slabcat:
Slabs = slabcat
else:
Slabs=Catalog()
for slab in slab_ncs:
infile = netcdf.netcdf_file(slab, 'r')
filevariables = infile.variables.keys()
lats = infile.variables[filevariables[0]][:]
lons = infile.variables[filevariables[1]][:]
#This is a lat x lon array
depths = infile.variables[filevariables[2]][:]
infile.close()
minlat = min(lats)
maxlat = max(lats)
minlon = min(lons)
maxlon = max(lons)
boundingbox = [minlon,maxlon,minlat,maxlat]
for name in slabbounds:
if slabbounds[name]['Filename'] == slab.split('/')[-1].strip():
#create a Slab object
newslab = Slab(name)
slabbounds[name]['Lat_array'] = lats
slabbounds[name]['Lon_array'] = lons
slabbounds[name]['Depth_array'] = depths
slabbounds[name]['Bounding_box'] = boundingbox
#Add sub-dicionary to the slab object
newslab.add_slab1_details(slabbounds[name])
Slabs.append(newslab)
break
return Slabs,slabbounds