Skip to content

Document slipt1_array as slip rate in cm/s - #158

Open
claude[bot] wants to merge 1 commit into
mainfrom
ai/issue-138
Open

claude[bot] wants to merge 1 commit into
mainfrom
ai/issue-138

Conversation

@claude

@claude claude Bot commented Oct 21, 2026

Copy link
Copy Markdown

Closes #138

What was wrong

The SLIPT1 block of an SRF holds slip rate (cm/s), not slip. The sum of a row times dt equals the patch's total slip. You can check this on tests/srfs/3468575.srf: the median of rowsum * dt / slip is 1.000001. But SrfFile documented slipt1_array[i, j] as "the slip for the ith patch", and to_xarray labelled the slip dataset with units: "cm". The docs also didn't say that column j is absolute time j * dt, so each row's non-zero entries start at floor(tinit / dt) (src/srf_parser.rs).

What changed

These are documentation and metadata changes only, all in source_modelling/srf.py:

  • The SrfFile.slipt1_array docstring now says slip rate (cm/s), absolute time j * dt, and that row i starts at floor(tinit / dt).
  • The slip property docstring now says slip-rate functions (cm/s).
  • The to_xarray slip dataset attrs are now units: "cm/s" and description: "Slip rate for each patch at each timestep".

Tests

No test added. While checking this, I found that these attrs never reach the output. to_xarray calls xr.merge(datasets) with the default combine_attrs="override", which keeps only the first dataset's attrs (the header dataset has none). So SrfFile.to_xarray().attrs is just {'version': ...}, and neither to_xarray nor write_hdf5 exposes units/description anywhere. Changing the attr values therefore alters no observable behaviour, so no test can fail before this change. The full suite passes (800 passed).

For reviewers

  • The issue says the cm units are written into every HDF5 file. As explained above, they are actually dropped. I left that alone because fixing it would change the HDF5 output, which is beyond this issue. A maintainer may want to decide separately whether these attrs should be kept, e.g. as variable-level attrs on data.
  • No numerical behaviour changed.

🤖 Generated with Claude Code

Closes #138

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@claude claude Bot added the ai-generated Opened by the scheduled Claude jobs label Oct 21, 2026
@claude
claude Bot requested a review from lispandfound October 21, 2026 09:38

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated Opened by the scheduled Claude jobs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

srf.py: slipt1_array is documented, and written to HDF5, as slip in cm, but it holds slip rate in cm/s

0 participants