Repository navigation
Document slipt1_array as slip rate in cm/s - #158
Open
claude[bot] wants to merge 1 commit into
Open
claude[bot] wants to merge 1 commit into
claude[bot] wants to merge 1 commit into
Conversation
Closes #138 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #138
What was wrong
The SLIPT1 block of an SRF holds slip rate (cm/s), not slip. The sum of a row times
dtequals the patch's total slip. You can check this ontests/srfs/3468575.srf: the median ofrowsum * dt / slipis 1.000001. ButSrfFiledocumentedslipt1_array[i, j]as "the slip for the ith patch", andto_xarraylabelled the slip dataset withunits: "cm". The docs also didn't say that columnjis absolute timej * dt, so each row's non-zero entries start atfloor(tinit / dt)(src/srf_parser.rs).What changed
These are documentation and metadata changes only, all in
source_modelling/srf.py:SrfFile.slipt1_arraydocstring now says slip rate (cm/s), absolute timej * dt, and that rowistarts atfloor(tinit / dt).slipproperty docstring now says slip-rate functions (cm/s).to_xarrayslip dataset attrs are nowunits: "cm/s"anddescription: "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_xarraycallsxr.merge(datasets)with the defaultcombine_attrs="override", which keeps only the first dataset's attrs (the header dataset has none). SoSrfFile.to_xarray().attrsis just{'version': ...}, and neitherto_xarraynorwrite_hdf5exposesunits/descriptionanywhere. 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
cmunits 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 ondata.🤖 Generated with Claude Code