15
15
from __future__ import print_function , division , absolute_import
16
16
import os
17
17
from pprint import pprint
18
+ from copy import deepcopy
18
19
from pyasdf import ASDFDataSet
19
20
from pytomo3d .adjoint .sum_adjoint import load_to_adjsrc , dump_adjsrc , \
20
21
check_events_consistent , \
@@ -148,7 +149,8 @@ def attach_station_to_db(self, station_info):
148
149
station_info ["station" ])
149
150
150
151
if station_id not in self .stations :
151
- self .stations [station_id ] = station_info
152
+ self .stations [station_id ] = deepcopy (station_info )
153
+ self .stations ["location" ] = ""
152
154
else :
153
155
# check consistency
154
156
sta_base = self .stations [station_id ]
@@ -170,10 +172,19 @@ def add_adjoint_dataset_on_channel_weight(self, ds, weights):
170
172
new_adj , station_info = load_to_adjsrc (adj )
171
173
172
174
channel_weight = weights [channel ]["weight" ]
173
- self .attach_adj_to_db (adj_id , new_adj , channel_weight )
174
-
175
- self .attach_station_to_db (station_info )
176
-
175
+ # add station information
176
+ try :
177
+ self .attach_station_to_db (station_info )
178
+ except Exception as err :
179
+ print ("Failed to add station information(%s) to db due to: %s"
180
+ % (channel , str (err )))
181
+ continue
182
+ # add adjoint source
183
+ try :
184
+ self .attach_adj_to_db (adj_id , new_adj , channel_weight )
185
+ except Exception as err :
186
+ print ("Failed to add station adjsrc(%s) to db due to: %s"
187
+ % (channel , str (err )))
177
188
# get the component misfit values
178
189
if _comp not in misfits :
179
190
misfits [_comp ] = {"misfit" : 0 , "raw_misfit" : 0 }
0 commit comments