-
Notifications
You must be signed in to change notification settings - Fork 112
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
base: master
Are you sure you want to change the base?
Conversation
Python file to convert USGS param file to srf 2.0 format for FaultPlane.py to read in
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ 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. |
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 | ||
""" |
There was a problem hiding this comment.
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
"""
I've started to review this PR, and I thought I could already do the proposed changes, it is here: |
I created a Python file to convert the USGS param file to srf 2.0 format for FaultPlane.py .