Add SRF version 2.0 (vs/den) support#62
Conversation
Make the Rust point parser version-aware via a boolean flag and add vs/den columns (after dt) to the points dataframe only for version 2.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Write the real version string and derive the writer data-line-1 width from the column count so vs/den are emitted on line 1 for version 2.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Populate the existing VS/DEN POINTS fields from the dataframe when the SRF is version 2.0; v1.0 exports keep them at zero. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request introduces support for version 2.0 of the SRF (Standard Rupture Format) file format, enabling the parsing, writing, and HDF5-exporting of the additional shear-wave velocity (vs) and density (den) fields. Feedback recommends validating the SRF version string during parsing to prevent unsupported versions from defaulting to the 1.0 layout, and adding a defensive check in the Rust parser to prevent potential arithmetic overflow panics when calculating the summary length.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
At some point I think we want to refactor the rust parser and make it a bit cleaner -- the current code is quite brittle, and the way Claude has minimally extended the code for 2.0 support demonstrates this. However, I think I am satisfied that this code isn't wrong. |
Co-authored-by: Jake Faulkner <jake.faulkner@canterbury.ac.nz>
- Write VS/DEN based on the SRF version, not column presence, so a 2.0 SRF missing vs/den fails loudly instead of silently writing zeros - Annotate points_data as np.ndarray, removing the need for ty ignores on structured-array field assignments - Name the per-point quantity counts in the Rust parser (NUM_QUANTITIES_V1/V2) instead of bare 11/13 literals Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Real genslip-generated version 2.0 SRFs contain comment lines (starting with '#') between the version line and the PLANE header. Skip them, and add a test reading a real 2601-point genslip SRF (shipped gzipped in tests/data) with spot checks transcribed from its first, middle, and last point blocks. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Summary
Adds read/write support for SRF version 2.0. The only points-level difference
from v1.0 is two extra per-subfault fields,
VSandDEN, on each point'sfirst data line. v1.0 behaviour is unchanged.
Changes
vs/dencolumns added (afterdt) for v2.0 only; the Rustparser is told the version by
from_file. v1.0 stays 11 columns.write_srfwrites the real version, and the Rust writer sizesdata line 1 from the column count, so v2.0 emits
vs/denon line 1.write_sw4_hdf5fills the existingVS/DENfields for v2.0.