Beispiel #1
0
out_dir=os.path.join(base_path,'out',wo.opdict['outdir'])
grid_filename_base=os.path.join(base_path,'lib',wo.opdict['time_grid'])
search_grid_filename=os.path.join(base_path,'lib',wo.opdict['search_grid'])
stations_filename=os.path.join(base_path,'lib',wo.opdict['stations'])

# read the time-grid
sta=StationList()
sta.read_from_file(stations_filename)

cha=ChannelList()
cha.populate_from_station_list(sta,comp_string=["HHZ"])

time_grid=QDTimeGrid()
time_grid.read_NLL_hdr_file(search_grid_filename)
load_ttimes_buf=wo.opdict['load_ttimes_buf']
if recalc_grids : time_grid.populate_from_time_grids(grid_filename_base,cha,out_dir,load_ttimes_buf)


# set up basic grid information for test
grid_filename=os.path.join(base_path,'lib',wo.opdict['search_grid'])
dummy_grid=QDGrid()
dummy_grid.read_NLL_hdr_file(grid_filename)
# set up projection information for test
f=open(grid_filename)
lines=f.readlines()
f.close()
proj_line=lines[1]
proj_info={}
proj_info['orig_lat'] = np.float(proj_line.split()[3])
proj_info['orig_lon'] = np.float(proj_line.split()[5])
proj_info['map_rot'] = np.float(proj_line.split()[7])
grid_filename_base = os.path.join(base_path, 'lib', wo.opdict['time_grid'])
search_grid_filename = os.path.join(base_path, 'lib', wo.opdict['search_grid'])
stations_filename = os.path.join(base_path, 'lib', wo.opdict['stations'])

# read the time-grid
sta = StationList()
sta.read_from_file(stations_filename)

cha = ChannelList()
cha.populate_from_station_list(sta, comp_string=["HHZ"])

time_grid = QDTimeGrid()
time_grid.read_NLL_hdr_file(search_grid_filename)
load_ttimes_buf = wo.opdict['load_ttimes_buf']
if recalc_grids:
    time_grid.populate_from_time_grids(grid_filename_base, cha, out_dir,
                                       load_ttimes_buf)

# set up basic grid information for test
grid_filename = os.path.join(base_path, 'lib', wo.opdict['search_grid'])
dummy_grid = QDGrid()
dummy_grid.read_NLL_hdr_file(grid_filename)
# set up projection information for test
f = open(grid_filename)
lines = f.readlines()
f.close()
proj_line = lines[1]
proj_info = {}
proj_info['orig_lat'] = np.float(proj_line.split()[3])
proj_info['orig_lon'] = np.float(proj_line.split()[5])
proj_info['map_rot'] = np.float(proj_line.split()[7])
Beispiel #3
0

cha=ChannelList()
cha.populate_from_station_list_and_data_files(sta,data_files)

######### INTERPOLATE TRAVEL TIMES #############

# The time grid will contain as array values just the travel-times needed 
# (interpolated from the full NLL files) so we can free up the memory as soon as possible

time_grid=QDTimeGrid()
time_grid.read_NLL_hdr_file(hdr_file)
if options.twoD:
  time_grid.populate_from_2D_time_grids(grid_filename_base,cha)
else:
  time_grid.populate_from_time_grids(grid_filename_base,cha,out_path,load_buf=True)


print "Getting Grid geometry"
dummy_grid=QDGrid()
dummy_grid.read_NLL_hdr_file(hdr_file)
(nx,ny,nz)=(dummy_grid.nx, dummy_grid.ny, dummy_grid.nz)

if do_hyp:
  logging.info("Reading hyp parameters")
  hyp_parameters=[]
  for hyp_file in hyp_files:
    logging.debug("Hyp info from %s"%hyp_file)
    (otime,hypo_x,sigma_x,hypo_y,sigma_y,hypo_z,sigma_z)=qd_read_hyp_file(hyp_file)
    phase_dict=qd_read_picks_from_hyp_file(hyp_file)
    hyp_parameters.append(((otime,hypo_x,sigma_x,hypo_y,sigma_y,hypo_z,sigma_z),phase_dict))