Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 182 additions & 0 deletions tests/test_realisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,97 @@ def test_srf_config_example(tmp_path: Path) -> None:
xmag_exp=None,
kx_corner=None,
ky_corner=None,
beta_asp=0.3,
beta_deep=0.13,
beta_mid=0.13,
beta_mid_depth=6.5,
beta_mid_depth_range=1.5,
beta_shal=0.5,
beta_shal_depth=2.0,
beta_shal_depth_range=1.0,
beta_subevt=0.1,
deep_risetimedep=17.5,
deep_risetimedep_range=2.5,
deep_risetimefac=2.0,
risetimedep=6.5,
risetimedep_range=1.5,
risetimefac=2.0,
rt_rand=0.0,
rt_scalefac=1.0,
stype=None,
hyb_corlen_deep_wt_end=1.0,
hyb_corlen_deep_wt_start=0.0,
hyb_corlen_dep=6.5,
hyb_corlen_dep_range=1.5,
hyb_corlen_fac=2.0,
hyb_corlen_flag=False,
hyb_corlen_kmodel=5.0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
hyb_corlen_kmodel=5.0,
hyb_corlen_kmodel=KModel.SUZUKI,

hyb_corlen_shal_wt_end=0.0,
hyb_corlen_shal_wt_start=1.0,
hyb_corlen_side_taper=0.08,
fdrup_scale_slip=False,
fdrup_time=False,
rupture_delay=0.0,
rvfmax=1.414,
rvfmin=0.25,
rvfrac_slip_sig=None,
truncate_zero_slip=True,
slip_water_level=None,
rake_sigma=15.0,
fractal_rake=False,
tsfac1_scor=0.8,
tsfac1_sigma=1.0,
tsfac2_lambda_max=5.0,
tsfac2_lambda_min=None,
tsfac2_scor=0.5,
tsfac2_sigma=1.0,
tsfac_bzero=-0.1,
tsfac_coef=1.1,
tsfac_main=None,
tsfac_slope=-0.5,
circular_average=False,
kmodel=2.0,
kord=4.0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KModel enum, make kord int

magC=6.3,
mag_area_Acoef=None,
mag_area_Bcoef=None,
mai_wt=0.5,
modified_corners=False,
somerville_wt=0.5,
stretch_kcorner=False,
use_gaus=True,
use_median_mag=False,
lambda_max=None,
lambda_min=None,
roughnessfile=None,
wavelength_max=None,
wavelength_min=None,
asp_taper_fac=0.05,
extend_fac=None,
flen_max=None,
fwid_max=None,
init_slip_file=None,
moment_fraction=None,
perturb_subfault_location=True,
rand_rake_degs=60.0,
read_slip_file=False,
rtime1_depth=2.0,
rtime1_depth_range=1.0,
rtime1_scor=0.8,
rtime1_sigma=0.85,
rtime2_scor=0.5,
rtime2slip_exp=0.5,
rtime_rand=None,
set_rake=None,
svr_wt=0.0,
target_savg=None,
use_Mw=True,
aseis_flag=False,
aseis_smooth=False,
aseis_dep=10.0,
aseis_fac=None,
xshift=0.0,
yshift=0.0,
)

realisation_ffp = tmp_path / "realisation.json"
Expand Down Expand Up @@ -174,6 +265,97 @@ def test_srf_config_example(tmp_path: Path) -> None:
"xmag_exp": None,
"kx_corner": None,
"ky_corner": None,
"beta_asp": 0.3,
"beta_deep": 0.13,
"beta_mid": 0.13,
"beta_mid_depth": 6.5,
"beta_mid_depth_range": 1.5,
"beta_shal": 0.5,
"beta_shal_depth": 2.0,
"beta_shal_depth_range": 1.0,
"beta_subevt": 0.1,
"deep_risetimedep": 17.5,
"deep_risetimedep_range": 2.5,
"deep_risetimefac": 2.0,
"risetimedep": 6.5,
"risetimedep_range": 1.5,
"risetimefac": 2.0,
"rt_rand": 0.0,
"rt_scalefac": 1.0,
"stype": None,
"hyb_corlen_deep_wt_end": 1.0,
"hyb_corlen_deep_wt_start": 0.0,
"hyb_corlen_dep": 6.5,
"hyb_corlen_dep_range": 1.5,
"hyb_corlen_fac": 2.0,
"hyb_corlen_flag": False,
"hyb_corlen_kmodel": 5.0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"hyb_corlen_kmodel": 5.0,
"hyb_corlen_kmodel": KModel.SUZUKI,

"hyb_corlen_shal_wt_end": 0.0,
"hyb_corlen_shal_wt_start": 1.0,
"hyb_corlen_side_taper": 0.08,
"fdrup_scale_slip": False,
"fdrup_time": False,
"rupture_delay": 0.0,
"rvfmax": 1.414,
"rvfmin": 0.25,
"rvfrac_slip_sig": None,
"truncate_zero_slip": True,
"slip_water_level": None,
"rake_sigma": 15.0,
"fractal_rake": False,
"tsfac1_scor": 0.8,
"tsfac1_sigma": 1.0,
"tsfac2_lambda_max": 5.0,
"tsfac2_lambda_min": None,
"tsfac2_scor": 0.5,
"tsfac2_sigma": 1.0,
"tsfac_bzero": -0.1,
"tsfac_coef": 1.1,
"tsfac_main": None,
"tsfac_slope": -0.5,
"circular_average": False,
"kmodel": 2.0,
"kord": 4.0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KModel enum, make kord int

"magC": 6.3,
"mag_area_Acoef": None,
"mag_area_Bcoef": None,
"mai_wt": 0.5,
"modified_corners": False,
"somerville_wt": 0.5,
"stretch_kcorner": False,
"use_gaus": True,
"use_median_mag": False,
"lambda_max": None,
"lambda_min": None,
"roughnessfile": None,
"wavelength_max": None,
"wavelength_min": None,
"asp_taper_fac": 0.05,
"extend_fac": None,
"flen_max": None,
"fwid_max": None,
"init_slip_file": None,
"moment_fraction": None,
"perturb_subfault_location": True,
"rand_rake_degs": 60.0,
"read_slip_file": False,
"rtime1_depth": 2.0,
"rtime1_depth_range": 1.0,
"rtime1_scor": 0.8,
"rtime1_sigma": 0.85,
"rtime2_scor": 0.5,
"rtime2slip_exp": 0.5,
"rtime_rand": None,
"set_rake": None,
"svr_wt": 0.0,
"target_savg": None,
"use_Mw": True,
"aseis_flag": False,
"aseis_smooth": False,
"aseis_dep": 10.0,
"aseis_fac": None,
"xshift": 0.0,
"yshift": 0.0,
},
}

Expand Down
162 changes: 162 additions & 0 deletions tests/test_realisation_to_srf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,97 @@ def test_build_genslip_command_static_args() -> None:
xmag_exp=1.0,
kx_corner=None,
ky_corner=None,
beta_asp=0.3,
beta_deep=0.13,
beta_mid=0.13,
beta_mid_depth=6.5,
beta_mid_depth_range=1.5,
beta_shal=0.5,
beta_shal_depth=2.0,
beta_shal_depth_range=1.0,
beta_subevt=0.1,
deep_risetimedep=17.5,
deep_risetimedep_range=2.5,
deep_risetimefac=2.0,
risetimedep=6.5,
risetimedep_range=1.5,
risetimefac=2.0,
rt_rand=0.0,
rt_scalefac=1.0,
stype=None,
hyb_corlen_deep_wt_end=1.0,
hyb_corlen_deep_wt_start=0.0,
hyb_corlen_dep=6.5,
hyb_corlen_dep_range=1.5,
hyb_corlen_fac=2.0,
hyb_corlen_flag=False,
hyb_corlen_kmodel=5.0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
hyb_corlen_kmodel=5.0,
hyb_corlen_kmodel=KModel.SUZUKI,

hyb_corlen_shal_wt_end=0.0,
hyb_corlen_shal_wt_start=1.0,
hyb_corlen_side_taper=0.08,
fdrup_scale_slip=False,
fdrup_time=False,
rupture_delay=0.0,
rvfmax=1.414,
rvfmin=0.25,
rvfrac_slip_sig=None,
truncate_zero_slip=True,
slip_water_level=None,
rake_sigma=15.0,
fractal_rake=False,
tsfac1_scor=0.8,
tsfac1_sigma=1.0,
tsfac2_lambda_max=5.0,
tsfac2_lambda_min=None,
tsfac2_scor=0.5,
tsfac2_sigma=1.0,
tsfac_bzero=-0.1,
tsfac_coef=1.1,
tsfac_main=None,
tsfac_slope=-0.5,
circular_average=False,
kmodel=2.0,
kord=4.0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KModel enum, make kord int

magC=6.3,
mag_area_Acoef=None,
mag_area_Bcoef=None,
mai_wt=0.5,
modified_corners=False,
somerville_wt=0.5,
stretch_kcorner=False,
use_gaus=True,
use_median_mag=False,
lambda_max=None,
lambda_min=None,
roughnessfile=None,
wavelength_max=None,
wavelength_min=None,
asp_taper_fac=0.05,
extend_fac=None,
flen_max=None,
fwid_max=None,
init_slip_file=None,
moment_fraction=None,
perturb_subfault_location=True,
rand_rake_degs=60.0,
read_slip_file=False,
rtime1_depth=2.0,
rtime1_depth_range=1.0,
rtime1_scor=0.8,
rtime1_sigma=0.85,
rtime2_scor=0.5,
rtime2slip_exp=0.5,
rtime_rand=None,
set_rake=None,
svr_wt=0.0,
target_savg=None,
use_Mw=True,
aseis_flag=False,
aseis_smooth=False,
aseis_dep=10.0,
aseis_fac=None,
xshift=0.0,
yshift=0.0,
)
genslip_path = Path("genslip_v5.6.2")
gsf_path = Path("/tmp/fault.gsf")
Expand Down Expand Up @@ -94,4 +185,75 @@ def test_build_genslip_command_static_args() -> None:
"deep_vrup=0.7",
"deep_vrup_dep=20.0",
"deep_vrup_deprange=2.5",
# New genslip parameters
"beta_asp=0.3",
"beta_deep=0.13",
"beta_mid=0.13",
"beta_mid_depth=6.5",
"beta_mid_depth_range=1.5",
"beta_shal=0.5",
"beta_shal_depth=2.0",
"beta_shal_depth_range=1.0",
"beta_subevt=0.1",
"deep_risetimedep=17.5",
"deep_risetimedep_range=2.5",
"deep_risetimefac=2.0",
"risetimedep=6.5",
"risetimedep_range=1.5",
"risetimefac=2.0",
"rt_rand=0.0",
"rt_scalefac=1.0",
"hyb_corlen_deep_wt_end=1.0",
"hyb_corlen_deep_wt_start=0.0",
"hyb_corlen_dep=6.5",
"hyb_corlen_dep_range=1.5",
"hyb_corlen_fac=2.0",
"hyb_corlen_flag=0",
"hyb_corlen_kmodel=5.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"hyb_corlen_kmodel=5.0",
"hyb_corlen_kmodel=KModel.SUZUKI",

"hyb_corlen_shal_wt_end=0.0",
"hyb_corlen_shal_wt_start=1.0",
"hyb_corlen_side_taper=0.08",
"fdrup_scale_slip=0",
"fdrup_time=0",
"rupture_delay=0.0",
"rvfmax=1.414",
"rvfmin=0.25",
"truncate_zero_slip=1",
"rake_sigma=15.0",
"fractal_rake=0",
"tsfac1_scor=0.8",
"tsfac1_sigma=1.0",
"tsfac2_lambda_max=5.0",
"tsfac2_scor=0.5",
"tsfac2_sigma=1.0",
"tsfac_bzero=-0.1",
"tsfac_coef=1.1",
"tsfac_slope=-0.5",
"circular_average=0",
"kmodel=2.0",
"kord=4.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KModel enum, make kord int

"magC=6.3",
"mai_wt=0.5",
"modified_corners=0",
"somerville_wt=0.5",
"stretch_kcorner=0",
"use_gaus=1",
"use_median_mag=0",
"asp_taper_fac=0.05",
"perturb_subfault_location=1",
"rand_rake_degs=60.0",
"read_slip_file=0",
"rtime1_depth=2.0",
"rtime1_depth_range=1.0",
"rtime1_scor=0.8",
"rtime1_sigma=0.85",
"rtime2_scor=0.5",
"rtime2slip_exp=0.5",
"svr_wt=0.0",
"use_Mw=1",
"aseis_flag=0",
"aseis_smooth=0",
"aseis_dep=10.0",
"xshift=0.0",
"yshift=0.0",
}
Loading
Loading