Browse Source

ids: handle ppicks

pull/4/head
mmetz 4 months ago
parent
commit
b2f8116892
  1. 5
      src/io/ids.py
  2. 18
      src/plot/ids.py
  3. 1
      src/si/ids/core.py
  4. 3
      src/si/ids/report/base.py
  5. 12
      src/si/ids/report/plot.py
  6. 6
      src/si/ids/targets/waveform.py

5
src/io/ids.py

@ -1001,8 +1001,9 @@ def load_ids_source(config_fn):
rundir=rundir)
curved = False
if len(set(strike)) > 1 or len(set(dip)) > 1 or len(set(rake)) or
len(set(lns)) > 1 or len(set(wds)) > 1:
if (len(set(strikes)) > 1 or len(set(dips)) > 1 or len(set(rakes)) or
len(set(lns)) > 1 or len(set(wds)) > 1):
curved = True
if curved:

18
src/plot/ids.py

@ -689,18 +689,16 @@ class RuptureMap(Map):
patches = source.patches
if source.curved:
assert num.testing.assert_allclose(
source.lat, [p.lat for p in patches])
assert num.testing.assert_allclose(
source.lon, [p.lon for p in patches])
num.testing.assert_allclose(source.lat, [p.lat for p in patches])
num.testing.assert_allclose(source.lon, [p.lon for p in patches])
self._irregular_data_to_grid(
[p.north_shifts for p in patches],
[p.east_shifts for p in patches],
[p.lengths for p in patches],
[p.widths for p in patches],
[p.strikes for p in patches],
[p.dips for p in patches],
[p.north_shift for p in patches],
[p.east_shift for p in patches],
[p.length for p in patches],
[p.width for p in patches],
[p.strike for p in patches],
[p.dip for p in patches],
data,
*args,
**kwargs)

1
src/si/ids/core.py

@ -323,6 +323,7 @@ in the directory %s'''.lstrip() % (
os.chdir(old_wd)
def harvest(self, force=False):
# TODO return directory back, if error occurs
source = load_ids_source(self._input_fn)
source.name = self.config.dataset_config.event_name

3
src/si/ids/report/base.py

@ -91,6 +91,9 @@ def create_report(
for cl in classes:
cl, group, items = cl().make(**kwargs_plot)
if items is None:
continue
logger.info('Working on %s ...', group.title)
cls_path = op.join(path, cl.name)

12
src/si/ids/report/plot.py

@ -9,6 +9,7 @@ from pyrocko.plot import mpl_init, mpl_margins, mpl_papersize, mpl_graph_color
from pyrocko.plot.automap import gmtpy
from pyrocko.util import tts
from ewrica.scaling import length_blaser
from ewrica.plot import ids as idsplot, nice_plot_simple
mpl_init(fontsize=15)
@ -50,10 +51,17 @@ class GMTPlot(Plot):
show_topo = Bool.T(default=False)
def basemap(self, source):
length = source.length
if not length:
length = num.mean([
length_blaser(source.magnitude, rake)
for rake in [0., 90., 180.]])
return idsplot.RuptureMap(
source=source,
lat=source.lat, lon=source.lon,
radius=source.length,
lat=source.lat,
lon=source.lon,
radius=length,
show_topo=self.show_topo,
show_grid=self.show_grid)

6
src/si/ids/targets/waveform.py

@ -98,13 +98,11 @@ class WaveformTargetGroupConfig(TargetGroupConfig):
help='Paths to station response files')
pphase = String.T(
default='{stored:any_P}',
optional=True,
help='Phase id of the P phase arrival of the given store (needed, if '
'no picks are provided.')
store_id = String.T(
default='ak135_2000km_1Hz',
optional=True,
help='Phase id of the P phase arrival of the given store (needed, if '
'no picks are provided.')
@ -284,8 +282,8 @@ class WaveformTargetGroup(TargetGroup):
arrivals += markers
else:
raise ValueError('Argument "ppicks" is mutually exclusive '
'with "phase" and "store_id".')
raise ValueError('Argument "ppicks_paths" is mutually exclusive '
'with "pphase" and "store_id".')
arrivals = {(ar.nslc_ids[0][:3]): ar for ar in arrivals}

Loading…
Cancel
Save