Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python script to convert USGS param to srf 2.0 file format #1008

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jwjeremy
Copy link
Contributor

I created a Python file to convert the USGS param file to srf 2.0 format for FaultPlane.py .

Python file to convert USGS param file to srf 2.0 format for FaultPlane.py to read in
@jwjeremy jwjeremy changed the title Create conversion file of USGS param to srf 2.0 file format Python script to convert USGS param to srf 2.0 file format Jan 12, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (349a417) 13.89% compared to head (b8fc1fe) 13.89%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1008   +/-   ##
=======================================
  Coverage   13.89%   13.89%           
=======================================
  Files         257      257           
  Lines       14817    14817           
=======================================
  Hits         2059     2059           
  Misses      12758    12758           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +11 to +20
PREM_STR = """
depth radius vp vs rho Qu Qk P
0.0 6371.0 1.45 0.00 1.02 0.0 57823.0 0.0
3.0 6368.0 5.80 3.20 2.60 600.0 57823.0 0.0
15.0 6356.0 6.80 3.90 2.90 600.0 57823.0 0.3
24.4 6346.6 6.80 3.90 2.90 600.0 57823.0 0.6
71.0 6300.0 8.08 4.47 3.38 600.0 57823.0 2.2
80.0 6291.0 8.08 4.47 3.37 600.0 57823.0 2.5
171.0 6200.0 8.02 4.44 3.36 80.0 57823.0 5.5
"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Running the script currently results in a ValueError: could not convert string to float: 'depth'

The reason why this happens is that the file PREM.txt is saved with an additional blank line at the top.
Either change l.26 to skiprows=2 or maybe better, write l.11 to l.20 as follows:

PREM_STR = """depth radius vp vs rho Qu Qk P
0.0 6371.0 1.45 0.00 1.02 0.0 57823.0 0.0
3.0 6368.0 5.80 3.20 2.60 600.0 57823.0 0.0
15.0 6356.0 6.80 3.90 2.90 600.0 57823.0 0.3
24.4 6346.6 6.80 3.90 2.90 600.0 57823.0 0.6
71.0 6300.0 8.08 4.47 3.38 600.0 57823.0 2.2
80.0 6291.0 8.08 4.47 3.37 600.0 57823.0 2.5
171.0 6200.0 8.02 4.44 3.36 80.0 57823.0 5.5
"""

@Thomas-Ulrich
Copy link
Contributor

I've started to review this PR, and I thought I could already do the proposed changes, it is here:
https://github.com/SeisSol/SeisSol/tree/thomas/usgs_conversion
Note the description of the srf file is here:
https://seissol.readthedocs.io/en/latest/kinematic.html
and the Northridge example here:
https://github.com/SeisSol/Examples/blob/master/Northridge/nr6.70-s0000-h0000.txt
So what is missing from my branch are The PLANE blocks.
Also, I don't know if the source time function should all start at t=0 for generate_FL33_input_files.py to work.
(I need to double check later)
I will continue working on it on Monday

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.

None yet

4 participants