Skip to content

Add srf module#2

Merged
lispandfound merged 8 commits intomainfrom
srf
Jul 29, 2024
Merged

Add srf module#2
lispandfound merged 8 commits intomainfrom
srf

Conversation

@lispandfound
Copy link
Copy Markdown
Contributor

What is this module?

This module allows for both reading and writing SRF files.

Why not use the module in QCore?

For a few reasons:

  1. The qcore.srf module does not support writing SRF files.
  2. Exposing SRF points as a pandas dataframe allows manipulation of the points using efficient vectorised operations. We use this in rupture propagation to delay ruptures by adding to the tinit column.
  3. There is better documentation for the new module than the old one.

Example

>>> srf_file = srf.read_srf('/path/to/srf')
>>> srf_file.points['tinit'].max() # get the last time any point in the SRF ruptures
>>> srf_file.points['tinit'] += 1 # delay all points by one second
>>> coordinates.wgs_depth_to_nztm(srf_file.header[['elat', 'elon']].to_numpy())
#   ^ get the coordinates all the fault plane centres in the rupture in NZTM format
# etc...
>>> srf.write_srf('/path/to/srf', srf_file)

@lispandfound lispandfound requested a review from claudio525 July 19, 2024 02:04
Copy link
Copy Markdown
Contributor

@AndrewRidden-Harper AndrewRidden-Harper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice description of the differences with qcore.srf

@lispandfound lispandfound merged commit e6ef8b8 into main Jul 29, 2024
claudio525 added a commit that referenced this pull request Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants