Browse Source

rename ewrica -> siria

feature/pdf_sampling
mmetz 1 week ago
parent
commit
645f0c1ff2
  1. 5
      README.md
  2. 2
      examples/create_ensemble_files.py
  3. 580
      examples/gm/data/examples/Samos2020/DCSource/data.yaml
  4. 64004
      examples/gm/data/examples/Samos2020/DynamicRuptureSource/data.yaml
  5. 42004
      examples/gm/data/examples/Samos2020/MTSource/data.yaml
  6. 8
      examples/gm/data/examples/Samos2020/MTSource/data_one.yaml
  7. 10
      examples/gm/data/examples/Samos2020/RectangularSource/data_one.yaml
  8. 424
      examples/gm/data/examples/Samos2020/RectangularSource/data_one_long.yaml
  9. 64004
      examples/gm/data/examples/Samos2020/dynamic_rupture_np1.yaml
  10. 64004
      examples/gm/data/examples/Samos2020/dynamic_rupture_np2.yaml
  11. 42004
      examples/gm/data/examples/Samos2020/mt_source.yaml
  12. 580
      examples/gm/data/examples/Samos2020/tsumaps_DC_multilinear.yaml
  13. 580
      examples/gm/data/examples/Samos2020/tsumaps_DC_nearest_neighbor.yaml
  14. 6
      examples/gm/test.py
  15. 2
      examples/gm/test_gmpe.yaml
  16. 2
      examples/gm/test_nn_mt.yaml
  17. 2
      examples/gm/test_nn_rs.yaml
  18. 2
      examples/gm/test_pyrocko.yaml
  19. 4
      setup.py
  20. 6
      src/apps/ids.py
  21. 4
      src/apps/mole.py
  22. 16
      src/config.py
  23. 4
      src/data/README.md
  24. 420
      src/data/examples/gm/Samos2020/RectangularSource/data.yaml
  25. 420
      src/data/examples/gm/Samos2020/RectangularSource/pdr_to_rs_mf_samos.yaml
  26. 20
      src/data/examples/ids.conf
  27. 6
      src/dataset/fault_loader/active_faults.py
  28. 2
      src/dataset/fault_loader/diss.py
  29. 4
      src/dataset/fault_loader/edsf.py
  30. 4
      src/dataset/fault_loader/noafaults.py
  31. 2
      src/dataset/faults.py
  32. 70
      src/dataset/tsumaps.py
  33. 4
      src/gm/config.py
  34. 14
      src/gm/gm_mapping.py
  35. 8
      src/gm/gmpe.py
  36. 2
      src/gm/module.py
  37. 6
      src/gm/nn.py
  38. 4
      src/gm/plot.py
  39. 2
      src/gm/sources.py
  40. 2
      src/gm/util.py
  41. 2
      src/ids/config.py
  42. 12
      src/ids/core.py
  43. 8
      src/ids/dataset.py
  44. 2
      src/ids/report/base.py
  45. 4
      src/ids/report/plot.py
  46. 2
      src/ids/targets/base.py
  47. 2
      src/ids/targets/gnss.py
  48. 2
      src/ids/targets/insar.py
  49. 4
      src/ids/targets/waveform.py
  50. 22
      src/io/__init__.py
  51. 18
      src/io/grond.py
  52. 32
      src/io/ids.py
  53. 4
      src/ls/config.py
  54. 2
      src/ls/module.py
  55. 10
      src/module.py
  56. 2
      src/plot/grond.py
  57. 46
      src/plot/ids.py
  58. 66
      src/scaling.py
  59. 8
      src/si/config.py
  60. 38
      src/si/demonstrator.py
  61. 24
      src/si/invert.py
  62. 4
      src/si/module.py
  63. 130
      src/sources.py
  64. 4
      src/store.py
  65. 10
      src/util.py
  66. 2
      test/gm/test_nn_mt.yaml
  67. 2
      test/gm/test_nn_rs.yaml
  68. 2
      test/io/test_grond.py
  69. 2
      test/io/test_ids.py
  70. 8
      test/si/test_demonstrator.py
  71. 2
      test/si/test_ids.py

5
README.md

@ -1 +1,4 @@
Here could be your Readme
Siria - Package for *S*ource *I*nversion and *R*apid *I*mpact *A*ssessment
--------------------------------------------------------------------------

2
examples/create_ensemble_files.py

@ -3,7 +3,7 @@ import os
import numpy as num
from pyrocko.gf import LocalEngine, ws
from ewrica import sources as esrc
from siria import sources as esrc
# The store we are going to use for patch interpolation of the PseudoDynamicRup
store_id = 'crust2_m2'

580
examples/gm/data/examples/Samos2020/DCSource/data.yaml

File diff suppressed because it is too large Load Diff

64004
examples/gm/data/examples/Samos2020/DynamicRuptureSource/data.yaml

File diff suppressed because it is too large Load Diff

42004
examples/gm/data/examples/Samos2020/MTSource/data.yaml

File diff suppressed because it is too large Load Diff

8
examples/gm/data/examples/Samos2020/MTSource/data_one.yaml

@ -1,6 +1,6 @@
%YAML 1.1
--- !ewrica.sources.SourceHeader
help_string: "EwricaMTSource; Full moment tensor (MT) point source\n ; lat: latitude
--- !siria.sources.SourceHeader
help_string: "SiriaMTSource; Full moment tensor (MT) point source\n ; lat: latitude
of reference point [deg]; lon: longitude of reference point [deg]; north_shift:
northward cartesian offset from reference point [m]; east_shift: eastward cartesian
offset from reference point [m]; elevation: surface elevation, above sea level [m];
@ -11,7 +11,7 @@ help_string: "EwricaMTSource; Full moment tensor (MT) point source\n ; lat: l
component of moment tensor in [Nm]; mnd: north-down component of moment tensor in
[Nm]; med: east-down component of moment tensor in [Nm]; misfit: Misfit value of
the source; probability: Probability of the occurence of the source"
--- !ewrica.sources.EwricaMTSource
--- !siria.sources.SiriaMTSource
lat: 37.83341242478117
lon: 26.67652329921679
depth: 8030.320355365457
@ -27,7 +27,7 @@ mne: 1.857958884140419e+17
mnd: -3.8275956203400704e+18
med: -5.906212371970734e+18
misfit: 0.6258603975138171
--- !ewrica.sources.EwricaMTSource
--- !siria.sources.SiriaMTSource
lat: 37.83341242478117
lon: 26.67652329921679
depth: 8030.320355365457

10
examples/gm/data/examples/Samos2020/RectangularSource/data_one.yaml

@ -1,6 +1,6 @@
%YAML 1.1
--- !ewrica.sources.SourceHeader
help_string: "EwricaRectangularSource; \n Simplified constant slip rectangular
--- !siria.sources.SourceHeader
help_string: "SiriaRectangularSource; \n Simplified constant slip rectangular
fault model.\n ; lat: latitude of reference point [deg]; lon: longitude of reference
point [deg]; north_shift: northward cartesian offset from reference point [m]; east_shift:
eastward cartesian offset from reference point [m]; elevation: surface elevation,
@ -24,7 +24,7 @@ help_string: "EwricaRectangularSource; \n Simplified constant slip rectangula
for basesource discretization. When using 'multilinear' interpolation oversampling
has practically no effect.; misfit: Misfit value of the source.; probability: Probability
of the occurence of the source."
--- !ewrica.sources.EwricaRectangularSource
--- !siria.sources.SiriaRectangularSource
lat: 37.9
lon: 26.82
north_shift: 8717.319707554088
@ -50,7 +50,7 @@ velocity: 3460.0
opening_fraction: 0.0
aggressive_oversampling: false
misfit: 1.1132028519812334
--- !ewrica.sources.EwricaRectangularSource
--- !siria.sources.SiriaRectangularSource
lat: 37.9
lon: 26.82
north_shift: 8717.319707554088
@ -76,7 +76,7 @@ velocity: 3460.0
opening_fraction: 0.0
aggressive_oversampling: false
misfit: 1.1132028519812334
--- !ewrica.sources.EwricaRectangularSource
--- !siria.sources.SiriaRectangularSource
lat: 37.9
lon: 26.82
north_shift: 7844.7200353572725

424
examples/gm/data/examples/Samos2020/RectangularSource/data_one_long.yaml

File diff suppressed because it is too large Load Diff

64004
examples/gm/data/examples/Samos2020/dynamic_rupture_np1.yaml

File diff suppressed because it is too large Load Diff

64004
examples/gm/data/examples/Samos2020/dynamic_rupture_np2.yaml

File diff suppressed because it is too large Load Diff

42004
examples/gm/data/examples/Samos2020/mt_source.yaml

File diff suppressed because it is too large Load Diff

580
examples/gm/data/examples/Samos2020/tsumaps_DC_multilinear.yaml

File diff suppressed because it is too large Load Diff

580
examples/gm/data/examples/Samos2020/tsumaps_DC_nearest_neighbor.yaml

File diff suppressed because it is too large Load Diff

6
examples/gm/test.py

@ -1,5 +1,5 @@
from ewrica.gm.gm_mapping import GMMapping
import ewrica.gm.config as GMcfg
from siria.gm.gm_mapping import GMMapping
import siria.gm.config as GMcfg
print('\nTesting NN_MT:')
@ -37,4 +37,4 @@ args = GMcfg.GroundMotionConfig(config_path='test_gmpe.yaml').get_config()
directory = './data/examples/Samos2020/MTSource/'
ensemblefile = directory + '/data_one.yaml'
GMMapping(ensemblefile, directory, args)
print('Finished testing GMPE.\n')
print('Finished testing GMPE.\n')

2
examples/gm/test_gmpe.yaml

@ -1,4 +1,4 @@
--- !ewrica.gm.config.GroundMotionConfig
--- !siria.gm.config.GroundMotionConfig
run: true
config_path: ''
method: GMPE

2
examples/gm/test_nn_mt.yaml

@ -1,4 +1,4 @@
--- !ewrica.gm.config.GroundMotionConfig
--- !siria.gm.config.GroundMotionConfig
run: true
config_path: ''
method: NN

2
examples/gm/test_nn_rs.yaml

@ -1,4 +1,4 @@
--- !ewrica.gm.config.GroundMotionConfig
--- !siria.gm.config.GroundMotionConfig
run: true
config_path: ''
method: NN

2
examples/gm/test_pyrocko.yaml

@ -1,4 +1,4 @@
--- !ewrica.gm.config.GroundMotionConfig
--- !siria.gm.config.GroundMotionConfig
run: true
config_path: ''
method: Pyrocko

4
setup.py

@ -16,7 +16,7 @@ except ImportError:
return ''
packname = 'ewrica'
packname = 'siria'
version = '2022.05.30'
@ -83,7 +83,7 @@ setup(
},
packages=packages,
package_dir={'ewrica': 'src'},
package_dir={'siria': 'src'},
entry_points=entry_points,
classifiers=[
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',

6
src/apps/ids.py

@ -10,9 +10,9 @@ from argparse import ArgumentParser
from pyrocko import util
from ewrica.ids import IDSRunner, IDSConfigFull, IDSError
from siria.ids import IDSRunner, IDSConfigFull, IDSError
logger = logging.getLogger('ewrica.apps.ids')
logger = logging.getLogger('siria.apps.ids')
def d2u(d):
@ -131,7 +131,7 @@ def command_init(args):
def command_go(args):
def setup(parser):
parser.add_argument(
'config', help='ewrica.ids.config configuration file')
'config', help='siria.ids.config configuration file')
parser.add_argument(
'--force', dest='force', action='store_true',

4
src/apps/mole.py

@ -14,9 +14,9 @@ import os.path as op
from pyrocko import util
from ewrica import store
from siria import store
logger = logging.getLogger('ewrica.apps.mole')
logger = logging.getLogger('siria.apps.mole')
def d2u(d):

16
src/config.py

@ -25,26 +25,26 @@ def no_encode(s):
return s
ewrica_dir_tmpl = os.environ.get('EWRICA_DIR', op.join('~', '.ewrica'))
siria_dir_tmpl = os.environ.get('SIRIA_DIR', op.join('~', '.siria'))
def make_conf_path_tmpl(name='config'):
return op.join(ewrica_dir_tmpl, '%s.pf' % name)
return op.join(siria_dir_tmpl, '%s.pf' % name)
class EwricaConfig(ConfigBase):
class SiriaConfig(ConfigBase):
run_dir = PathWithPlaceholders.T(
default=op.join(ewrica_dir_tmpl, 'runs'),
default=op.join(siria_dir_tmpl, 'runs'),
help='Directory, where all data, results, etc. generated during '
'the run of Ewrica are stored.')
'the run of Siria are stored.')
data_dir = PathWithPlaceholders.T(
default=op.join(ewrica_dir_tmpl, 'data'),
help='Storage directory. All data needed for the runs of Ewrica as '
default=op.join(siria_dir_tmpl, 'data'),
help='Storage directory. All data needed for the runs of Siria as '
'the bayesian networks are stored here.')
config_cls = {
'config': EwricaConfig
'config': SiriaConfig
}

4
src/data/README.md

@ -1,6 +1,6 @@
# Ewrica WP2 Data repository
# Siria Data repository
Data that ships with `ewrica` is living in here.
Data that ships with `siria` is living in here.
## tsumaps_all_params.mat

420
src/data/examples/gm/Samos2020/RectangularSource/data.yaml

File diff suppressed because it is too large Load Diff

420
src/data/examples/gm/Samos2020/RectangularSource/pdr_to_rs_mf_samos.yaml

File diff suppressed because it is too large Load Diff

20
src/data/examples/ids.conf

@ -2,7 +2,7 @@
# IDS configuration
# More options can be found within the config documentations
--- !ewrica.ids.config.IDSConfigFull
--- !siria.ids.config.IDSConfigFull
# Version of IDS
ids_version: '2020'
@ -10,7 +10,7 @@ ids_version: '2020'
# Path prefix for all event, waveform and response files
# Do not set it, if you use the IDS config within the mole.
path_prefix: ''
dataset_config: !ewrica.ids.dataset.DatasetConfig
dataset_config: !siria.ids.dataset.DatasetConfig
# Path to the Pyrocko event file.
# Don't set events_path, if you use the IDS config within
# the mole. It will handle that itself
@ -32,7 +32,7 @@ dataset_config: !ewrica.ids.dataset.DatasetConfig
# Set of waveform targets. Add more, if different settings shall
# be applied for different records
waveform_config:
- !ewrica.ids.targets.waveform.WaveformTargetGroupConfig
- !siria.ids.targets.waveform.WaveformTargetGroupConfig
# List of filenames with stations, which shall not be used
# The desired format is STA, NET.STA or NET.STA.LOC, e.g. 'STA',
@ -76,13 +76,13 @@ waveform_config:
'path/to/meta/data.xml']
# IDS misfit weighting of each component (range: 0. to 1.)
component_weights: !ewrica.ids.targets.waveform.ComponentWeight
component_weights: !siria.ids.targets.waveform.ComponentWeight
north: 1.0
east: 1.0
up: 1.0
# Configuration of data restitution
restitution_config: !ewrica.ids.targets.waveform.RestitutionConfig
restitution_config: !siria.ids.targets.waveform.RestitutionConfig
# 4-tuple with corner frequencies in Hz.
frequency_limits:
@ -117,18 +117,18 @@ waveform_config:
static_weight: 0.0
# Configuration of the static GNSS records (BETA so far).
gnss_config: !ewrica.ids.targets.gnss.GNSSTargetGroupConfigFull
gnss_config: !siria.ids.targets.gnss.GNSSTargetGroupConfigFull
weight: 0.0
fn_dat: gnss_data.dat
# Configuration of the static InSAR records (BETA so far).
insar_config: !ewrica.ids.targets.insar.InSARTargetGroupConfig
insar_config: !siria.ids.targets.insar.InSARTargetGroupConfig
weight: 0.0
n_grids: 0
dat_path: ./NoInSARData.dat
# Configuration of the IDS run.
run_config: !ewrica.ids.config.RunConfig
run_config: !siria.ids.config.RunConfig
# Maximum number of IDS iterations.
n_iterations: 100
@ -146,7 +146,7 @@ run_config: !ewrica.ids.config.RunConfig
t_max_snapshots: 50.0
# Engine and further IDS configurations.
engine_config: !ewrica.ids.config.EngineConfig
engine_config: !siria.ids.config.EngineConfig
# Absolute path(s) to the IDS store directories. If multiple paths are
# given, they are all searched for the ids_waveform_store_id and
@ -176,7 +176,7 @@ engine_config: !ewrica.ids.config.EngineConfig
Z: uz
# Filter settings used within IDS main code
ids_synthetic_bp_filter: !ewrica.ids.config.FilterSetting
ids_synthetic_bp_filter: !siria.ids.config.FilterSetting
# Order of the applied buttworth band pass filter
order: 3

6
src/dataset/fault_loader/active_faults.py

@ -11,7 +11,7 @@ from collections import OrderedDict
import json
from pyrocko import util as putil
from ewrica import util
from siria import util
km = 1e3
@ -25,7 +25,7 @@ def parse_3tup(s):
return [None, None, None]
logger = logging.getLogger('ewrica.dataset.fault_loader.activefaults')
logger = logging.getLogger('siria.dataset.fault_loader.activefaults')
def active_faults_fn():
@ -123,7 +123,7 @@ class Fault(object):
raise AttributeError('Not all necessary attributes defined. Check '
'the list in '
'ewrica.dataset.fault_loader.active_faults.')
'siria.dataset.fault_loader.active_faults.')
def get_surface_line(self):
arr = num.empty((len(self.lat), 2))

2
src/dataset/fault_loader/diss.py

@ -12,7 +12,7 @@ import numpy as num
from pyrocko import orthodrome as od, moment_tensor as pmt
from pyrocko.model import Event
from ewrica.util import HiddenDataDir, is_dir
from siria.util import HiddenDataDir, is_dir
from . import SeismogenicSource
km = 1000.

4
src/dataset/fault_loader/edsf.py

@ -16,10 +16,10 @@ import datetime
from pyrocko import orthodrome as od, moment_tensor as pmt, util as putil
from pyrocko.model import Event
from ewrica.util import HiddenDataDir, is_dir
from siria.util import HiddenDataDir, is_dir
from . import SeismogenicSource
logger = logging.getLogger('ewrica.dataset.fault_loader.edsf')
logger = logging.getLogger('siria.dataset.fault_loader.edsf')
km = 1000.

4
src/dataset/fault_loader/noafaults.py

@ -11,11 +11,11 @@ from osgeo import gdal # GDAL package
from pyrocko import util as putil
from ewrica.util import HiddenDataDir, is_dir
from siria.util import HiddenDataDir, is_dir
from .active_faults import ActiveFault
from . import SeismogenicSource
logger = logging.getLogger('ewrica.dataset.fault_loader.noafaults')
logger = logging.getLogger('siria.dataset.fault_loader.noafaults')
km = 1000.

2
src/dataset/faults.py

@ -8,7 +8,7 @@ import numpy as num
from pyrocko import orthodrome as pod
logger = logging.getLogger('ewrica.dataset.faults')
logger = logging.getLogger('siria.dataset.faults')
def load_diss(*args, **kwargs):

70
src/dataset/tsumaps.py

@ -9,7 +9,7 @@ from scipy.interpolate import griddata
from pyrocko.orthodrome import points_in_region, distance_accurate50m_numpy
from ewrica import util
from siria import util
class NotInRegion(Exception):
@ -27,9 +27,10 @@ def tsumaps_file():
def load(fn=None):
'''Load tsumaps mat file into dictionary
'''
Load tsumaps mat file into dictionary.
The tsumaps mat file stored in ewrica.data is loaded. The dictionary which
The tsumaps mat file stored in siria.data is loaded. The dictionary which
is returned has three keys:
- latlon: :py:class:`numpy.ndarray`, size: `(No points, 2)
coordinates of each grid point in lat, lon
@ -38,7 +39,7 @@ def load(fn=None):
strike, dip, rake
- prob: :py:class`numpy.ndarray`, size: `(No points, No focal mecs)
probabilities for each given focal mechanism nodal plane
orientation at each point of the grid
orientation at each point of the grid.
'''
if fn is None:
fn = tsumaps_file()
@ -54,31 +55,48 @@ def get_probs(
nmodels_max=None,
*args,
**kwargs):
'''Get tsumap focal mechanism probabilites at a given location
:param lat: latitude of the chosen point in [deg]
:type lat: float
:param lon: longitude of the chosen point in [deg]
:type lon: float
:param interpolation: interpolation method to get probabilities at
`lat, lon`. Choices are:
'''
Get tsumap focal mechanism probabilites at a given location.
:param lat:
Latitude of the chosen point in [deg].
:type lat:
float
:param lon:
Longitude of the chosen point in [deg].
:type lon:
float
:param interpolation:
Interpolation method to get probabilities at `lat, lon`. Choices are:
- nearest_neighbor
- multilinear
:type interpolation: optional, string
:param cumulative_probability_max: return sorted models needed to
exceed the given cumulative probability
:type cumulative_probability_max: optional, float
:param probability_gradient_min: return sorted models needed to undercut
the given proability gradient
:type probability_gradient_min: optional, float
:param nmodels_max: return only the given number of most probable models
:type nmodels_max: optional, int
:rtype: :py:class`numpy.ndarray`, size: `(No focal mecs, 3),
:py:class`numpy.ndarray`, size: `(No focal mecs, )
:returns: Focal mechanism nodal plane orientations (strike, dip, rake) and
- multilinear.
:type interpolation:
optional, str
:param cumulative_probability_max:
Return sorted models needed to exceed the given cumulative probability.
:type cumulative_probability_max:
optional, float
:param probability_gradient_min:
Return sorted models needed to undercut the given proability gradient.
:type probability_gradient_min:
optional, float
:param nmodels_max:
Return only the given number of most probable models.
:type nmodels_max:
optional, int
:returns:
Focal mechanism nodal plane orientations (strike, dip, rake) and
the corresponding interpolated probabilities. The sum of all
probabilites is 1, if not giving any further constraint.
:rtype:
:py:class:`numpy.ndarray`, size: ``(No focal mecs, 3)``,
:py:class:`numpy.ndarray`, size: ``(No focal mecs, )``
'''
n_metrics = sum(1 for _ in filter(
None.__ne__, (

4
src/gm/config.py

@ -4,11 +4,11 @@
from pyrocko.guts import Float, String, Bool, List, Int, load, StringChoice
from ewrica.module import ModuleConfig
from siria.module import ModuleConfig
import logging
logger = logging.getLogger('ewrica.gm.config')
logger = logging.getLogger('siria.gm.config')
def get_config(*args, **kwargs):

14
src/gm/gm_mapping.py

@ -11,13 +11,13 @@ from multiprocessing import Pool, Manager
from pyrocko import gf
import ewrica.sources as ews
import siria.sources as ews
import ewrica.gm.util as GMu
import ewrica.gm.sources as GMs
import siria.gm.util as GMu
import siria.gm.sources as GMs
logger = logging.getLogger('ewrica.gm.gm_mapping')
logger = logging.getLogger('siria.gm.gm_mapping')
def GMMapping(ensemblefile, directory, args):
@ -65,7 +65,7 @@ def GMMapping(ensemblefile, directory, args):
#######################################
# Neuronal Networks
if args.method == 'NN':
import ewrica.gm.nn as GMn
import siria.gm.nn as GMn
lons = list(coords.T[0])
lats = list(coords.T[1])
@ -113,7 +113,7 @@ def GMMapping(ensemblefile, directory, args):
# GMPES
elif args.method == 'GMPE':
import ewrica.gm.gmpe as GMgmpe
import siria.gm.gmpe as GMgmpe
# Processing
xs = []
@ -255,7 +255,7 @@ Processing time ({} sources, {} points, {} processors):
#############################
if args.enable_plotting is True:
import os
import ewrica.gm.plot as GMp
import siria.gm.plot as GMp
for add in ['mean', 'wmean', 'std', 'wstd', prob_src_cnt]:
if add in ['std', 'stds', 'wstd', 'wstds']:

8
src/gm/gmpe.py

@ -14,9 +14,9 @@ from openquake.hazardlib.geo import Point, Mesh
from pyrocko import moment_tensor as pmt
import ewrica.gm.sources as gm_src
import siria.gm.sources as gm_src
logger = logging.getLogger('ewrica.gm.gmpe')
logger = logging.getLogger('siria.gm.gmpe')
#############################
@ -42,7 +42,7 @@ def create_surface(src):
return surface
def gmpe_contexts_ewrica_sources(source, coords, vs30):
def gmpe_contexts_siria_sources(source, coords, vs30):
# Rupture Params
rctx = RuptureContext()
rctx.hypo_depth = num.array([source.depth])
@ -197,7 +197,7 @@ def get_openquake_container(source, gmpes, coords, imts, freqs):
vs30 = num.zeros(len(coords)) + 800.
rctx, sctx, dctx = gmpe_contexts_ewrica_sources(source, coords, vs30)
rctx, sctx, dctx = gmpe_contexts_siria_sources(source, coords, vs30)
openquake_cont = gm_src.StationContainer(
refSource=source,

2
src/gm/module.py

@ -8,7 +8,7 @@ from ..module import BaseModule
from gm_mapping import GMMapping
logger = logging.getLogger('ewrica.gm.module')
logger = logging.getLogger('siria.gm.module')
def get_module(*args, **kwargs):

6
src/gm/nn.py

@ -15,11 +15,11 @@ from pyrocko import moment_tensor as pmt
import tensorflow as tf
import ewrica.gm.util as GMu
import ewrica.gm.sources as GMs
import siria.gm.util as GMu
import siria.gm.sources as GMs
logger = logging.getLogger('ewrica.gm.nn')
logger = logging.getLogger('siria.gm.nn')
#####

4
src/gm/plot.py

@ -14,9 +14,9 @@ from matplotlib.colors import BoundaryNorm
from mpl_toolkits import basemap
from mpl_toolkits.axes_grid1 import make_axes_locatable
import ewrica.gm.sources as GMs
import siria.gm.sources as GMs
logger = logging.getLogger('ewrica.gm.plot')
logger = logging.getLogger('siria.gm.plot')
#############################
# Plot functions

2
src/gm/sources.py

@ -17,7 +17,7 @@ from pyrocko.guts import (
from openquake.hazardlib.geo import geodetic, Point, Mesh, PlanarSurface
logger = logging.getLogger('ewrica.gm.sources')
logger = logging.getLogger('siria.gm.sources')
#############################
# Constants

2
src/gm/util.py

@ -9,7 +9,7 @@ import random
from pyrocko import orthodrome
from pyrocko import moment_tensor as pmt
logger = logging.getLogger('ewrica.gm.util')
logger = logging.getLogger('siria.gm.util')
####
# Read in ensemble file

2
src/ids/config.py

@ -15,7 +15,7 @@ from .targets import (
GNSSTargetGroupConfigFull, InSARTargetGroupConfig)
from .dataset import DatasetConfig
logger = logging.getLogger('ewrica.ids.config')
logger = logging.getLogger('siria.ids.config')
km = 1e3

12
src/ids/core.py

@ -14,14 +14,14 @@ import os.path as op
from pyrocko.guts import Object, Bool
from pyrocko.model.gnss import GNSSCampaign
from ewrica.sources import dump_sources, EwricaIDSSource, load_one_source
from ewrica.io.ids import (
from siria.sources import dump_sources, SiriaIDSSource, load_one_source
from siria.io.ids import (
load_ids_source, load_obssyn, load_obssyn_gnss, WaveformResultList)
from .config import IDSConfigFull
from .dataset import Dataset
from .targets import WaveformTargetGroup, GNSSTargetGroup, InSARTargetGroup
logger = logging.getLogger('ewrica.ids.core')
logger = logging.getLogger('siria.ids.core')
km = 1e3
@ -40,7 +40,7 @@ class IDSRunner(Object):
config = IDSConfigFull.T(
default=IDSConfigFull())
source = EwricaIDSSource.T(optional=True)
source = SiriaIDSSource.T(optional=True)
keep_tmp = Bool.T(default=False)
@ -292,7 +292,7 @@ class IDSRunner(Object):
Available ids backends and download links to the modelling codes are listed
on
https://git.pyrocko.org/wanderelch/ewrica
https://git.pyrocko.org/wanderelch/siria
''' % program)
@ -419,7 +419,7 @@ in the directory %s'''.lstrip() % (
return source
def report(self, cwd='.'):
from ewrica.ids.report import create_report
from siria.ids.report import create_report
source = load_one_source(filename=self.sourcefile)
waveform_result = WaveformResultList.load(filename=self.tracefile)

8
src/ids/dataset.py

@ -17,7 +17,7 @@ from pyrocko.gf.meta import OutOfBounds
from .targets import \
WaveformTargetGroup, GNSSTargetGroup, InSARTargetGroup, TargetGroupConfig
logger = logging.getLogger('ewrica.ids.dataset')
logger = logging.getLogger('siria.ids.dataset')
km = 1e3
@ -789,9 +789,9 @@ duration: {} -> {}
config = self.config
if config.subfault_path is None and config.fault_database is not None:
from ewrica.io import ids as idsio
from ewrica.dataset import faults as faultio
from ewrica.dataset.fault_loader import edsf
from siria.io import ids as idsio
from siria.dataset import faults as faultio
from siria.dataset.fault_loader import edsf
if config.subfault_path is not None:
logger.info('Found subfault data at {} ...'.format(

2
src/ids/report/base.py

@ -9,7 +9,7 @@ import logging
from .plot import plot_classes, plot_classes_gnss
logger = logging.getLogger('ewrica.ids.report.base')
logger = logging.getLogger('siria.ids.report.base')
path_event = op.join('{reportdir}', '{event_name}')

4
src/ids/report/plot.py

@ -12,9 +12,9 @@ from pyrocko.plot.automap import gmtpy
from pyrocko.util import tts
from pyrocko.cake import m2d
from ewrica.plot import ids as idsplot, nice_plot_simple
from siria.plot import ids as idsplot, nice_plot_simple
logger = logging.getLogger('ewrica.ids.report.plot')
logger = logging.getLogger('siria.ids.report.plot')
mpl_init(fontsize=15)

2
src/ids/targets/base.py

@ -7,7 +7,7 @@ import os.path as op
from pyrocko.guts import Object, List, String
logger = logging.getLogger('ewrica.ids.targets.base')
logger = logging.getLogger('siria.ids.targets.base')
class TargetError(Exception):

2
src/ids/targets/gnss.py

@ -10,7 +10,7 @@ from pyrocko.guts import Float, List, String
from .base import TargetGroupConfig, TargetGroup
logger = logging.getLogger('ewrica.ids.targets.gnss')
logger = logging.getLogger('siria.ids.targets.gnss')
class GNSSTargetGroupConfig(TargetGroupConfig):

2
src/ids/targets/insar.py

@ -7,7 +7,7 @@ from pyrocko.guts import Float, List, Int, String
from .base import TargetGroup, TargetGroupConfig
logger = logging.getLogger('ewrica.ids.targets.insar')
logger = logging.getLogger('siria.ids.targets.insar')
class InSARTargetGroupConfig(TargetGroupConfig):

4
src/ids/targets/waveform.py

@ -10,10 +10,10 @@ from pyrocko import orthodrome as pod, gf, marker, pile
from pyrocko.guts import Float, List, String, Tuple, StringChoice, Object
from pyrocko.io import stationxml
from ewrica import util
from siria import util
from .base import TargetGroupConfig, TargetGroup
logger = logging.getLogger('ewrica.ids.targets.waveform')
logger = logging.getLogger('siria.ids.targets.waveform')
km = 1e3

22
src/io/__init__.py

@ -5,7 +5,7 @@ import json
import numpy as num
from pyrocko.gf import STF
from ewrica.sources import EwricaIDSSTF, EwricaIDSLog, EwricaIDSPatch
from siria.sources import SiriaIDSSTF, SiriaIDSLog, SiriaIDSPatch
def _unpack_num_array(array):
@ -19,7 +19,7 @@ def _unpack_num_array(array):
return [v for v in array]
def _unpack_ewrica_ids_feature(feature):
def _unpack_siria_ids_feature(feature):
cls_name = feature.T.classname
out = {k: v for k, v in feature.__dict__.items()}
out['cls'] = cls_name
@ -39,12 +39,12 @@ def _unpack_ewrica_ids_feature(feature):
return out
def _unpack_ewrica_stf(stf):
return _unpack_ewrica_ids_feature(stf)
def _unpack_siria_stf(stf):
return _unpack_siria_ids_feature(stf)
def _unpack_ewrica_ids_log(log):
return _unpack_ewrica_ids_feature(log)
def _unpack_siria_ids_log(log):
return _unpack_siria_ids_feature(log)
def _unpack_patches(patches):
@ -66,8 +66,8 @@ def _unpack_patches(patches):
val[k] = vv
elif isinstance(vv, (EwricaIDSSTF, EwricaIDSLog)):
val[k] = _unpack_ewrica_ids_feature(vv)
elif isinstance(vv, (SiriaIDSSTF, SiriaIDSLog)):
val[k] = _unpack_siria_ids_feature(vv)
out.append(val)
@ -107,10 +107,10 @@ def sources_to_json(sources):
val = val.__dict__
val['cls'] = cls_name
elif isinstance(val, (EwricaIDSSTF, EwricaIDSLog)):
val = _unpack_ewrica_ids_feature(val)
elif isinstance(val, (SiriaIDSSTF, SiriaIDSLog)):
val = _unpack_siria_ids_feature(val)
elif isinstance(val, list) and type(val[0]) == EwricaIDSPatch:
elif isinstance(val, list) and type(val[0]) == SiriaIDSPatch:
val = _unpack_patches(val)
elif isinstance(val, num.bool_):

18
src/io/grond.py

@ -10,7 +10,7 @@ from grond.problems.base import ProblemDataNotAvailable
from pyrocko import guts # noqa
logger = logging.getLogger('ewrica.io.grond')
logger = logging.getLogger('siria.io.grond')
def get_problem_and_history(rundir, subset='harvest'):
@ -56,7 +56,7 @@ def get_ensemble_sources_and_misfit(*args, **kwargs):
Return all tested sources and corresponding misfit from a Grond run.
Arguments and keyword arguments for
:py:func:`ewrica.io.grond.get_problem_and_history` need to be defined.
:py:func:`siria.io.grond.get_problem_and_history` need to be defined.
:returns:
Tested sorted sources, sorted misfits (starting with smallest).
@ -76,7 +76,7 @@ def get_best_source_and_misfit(*args, **kwargs):
Return best tested source and corresponding misfit from a Grond run.
Arguments and keyword arguments for
:py:func:`ewrica.io.grond.get_problem_and_history` need to be defined
:py:func:`siria.io.grond.get_problem_and_history` need to be defined
:returns:
Best source, corresponding misfit.
@ -93,7 +93,7 @@ def get_mean_source_and_misfit(*args, **kwargs):
Return mean tested source and corresponding misfit from a Grond run.
Arguments and keyword arguments for
:py:func:`ewrica.io.grond.get_problem_and_history` need to be defined.
:py:func:`siria.io.grond.get_problem_and_history` need to be defined.
:returns:
Mean source, corresponding misfit.
@ -108,7 +108,7 @@ def get_mean_source_and_misfit(*args, **kwargs):
def pyrocko_to_sources(sources, misfits):
'''
Convert source and misfits into ewrica.sources of appropiate type.
Convert source and misfits into siria.sources of appropiate type.
Misfits are allocated with the corresponding sources models
@ -127,7 +127,7 @@ def pyrocko_to_sources(sources, misfits):
:rtype:
list, :py:class:`numpy.ndarray`
'''
from ewrica import sources as ewsources
from siria import sources as ewsources
base_class = None
for src_cls in ewsources.source_classes:
@ -136,7 +136,7 @@ def pyrocko_to_sources(sources, misfits):
if base_class is None:
raise TypeError(
'Could find a Ewrica source equivalent for the Grond source model')
'Could find a Siria source equivalent for the Grond source model')
return [
base_class(
@ -147,11 +147,11 @@ def pyrocko_to_sources(sources, misfits):
def grond_to_sources(*args, **kwargs):
'''
Convert grond history into ewrica.sources of appropiate type.
Convert grond history into siria.sources of appropiate type.
Misfits are allocated with the corresponding sources models
Arguments and keyword arguments for
:py:func:`ewrica.io.grond.get_problem_and_history` need to be defined.
:py:func:`siria.io.grond.get_problem_and_history` need to be defined.
:returns:
Tested sorted sources, sorted misfits (starting with smallest)

32
src/io/ids.py

@ -17,13 +17,13 @@ from pyrocko.model import \
from pyrocko.trace import Trace, snuffle
from pyrocko.gf.seismosizer import map_anchor, Location
from ewrica.sources import (EwricaIDSSource, EwricaIDSPatch, EwricaIDSSTF,
EwricaIDSLog)
from siria.sources import (SiriaIDSSource, SiriaIDSPatch, SiriaIDSSTF,
SiriaIDSLog)
op = os.path
logger = logging.getLogger('ewrica.io.ids')
logger = logging.getLogger('siria.io.ids')
km = 1e3
@ -469,7 +469,7 @@ def load_patch_stf_file(fn):
'''Load all information from PT_STF.dat patch source time function file
The patch order is the same as in the corresponding slipmodel.dat file (
see :py:func:`ewrica.io.ids.load_slipmodel_file`). Here only the relative
see :py:func:`siria.io.ids.load_slipmodel_file`). Here only the relative
time after event origin time and the corresponding patch moment rates are
given.
@ -537,8 +537,8 @@ def load_rupture_front_file(fn):
'''Load all information from Rup_Front.dat rupture front file
Here only the relative time after event origin time is given. The order of
patches is not the same as in :py:func:`ewrica.io.ids.load_patch_stf_file`
or :py:func:`ewrica.io.ids.load_slipmodel_file`.
patches is not the same as in :py:func:`siria.io.ids.load_patch_stf_file`
or :py:func:`siria.io.ids.load_slipmodel_file`.
:param fn: filename of the rupture front file
:type fn: str
@ -579,7 +579,7 @@ def load_idslog_file(fn):
:type fn: str
:returns: Detailed IDS Log information
:rtype: :py:class:`ewrica.sources.EwricaIDSLog`
:rtype: :py:class:`siria.sources.SiriaIDSLog`
'''
forward_modeling = False
@ -612,7 +612,7 @@ def load_idslog_file(fn):
nrv_gns='gnss',
nrv_sar='insar')
log = EwricaIDSLog(
log = SiriaIDSLog(
misfit_all=num.array(
[i[names.index('nrv_all')] for i in data]).astype(num.float),
misfit_subsets={
@ -884,7 +884,7 @@ def load_rectangular_source(
patches = []
for ip in range(lats.shape[0]):
stf = EwricaIDSSTF(deltat=deltat, amplitudes=patch_stfs[:, ip])
stf = SiriaIDSSTF(deltat=deltat, amplitudes=patch_stfs[:, ip])
stf_moment = stf.moment
time = None
@ -906,7 +906,7 @@ def load_rectangular_source(
stf.amplitudes *= moments[ip] / stf_moment
patches.append(EwricaIDSPatch(
patches.append(SiriaIDSPatch(
lat=float(anch_lat),
lon=float(anch_lon),
time=time,
@ -924,7 +924,7 @@ def load_rectangular_source(
anchor='center',
stf=stf))
source = EwricaIDSSource(
source = SiriaIDSSource(
curved=False,
lat=float(anch_lat),
lon=float(anch_lon),
@ -974,7 +974,7 @@ def load_curved_source(
patches = []
for ip in range(lats.shape[0]):
stf = EwricaIDSSTF(deltat=deltat, amplitudes=patch_stfs[:, ip])
stf = SiriaIDSSTF(deltat=deltat, amplitudes=patch_stfs[:, ip])
stf_moment = stf.moment
time = None
@ -996,7 +996,7 @@ def load_curved_source(
stf.amplitudes *= moments[ip] / stf_moment
patches.append(EwricaIDSPatch(
patches.append(SiriaIDSPatch(
lat=float(anch_lat),
lon=float(anch_lon),
time=time,
@ -1014,7 +1014,7 @@ def load_curved_source(
anchor='center',
stf=stf))
source = EwricaIDSSource(
source = SiriaIDSSource(
curved=True,
lat=float(anch_lat),
lon=float(anch_lon),
@ -1043,9 +1043,9 @@ def load_ids_source(config_fn):
:param config_fn: filename of the ids config file
:type config_fn: str
:returns: Ewrica IDS Source object with as mutch information converted as
:returns: Siria IDS Source object with as mutch information converted as
possible
:rtype: :py:class:`ewrica.sources.EwricaIDSSource`
:rtype: :py:class:`siria.sources.SiriaIDSSource`
'''
config = load_ids_config_file(config_fn)

4
src/ls/config.py

@ -3,10 +3,10 @@
# The Developers, 21st Century
import logging
from ewrica.module import ModuleConfig
from siria.module import ModuleConfig
logger = logging.getLogger('ewrica.ls.config')
logger = logging.getLogger('siria.ls.config')
def get_config(*args, **kwargs):

2
src/ls/module.py

@ -6,7 +6,7 @@ import logging