-
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
Add new script to visualize the energy output(s) #980
base: master
Are you sure you want to change the base?
Conversation
Allows to plot the energy output(s), also of multiple input files, as part of the SIO group meeting
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 #980 +/- ##
==========================================
- Coverage 14.35% 13.99% -0.37%
==========================================
Files 253 254 +1
Lines 14253 14864 +611
==========================================
+ Hits 2046 2080 +34
- Misses 12207 12784 +577 ☔ View full report in Codecov by Sentry. |
parser.add_argument("--dpi", default=300, type=int, help="Dots per Inch") | ||
parser.add_argument("-o", "--Output", help='Name of the output file', default='energy_output.png') | ||
args = parser.parse_args() | ||
|
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.
Allow wildcards file path
### search through wildcards | |
files = [] | |
for _f in args.Input: | |
files.extend(glob.glob(_f)) |
import argparse | ||
import sys | ||
import os | ||
|
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.
import glob |
parser.add_argument("-o", "--Output", help='Name of the output file', default='energy_output.png') | ||
args = parser.parse_args() | ||
|
||
for i in range(0,len(args.Input)): |
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.
for i in range(0,len(args.Input)): | |
for i in range(0,len(files)): |
for j in range(0,len(args.Data)): | ||
if (args.Data[j].upper() == "MR"): | ||
energy_output = "moment_rate" | ||
df[energy_output] = np.gradient(df["seismic_moment"], df["time"].iloc[1]) |
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.
Add default units
df[energy_output] = np.gradient(df["seismic_moment"], df["time"].iloc[1]) | |
df[energy_output] = np.gradient(df["seismic_moment"], df["time"].iloc[1]) | |
args.ylabel = 'Seismic moment [Nm]' if args.ylabel=="" |
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.
Nice useful tool @fabian-kutschera. I added a few changes to allow wildcards and default units if ylabel option is empty
Well this does not work with the latest format of energy output:
|
Hi, I get the following error:
Appart from that:
using a dictionary would be more pythonic:
this |
Allows to plot the energy output(s), also of multiple input files, as part of the SIO group meeting