Browse Source

fomosto qseis backend: allow non-zero (and negative) surface level

- handled in wrapper, qseis will always get a depth of zero for the top
  of the first model layer
candidate
Sebastian Heimann 3 weeks ago
parent
commit
8c6d174881
  1. 25
      src/fomosto/qseis.py

25
src/fomosto/qseis.py

@ -80,12 +80,16 @@ def scl(cs):
def cake_model_to_config(mod):
k = 1000.
srows = []
ref_depth = 0.
for i, row in enumerate(mod.to_scanlines()):
depth, vp, vs, rho, qp, qs = row
row = [depth/k, vp/k, vs/k, rho/k, qp, qs]
if i == 0:
ref_depth = depth
row = [(depth-ref_depth)/k, vp/k, vs/k, rho/k, qp, qs]
srows.append('%i %s' % (i+1, str_float_vals(row)))
return '\n'.join(srows), len(srows)
return '\n'.join(srows), len(srows), ref_depth
class QSeisSourceMech(Object):
@ -249,13 +253,14 @@ class QSeisConfigFull(QSeisConfig):
d['str_distances'] = str_float_vals(self.receiver_distances)
d['str_azimuths'] = str_float_vals(self.receiver_azimuths)
model_str, nlines = cake_model_to_config(self.earthmodel_1d)
model_str, nlines, ref_depth = cake_model_to_config(self.earthmodel_1d)
d['n_model_lines'] = nlines
d['model_lines'] = model_str
if self.earthmodel_receiver_1d:
model_str, nlines = cake_model_to_config(
model_str, nlines, ref_depth2 = cake_model_to_config(
self.earthmodel_receiver_1d)
assert ref_depth == ref_depth2
else:
model_str = "# no receiver side model"
nlines = 0
@ -264,6 +269,11 @@ class QSeisConfigFull(QSeisConfig):
d['model_receiver_lines'] = model_str
d['str_slowness_window'] = str_float_vals(self.slowness_window)
if self.propagation_filters and ref_depth != 0.0:
raise QSeisError(
'Earth model must start with zero depth if '
'propagation_filters are set.')
d['n_depth_ranges'], d['str_depth_ranges'] = \
aggregate(self.propagation_filters)
@ -293,6 +303,9 @@ class QSeisConfigFull(QSeisConfig):
else:
d['str_source'] = '0'
d['source_depth_rel'] = d['source_depth'] - ref_depth / km
d['receiver_depth_rel'] = d['receiver_depth'] - ref_depth / km
template = '''# autogenerated QSEIS input by qseis.py
#
# This is the input file of FORTRAN77 program "qseis06" for calculation of
@ -321,7 +334,7 @@ class QSeisConfigFull(QSeisConfig):
# =================
# 1. source depth [km]
#------------------------------------------------------------------------------
%(source_depth)e |dble: source_depth;
%(source_depth_rel)e |dble: source_depth;
#------------------------------------------------------------------------------
#
# RECEIVER PARAMETERS
@ -337,7 +350,7 @@ class QSeisConfigFull(QSeisConfig):
# 6. switch for unit of the following time reduction parameter: 1 = velocity
# [km/sec], 0 = slowness [sec/deg]; time reduction parameter
#------------------------------------------------------------------------------
%(receiver_depth)e |dble: receiver_depth;
%(receiver_depth_rel)e |dble: receiver_depth;
%(sw_equidistant)i %(sw_distance_unit)i |int: sw_equidistant, sw_d_unit;
%(n_distances)i |int: no_distances;
%(str_distances)s |dble: d_1,d_n; or d_1,d_2, ...(no comments in between!);

Loading…
Cancel
Save