Add remaining Genslip parameters to SRFConfig#93
Conversation
…tests Co-authored-by: lispandfound <12835929+lispandfound@users.noreply.github.com>
Testing InstructionsTo test that your defaults are validated by your schema:
There are a couple of tests that use the |
| Literal( | ||
| "kmodel", | ||
| description="Kinematic model index: 1=SOMERVILLE_FLAG, 2=MAI_FLAG, -1=INPUT_CORNERS_FLAG.", | ||
| ): And(NUMBER, _is_positive), |
There was a problem hiding this comment.
This should be an Enum. Definitely not a float.
There was a problem hiding this comment.
Something like:
class KModel(Enum):
SOMERVILLE = 1
MAI = 2
FRANKEL = 3
MAI_SOMERVILLE 4
SUZUKI = 5
INPUT_CORNERS = -1
There was a problem hiding this comment.
Use(KModel)
Not, And(NUMBER, _is_positive)
| Literal( | ||
| "roughnessfile", | ||
| description="Path to roughness file (null = no file).", | ||
| ): Or(str, None), |
There was a problem hiding this comment.
Remove this, it should be passed as a command line argument (at a later date). Make sure it is removed from the tests and yaml defaults as well.
| Literal( | ||
| "stype", | ||
| description="Slip time function type for genslip (null = use genslip default).", | ||
| ): Or(str, None), |
There was a problem hiding this comment.
This should use the SType StrEnum that Andrew wrote.
| Literal( | ||
| "rvfmax", | ||
| description="Maximum rupture velocity fraction.", | ||
| ): And(NUMBER, _is_positive), | ||
| Literal( | ||
| "rvfmin", | ||
| description="Minimum rupture velocity fraction.", | ||
| ): And(NUMBER, _is_positive), | ||
| Literal( | ||
| "rvfrac_slip_sig", | ||
| description="Rupture velocity fraction slip sigma (null = disabled).", | ||
| ): Or(NUMBER, None), |
There was a problem hiding this comment.
These should be moved to RuptureVelocity config (because they may be synced with HF rupture velocity values at a later date).
| Literal( | ||
| "init_slip_file", | ||
| description="Path to initial slip file (null = no file).", | ||
| ): Or(str, None), |
There was a problem hiding this comment.
This should also be a command line argument (we will add it at a later date). So this default should be removed.
| Literal( | ||
| "hyb_corlen_kmodel", | ||
| description="Hybrid correlation length k-model index.", | ||
| ): And(NUMBER, _is_positive), |
There was a problem hiding this comment.
| ): And(NUMBER, _is_positive), | |
| ): Use(KModel), |
| hyb_corlen_dep_range=1.5, | ||
| hyb_corlen_fac=2.0, | ||
| hyb_corlen_flag=False, | ||
| hyb_corlen_kmodel=5.0, |
There was a problem hiding this comment.
| hyb_corlen_kmodel=5.0, | |
| hyb_corlen_kmodel=KModel.SUZUKI, |
| "hyb_corlen_dep_range": 1.5, | ||
| "hyb_corlen_fac": 2.0, | ||
| "hyb_corlen_flag": False, | ||
| "hyb_corlen_kmodel": 5.0, |
There was a problem hiding this comment.
| "hyb_corlen_kmodel": 5.0, | |
| "hyb_corlen_kmodel": KModel.SUZUKI, |
| hyb_corlen_dep_range=1.5, | ||
| hyb_corlen_fac=2.0, | ||
| hyb_corlen_flag=False, | ||
| hyb_corlen_kmodel=5.0, |
There was a problem hiding this comment.
| hyb_corlen_kmodel=5.0, | |
| hyb_corlen_kmodel=KModel.SUZUKI, |
| "hyb_corlen_dep_range=1.5", | ||
| "hyb_corlen_fac=2.0", | ||
| "hyb_corlen_flag=0", | ||
| "hyb_corlen_kmodel=5.0", |
There was a problem hiding this comment.
| "hyb_corlen_kmodel=5.0", | |
| "hyb_corlen_kmodel=KModel.SUZUKI", |
The codebase exposed only a small subset of genslip v5.6.2 parameters. This adds the full parameter set with correct defaults extracted from the genslip source.
Changes
defaults.yaml: ~90 new parameters added undersrf:, grouped by category (rise time, hybrid correlation length, rupture velocity, tapering, time shift factors, kinematic models, roughness/wavelength, miscellaneous, aseismic)schemas.py:SRF_SCHEMAextended with validators for all new fieldsrealisations.py:SRFConfigdataclass extended with typed fields and docstrings for all new parameterstest_srf_config_exampleandtest_build_genslip_command_static_argsupdated to cover all new fieldsDesign decisions
0/1flagsbool0/1in command-1,-999,1e15sentinelsNone_build_genslip_commandkmodel,kord)floatNUMBERcoerces to float; passed as2.0etc.str | NoneNoneAll new parameters flow through the existing
_build_genslip_commandserialisation loop without modification.Original prompt
This section details on the original issue you should resolve
<issue_title>Add remaining Genslip parameters into the codebase</issue_title>
<issue_description>Currently we expose a limited subset of genslip parameters in the code base, but we could do to add the rest. Here are the default values in YAML format that I have extracted from
genslip_v5.6.2.c:The tasks to complete this feature would be as follows:
defaults.yamlfile: here.realisation-to-srfwith an input realisation. You could probably steal one from Cesar or Ayushi and update it using the migration tool on your new branch. The genslip command is built automatically from the realisation config in _build_genslip_command.</issue_description>
<agent_instructions>You may use these defaults for named constants
#define DEFAULT_DHYPO_FRAC 0.75 /* hypo at 0.75 down-dip width /
#define DEFAULT_SHYPO_STEP 20.0 / hypo spacing at 20 km along strike /
#define DEFAULT_SHYPO_MIN_OFF 1.0 / hypos start at 1.0 km along strike /
#define DEFAULT_SLIPS_TO_HYPOS 2 / #slip models = 2 times #hypos */
#define DEFAULT_DT 0.1
#define NTMAX 10000
#define SOMERVILLE_FLAG 1
#define MAI_FLAG 2
#define INPUT_CORNERS_FLAG -1
#define MINSLIP 1.0e-02
#define DEFAULT_KMODEL 2
#define DEFAULT_FLIP_AT_SURFACE 1
#define DEFAULT_STRETCH_KCORNER 0
#define DEFAULT_CIRCULAR_AVERAGE 0
#define DEFAULT_MODIFIED_CORNERS 0
#define DEFAULT_TRUNCATE_ZERO_SLIP 1
#define DEFAULT_RAND_RAKE_DEGS 60.0
#define DEFAULT_SLIP_SIGMA 0.85
#define DEFAULT_TSFAC -0.5
#define DEFAULT_TSFAC_COEF 1.8
#define DEFAULT_TSFAC_FACTOR 1
#define DEFAULT_RT_SCALEFAC 1
#define DEFAULT_VR_TO_VS_FRAC 0.8 /* vrup = 0.8 times local Vs /
#define DEFAULT_SHAL_VRUP_FRAC 0.7 / shallow_vrup...
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.