Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR finalizes the FSP file parser by extracting raw geometry and additional segment properties from FSP files with NZTM coordinate support.
- Enhanced test coverage in tests/test_fsp.py to validate new segment attributes and plane conversion.
- Introduced a new dataclass (Segment) and updated parsing logic to collect segment properties including strike, dip, dimensions, and subfaults in source_modelling/fsp.py.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/test_fsp.py | Added numpy import and updated test expectations for new geometry fields. |
| source_modelling/fsp.py | Added Segment dataclass and updated parsing logic to extract segment data. |
Comments suppressed due to low confidence (1)
tests/test_fsp.py:55
- Confirm that the updated expected width value of 12.0 aligns with the official FSP file specifications.
assert fsp_file.segments[0].width == pytest.approx(12.0)
There was a problem hiding this comment.
Pull Request Overview
This PR adds functionality to extract raw geometry from FSP files, completing the FSP file parsing for NZTM coordinate‐based data.
- Updates tests to assert new geometric properties and conversion to a Plane object.
- Introduces a new Segment dataclass and extends the _parse_segment_slip function to return both DataFrame data and segment objects.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/test_fsp.py | Updates to include new assertions for geometric and segment data. |
| source_modelling/fsp.py | Adds the Segment dataclass, modifies as_plane conversion logic, and updates parsing logic for segment data. |
Comments suppressed due to low confidence (1)
source_modelling/fsp.py:110
- The conditional check in as_plane uses implicit truthiness which may incorrectly raise a ValueError when any numeric attribute (e.g., strike or dip) is 0. Consider using explicit checks against None to allow valid zero values.
if not (self.strike and self.dip and self.length and self.width and isinstance(self.top_centre, np.ndarray)):
There was a problem hiding this comment.
Pull Request Overview
This PR completes the FSP file parsing by extracting raw geometry from FSP files that use NZTM coordinates. Key changes include introducing a new Segment dataclass with associated parsing logic, updating the parsing function (_parse_segment_slip) to return both subfault data and segments, and enhancing tests to assert the accuracy of geometric values and plane conversion.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/test_fsp.py | Added assertions to validate new segment attributes and plane conversion from the FSP file |
| source_modelling/fsp.py | Introduced the Segment dataclass and revised parsing logic to extract segment properties |

This PR (hopefully) completes the FSP file parsing by allowing you to extract the raw geometry from an FSP file (where that FSP file is in a place that can be represented accurately with NZTM coordinates).