Add more options for SRF parameters#73
Conversation
Summary of ChangesHello @lispandfound, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the configurability of Synthetic Rupture File (SRF) generation by introducing a comprehensive set of new parameters, many of which are specifically designed for subduction zone source modeling. The changes involve extending the core Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors SRF parameter handling by extracting hardcoded values into configuration and adding new parameters for subduction sources. The changes are consistent across tests, default configurations, and schema definitions. I've found a high-severity bug in how list parameters are formatted for the genslip command, which will likely cause it to fail. I also have two medium-severity suggestions: one to address the removal of the rup_delay parameter which could alter behavior, and another to remove some redundant code for better maintainability. Addressing these points will improve the correctness and quality of the changes.
There was a problem hiding this comment.
Pull request overview
This PR extracts explicitly set SRF (Standard Rupture Format) parameters from hardcoded values into configurable fields, and adds support for additional parameters used in subduction source simulations. The changes enable more flexible configuration of genslip parameters for seismic rupture modeling.
Key Changes:
- Extracts taper, roughness, and segment parameters (previously hardcoded) into configurable SRF fields
- Adds optional subduction-specific parameters (ymag_exp, xmag_exp, kx_corner, ky_corner)
- Refactors SRFConfig.to_dict() to use dataclasses.asdict() for more maintainable serialization
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| workflow/scripts/realisation_to_srf.py | Updates genslip command construction to use configurable parameters instead of hardcoded values; adds dynamic parameter extension for subduction settings |
| workflow/schemas.py | Adds validation schemas for new SRF parameters with appropriate type constraints; moves comment block for better organization |
| workflow/realisations.py | Extends SRFConfig dataclass with new parameter fields; simplifies to_dict() method using dataclasses.asdict() |
| workflow/default_parameters/*/defaults.yaml | Adds default values for new SRF parameters across all configuration versions |
| tests/test_realisation.py | Updates test expectations to include new SRF parameters |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Depends on #78 |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request primarily updates the SRF (Source Rupture File) configuration and related dependencies. The pyproject.toml file was updated to restrict the Python version to <3.14 and to change UCGMSim dependencies from direct git URLs to package names with version constraints. The SRFConfig class in workflow/realisations.py and its corresponding schema in workflow/schemas.py were significantly expanded to include numerous new parameters for controlling slip tapering, roughness, segment delays, slip distribution, and risetime, while removing the explicit genslip_version field. These new SRF parameters were also added to all default parameter YAML files (workflow/default_parameters/*defaults.yaml). Test cases in tests/test_realisation.py were updated to reflect these new SRF configuration parameters. Additionally, workflow/scripts/generate_station_coordinates.py was modified to use a separate Resolution object for calculating grid dimensions and coordinates, ensuring consistency. In workflow/scripts/generate_velocity_model_parameters.py, the pgv_from_rrup and estimate_rrup functions were updated to include a ztor parameter (distance to top of fault), and the max_depth calculation was refined to correctly handle point sources. Type hints and strictness checks were improved in the dict_zip utility function, and a type ignore comment was added in workflow/scripts/hf_sim.py for a longitude parameter. Finally, workflow/scripts/realisation_to_srf.py introduced a new helper function _build_genslip_command to dynamically construct genslip commands based on the new SRFConfig parameters, replacing a hardcoded list of arguments.
This PR extracts explicitly set SRF parameters, and adds some extra parameters used for subduction sources.
See #78 first! This PR includes its changes to pass tests.