Skip to content

Commit fac1463

Browse files
committed
refine adjoint sum checks
1 parent d784785 commit fac1463

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

pypaw/sum_adjoint.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from __future__ import print_function, division, absolute_import
1616
import os
1717
from pprint import pprint
18+
from copy import deepcopy
1819
from pyasdf import ASDFDataSet
1920
from pytomo3d.adjoint.sum_adjoint import load_to_adjsrc, dump_adjsrc, \
2021
check_events_consistent, \
@@ -148,7 +149,8 @@ def attach_station_to_db(self, station_info):
148149
station_info["station"])
149150

150151
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"] = ""
152154
else:
153155
# check consistency
154156
sta_base = self.stations[station_id]
@@ -170,10 +172,19 @@ def add_adjoint_dataset_on_channel_weight(self, ds, weights):
170172
new_adj, station_info = load_to_adjsrc(adj)
171173

172174
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)))
177188
# get the component misfit values
178189
if _comp not in misfits:
179190
misfits[_comp] = {"misfit": 0, "raw_misfit": 0}

0 commit comments

Comments
 (0)