Browse Source

rotation from qssp2017 through individual qssp rot version

undefined
braunfuss 2 months ago
parent
commit
3fdc9ec2d1
1 changed files with 41 additions and 6 deletions
  1. +41
    -6
      src/fomosto/qssp.py

+ 41
- 6
src/fomosto/qssp.py View File

@@ -32,6 +32,7 @@ program_bins = {
'qssp.2010': 'fomosto_qssp2010',
'qssp.2017': 'fomosto_qssp2017',
'qssp.ppeg2017': 'fomosto_qsspppeg2017',
'qssp.rot2017': 'fomosto_qssp2017',
}


@@ -52,9 +53,10 @@ def have_backend():
qssp_components = {
1: 'ae an az gr sd te tn ue un uz ve vn vz'.split(),
2: 'ar at ap gr sd tt tp ur ut up vr vt vp'.split(),
3: '_rota_e _rota_n _rota_z'.split(),
3: '_disp_e _disp_n _disp_z'.split(),
4: '_gravitation_e _gravitation_n _gravitation_z '
'_acce_e _acce_n _acce_z'.split()
'_acce_e _acce_n _acce_z'.split(),
5: '_rota_e _rota_n _rota_z'.split()
}


@@ -217,13 +219,15 @@ class QSSPConfigFull(QSSPConfig):
fmt = 3
elif self.qssp_version == 'ppeg2017':
fmt = 4
elif self.qssp_version == 'rot2017':
fmt = 5
else:
fmt = self.output_format

return qssp_components[fmt]

def get_output_filenames(self, rundir):
if self.qssp_version in ('2017', 'ppeg2017'):
if self.qssp_version in ('2017', 'ppeg2017', 'rot2017'):
return [
pjoin(rundir, self.output_filename + c + '.dat')
for c in self.components]
@@ -263,6 +267,13 @@ class QSSPConfigFull(QSSPConfig):
model_str, nlines = cake_model_to_config(self.earthmodel_1d)
d['n_model_lines'] = nlines
d['model_lines'] = model_str
if self.qssp_version == '2017':
d['output_displacement'] = 1
d['output_rotation'] = 0

if self.qssp_version == 'rot2017':
d['output_rotation'] = 1
d['output_displacement'] = 0

if len(self.sources) == 0 or isinstance(self.sources[0], QSSPSourceMT):
d['point_source_type'] = 1
@@ -291,7 +302,7 @@ class QSSPConfigFull(QSSPConfig):
self.lowpass_order,
self.lowpass_corner)

elif self.qssp_version in ('2010', '2017', 'ppeg2017'):
elif self.qssp_version in ('2010', '2017', 'ppeg2017', 'rot2017'):
d['scutoff_doc'] = '''
# (SH waves), minimum and maximum cutoff harmonic degrees
# Note: if the near-field static displacement is desired, the minimum
@@ -317,7 +328,7 @@ class QSSPConfigFull(QSSPConfig):
self.bandpass_order,
self.bandpass_corner_low,
self.bandpass_corner_high)
if self.qssp_version in ('2017', 'ppeg2017'):
if self.qssp_version in ('2017', 'ppeg2017', 'rot2017'):
template = '''# autogenerated QSSP input by qssp.py
#
# This is the input file of FORTRAN77 program "qssp2017" for calculating
@@ -454,7 +465,8 @@ class QSSPConfigFull(QSSPConfig):
# disp | velo | acce | strain | strain_rate | stress | stress_rate | rotation | rot_rate | gravitation | gravity
#---------------------------------------------------------------------------------------------------------------
# 1 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 1 0 0 0
%(output_displacement)i 0 0 0 0 0 0 %(output_rotation)i 0 0 0

'%(output_filename)s'
%(output_time_window)e
%(sfilter)s
@@ -641,6 +653,7 @@ class QSSPRunner(object):
input_fn = pjoin(self.tempdir, 'input')

with open(input_fn, 'wb') as f:
from pyrocko import guts
input_str = config.string_for_config()
logger.debug('===== begin qssp input =====\n'
'%s===== end qssp input =====' % input_str.decode())
@@ -775,6 +788,17 @@ class QSSPGFBuilder(gf.builder.Builder):
baseconf = self.store.get_extra('qssp')

if baseconf.qssp_version == '2017':
self.gfmapping = [
(MomentTensor(m=symmat6(1, 0, 0, 1, 0, 0)),
{'_disp_n': (0, -1), '_disp_e': (3, -1), '_disp_z': (5, -1)}),
(MomentTensor(m=symmat6(0, 0, 0, 0, 1, 1)),
{'_disp_n': (1, -1), '_disp_e': (4, -1), '_disp_z': (6, -1)}),
(MomentTensor(m=symmat6(0, 0, 1, 0, 0, 0)),
{'_disp_n': (2, -1), '_disp_z': (7, -1)}),
(MomentTensor(m=symmat6(0, 1, 0, 0, 0, 0)),
{'_disp_n': (8, -1), '_disp_z': (9, -1)}),
]
if baseconf.qssp_version == 'rot2017':
self.gfmapping = [
(MomentTensor(m=symmat6(1, 0, 0, 1, 0, 0)),
{'_rota_n': (0, -1), '_rota_e': (3, -1), '_rota_z': (5, -1)}),
@@ -1139,3 +1163,14 @@ def build(
return QSSPGFBuilder.build(
store_dir, force=force, nworkers=nworkers, continue_=continue_,
step=step, iblock=iblock)


def get_conf(
store_dir,
force=False,
nworkers=None,
continue_=False,
step=None,
iblock=None):

return QSSPGFBuilder.get_conf()

Loading…
Cancel
Save