Command Line Interface¶
The recommended way to interact with LASIF 2.0 projects is to use the API
but the command line interface remains an option for anyone who prefers that.
It consists of a number of subcommands grouped below
the main lasif
command. The general usage is quickly explained in this
paragraph whilst the remainder of this sections explains all subcommands in
greater detail.
The general help can be accessed with the lasif help
command.
$ lasif help
####################################################################################################
LASIF - Large Scale Seismic Inversion Framework [Version 0.0.0-tar/zipball]
http://krischer.github.io/LASIF
####################################################################################################
usage: lasif [--help] COMMAND [ARGS]
======== Data Acquisition Functions
add_gcmt_events: Selects and adds optimally distributed events from the GCMT catalog.
add_spud_event: Add an event from the IRIS SPUD webservice to the project.
...
To access the subcommand specific help append --help
to the command.
$ lasif init_project --help
usage: lasif init_project [-h] [--ipdb] folder_path
Create a new project.
positional arguments:
folder_path where to create the project
optional arguments:
-h, --help show this help message and exit
--ipdb If true, a debugger will be launched upon encountering an
exception. Requires ipdb.
Each command can have a number of positional arguments and some optional arguments. Positional arguments have to be given in the specified order while optional arguments can be passed if needed.
Note
All lasif commands work and use the correct project as long as they are
executed somewhere inside a project’s folder structure. It will
recursively search the parent directories until it finds a
lasif_config.toml
file. This will then be assumed to be the root folder
of the project.
MPI¶
Some commands can be executed with MPI to speed up their execution. Don’t use too many cores as the problem quickly becomes I/O bounds. For example to run the preprocessing on 16 cores, do
$ mpirun -n 16 lasif process_data 1 GCMT_event_AZORES_ISLANDS
The following commands are MPI-enabled. Attempting to run any other command with MPI will result in an error.:
Command Documentation¶
In the following all subcommands are documented in detail. The commands are grouped by functionality.
Available Commands
Data Acquisition Functions¶
Data Acquisition
These functions are used to acquire and archive different types of data usually from webservices.
lasif add_spud_event¶
usage: lasif add_spud_event [-h] [--ipdb] url
Add an event from the IRIS SPUD webservice to the project.
Positional Arguments |
|
|
any SPUD momenttensor URL |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
lasif add_gcmt_events¶
usage: lasif add_gcmt_events [-h] [--ipdb] [--min_year MIN_YEAR] [--max_year MAX_YEAR] count min_magnitude max_magnitude min_distance
Selects and adds optimally distributed events from the GCMT catalog.
Positional Arguments |
|
|
maximum amount of events to add |
|
minimum magnitude off events to add |
|
maximum magnitude off events to add |
|
The minimum acceptable distance to the next closest event in km. |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
minimum year from which to add events |
|
maximum year from which to add events |
lasif download_data¶
usage: lasif download_data [-h] [--ipdb] [--providers PROVIDERS [PROVIDERS ...]] [event_name [event_name ...]]
Download waveform and station data for one or more events. Can be used to download data for all events in LASIF project.
Positional Arguments |
|
|
name of the event. Possible to add more than one event separated by a space. If argument is left empty. data will be downloaded for all events |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
FDSN providers to query. Will use all known ones if not set. |
Event Management Functions¶
Event Management
Function helping in organzing the earthquakes inside a LASIF project.
lasif list_events¶
usage: lasif list_events [-h] [--ipdb] [--just_list] [--iteration ITERATION]
Print a list of all events in the project.
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
Show only a list of eventswithout properties. Good for scripting bash. |
|
Show only events related to a specific iteration |
lasif event_info¶
usage: lasif event_info [-h] [--ipdb] [-v] event_name
Print information about a single event.
Positional Arguments |
|
|
name of the event |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
Verbose. Print all contained events. |
Iteration Management Functions¶
Iteration Management
Functions dealing with one or more iterations inside a LASIF project.
lasif submit_job¶
usage: lasif submit_job [-h] [--ipdb] iteration_name ranks wall_time_in_seconds simulation_type site [event [event ...]]
EXPERIMENTAL: Submits event(s) to daint with salvus-flow. NO QA
Requires all input_files and salvus-flow to be installed and configured.
Positional Arguments |
|
|
name of the iteration |
|
amount of ranks |
|
wall time |
|
forward, step_length, adjoint |
|
Computer to submit the job to |
|
If you only want to submit selected events. You can input more than one separated by a space. If none is specified, all will be taken |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
lasif retrieve_output¶
usage: lasif retrieve_output [-h] [--ipdb] iteration_name simulation_type site [event [event ...]]
EXPERIMENTAL: Retrieves output from simulation, No QA.
Positional Arguments |
|
|
name of the iteration |
|
forward, step_length, adjoint |
|
Computer to get output from |
|
names of events you want to retrieve output from. If more than one, separate with space. If none specified all will be used. |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
lasif generate_input_files¶
usage: lasif generate_input_files [-h] [--ipdb] [--weight_set_name WEIGHT_SET_NAME] [--prev_iter PREV_ITER] iteration_name [events [events ...]] simulation_type
Generate input files for the forward simulation of the waveform solver.
Positional Arguments |
|
|
name of the iteration |
|
One or more events. If none given, all will be done. |
|
forward, step_length, adjoint |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
Set of station and event weights,used to scale the adjoint sources |
|
Optionally specify a previous iterationto use input files_from, only updatesthe mesh file. |
lasif calculate_adjoint_sources¶
This function can be used with MPI
usage: lasif calculate_adjoint_sources [-h] [--ipdb] [--weight_set WEIGHT_SET] iteration_name window_set_name [events [events ...]]
Calculates adjoint sources for a given iteration.
Positional Arguments |
|
|
name of the iteration |
|
name of the window_set |
|
One or more events. If none given,all will be done. |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
name of station weight set |
lasif select_windows¶
This function can be used with MPI
usage: lasif select_windows [-h] [--ipdb] iteration window_set_name [events [events ...]]
Autoselect windows for a given event and iteration combination.
This function works with MPI. Don’t use too many cores, I/O quickly becomes the limiting factor. It also works without MPI but then only one core actually does any work.
Positional Arguments |
|
|
name of the iteration |
|
name of the window_set |
|
One or more events. If none given, all will be done. |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
lasif gui¶
usage: lasif gui [-h] [--ipdb]
Launch the misfit GUI.
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
lasif create_weight_set¶
usage: lasif create_weight_set [-h] [--ipdb] weight_set_name
Create a new set of event and station weights.
Positional Arguments |
|
|
name of the weight set, i.e. “A” |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
lasif compute_station_weights¶
usage: lasif compute_station_weights [-h] [--ipdb] [--iteration ITERATION] weight_set_name [event_name [event_name ...]]
Compute weights for stations. Useful when distribution is uneven. Weights are calculated for each event. This may take a while if you have many stations.
Positional Arguments |
|
|
Pick a name for the weight set. If the weightset already exists, it willoverwrite |
|
name of event. If none is specified weights willbe calculated for all. Also possible to specifymore than one separated by a space |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
If you only want to do this for the events specified for an iteration |
lasif get_weighting_bins¶
usage: lasif get_weighting_bins [-h] [--ipdb] [--iteration ITERATION] window_set_name [event_name [event_name ...]]
Compute median envelopes for the observed data in certain station bins. The binning is based on event-station distances.
Positional Arguments |
|
|
Name of window set |
|
Name of event |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
Take all eventsused in a specificiteration. |
lasif set_up_iteration¶
usage: lasif set_up_iteration [-h] [--ipdb] [--remove_dirs] iteration_name [events [events ...]]
Creates or removes directory structure for an iteration.
Positional Arguments |
|
|
name of the iteration, i.e. “1” |
|
If you only want to submit selected events. You can input more than one separated by a space. If none is specified, all will be taken |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
Removes all directories related to the specified iteration. |
lasif write_misfit¶
usage: lasif write_misfit [-h] [--ipdb] [--weight_set_name WEIGHT_SET_NAME] [--window_set_name WINDOW_SET_NAME] iteration_name
Positional Arguments |
|
|
current iteration |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
Set of station and event weights |
|
name of the window set |
lasif list_iterations¶
usage: lasif list_iterations [-h] [--ipdb]
Creates directory structure for a new iteration.
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
lasif compare_misfits¶
This function can be used with MPI
usage: lasif compare_misfits [-h] [--ipdb] [--weight_set_name WEIGHT_SET_NAME] [--print_events] from_iteration to_iteration [events [events ...]]
Compares the total misfit between two iterations.
Total misfit is used regardless of the similarity of the picked windows from each iteration. This might skew the results but should give a good idea unless the windows change excessively between iterations.
If windows are weighted in the calculation of the adjoint sources. That should translate into the calculated misfit value.
Positional Arguments |
|
|
past iteration |
|
current iteration |
|
One or more events. If none given, all will be done. |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
Set of station and event weights |
|
compare misfits for each event |
lasif list_weight_sets¶
usage: lasif list_weight_sets [-h] [--ipdb]
Print a list of all weight sets in the project.
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
lasif process_data¶
This function can be used with MPI
usage: lasif process_data [-h] [--ipdb] [--iteration ITERATION] [events [events ...]]
Launch data processing.
This function works with MPI. Don’t use too many cores, I/O quickly becomes the limiting factor. It also works without MPI but then only one core actually does any work.
Positional Arguments |
|
|
One or more events. If none given, all will be done. |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
Take all events used in iteration |
Misc Functions¶
Misc
All functions that do not fit in one of the other categories.
lasif shell¶
usage: lasif shell [-h] [--ipdb]
Drops you into a shell with an active communicator instance.
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
lasif tutorial¶
usage: lasif tutorial [-h] [--ipdb]
Open the tutorial in a webbrowser.
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
Plotting Functions¶
Plotting
Functions producing pictures.
lasif plot_domain¶
usage: lasif plot_domain [-h] [--ipdb] [--save]
Plot the project’s domain on a map.
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
Save the plot in a file |
lasif plot_event¶
usage: lasif plot_event [-h] [--ipdb] [--save] [--force_intersect] [--force_no_intersect] [--weight_set_name WEIGHT_SET_NAME] event_name
Plot a single event including stations on a map.
Positional Arguments |
|
|
name of the event to plot |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
Saves the plot in a file |
|
Force to plot only stations that recorded durng all events in the project, regardless of settings. |
|
Force to plot all stations that recorded during events, even if they are not present for all events, regardless of settings. |
|
for stations to be color coded as a function of their respective weights |
lasif plot_events¶
usage: lasif plot_events [-h] [--ipdb] [--type {map,depth,time}] [--iteration ITERATION] [--save]
Plot all events. This might need an extension to iterations.
- type can be one of:
map
(default) - a map view of the eventsdepth
- a depth distribution histogramtime
- a time distribution histogram
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
the type of plot.
|
|
Plot all events for an iteration |
|
Saves the plot in a file |
lasif plot_raydensity¶
usage: lasif plot_raydensity [-h] [--ipdb] [--iteration ITERATION] [--plot_stations]
Plot a binned raycoverage plot for all events.
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
Only plot data from a specific iteration |
|
also plot the stations |
lasif plot_section¶
usage: lasif plot_section [-h] [--ipdb] [--num_bins NUM_BINS] [--traces_per_bin TRACES_PER_BIN] event_name
Plot a binned section plot of the processed data for an event.
Positional Arguments |
|
|
name of the event to plot |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
number of bins to be used for binning the event-station offsets |
|
number of traces per bin |
lasif plot_stf¶
usage: lasif plot_stf [-h] [--ipdb] [--unfiltered]
Plot the source time function for one iteration.
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
Add this tag if you want to plot an unfiltered STF |
lasif plot_window_statistics¶
usage: lasif plot_window_statistics [-h] [--ipdb] [--save] [--iteration ITERATION] window_set_name [events [events ...]]
Plot the selected windows.
Positional Arguments |
|
|
name of the window set |
|
One or more events. If none given, all will be done. |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
Saves the plot in a file |
|
Take all events used in iteration |
lasif plot_windows¶
usage: lasif plot_windows [-h] [--ipdb] [--distance_bins DISTANCE_BINS] event_name window_set_name
Plot the selected windows.
Positional Arguments |
|
|
name of the event |
|
name of the window set |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
The number of bins on the distance axis for the combined plot. |
Project Management Functions¶
Project Management
Functions dealing with LASIF projects as a whole.
lasif info¶
usage: lasif info [-h] [--ipdb]
Print a summary of the project.
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
lasif init_project¶
usage: lasif init_project [-h] [--ipdb] folder_path
Create a new project.
Positional Arguments |
|
|
where to create the project |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
lasif validate_data¶
usage: lasif validate_data [-h] [--ipdb] [--data_and_station_file_availability] [--raypaths] [--full]
Validate the data currently in the project.
This commands walks through all available data and checks it for validity. It furthermore does some sanity checks to detect common problems. These should be fixed.
By default is only checks some things. A full check is recommended but potentially takes a very long time.
Things the command does:
- Event files:
Validate against QuakeML 1.2 scheme.
Make sure they contain at least one origin, magnitude and focal mechanism object.
Check for duplicate ids amongst all QuakeML files.
Some simply sanity checks so that the event depth is reasonable and the moment tensor values as well. This is rather fragile and mainly intended to detect values specified in wrong units.
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |
|
asserts that all stations have corresponding station files and all stations have waveforms. Very slow. |
|
assert that all raypaths are within the set boundaries. Very slow. |
|
run all validations. |
lasif clean_up¶
usage: lasif clean_up [-h] [--ipdb] clean_up_file
Clean up the LASIF project.
The required file can be created with lasif validate_data command.
Positional Arguments |
|
|
path of clean-up file |
Optional Arguments |
|
|
show this help message and exit |
|
If true, a debugger will be launched upon encountering an exception. Requires ipdb. |