91 lines
5.1 KiB
Python
91 lines
5.1 KiB
Python
# -*- coding: utf-8 -*-
|
||
|
||
# -----------------
|
||
# Copyright © 2024 ACK Cyfronet AGH, Poland.
|
||
#
|
||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||
# you may not use this file except in compliance with the License.
|
||
# You may obtain a copy of the License at
|
||
#
|
||
# http://www.apache.org/licenses/LICENSE-2.0
|
||
#
|
||
# Unless required by applicable law or agreed to in writing, software
|
||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
# See the License for the specific language governing permissions and
|
||
# limitations under the License.
|
||
#
|
||
# This work was partially funded by DT-GEO Project.
|
||
# -----------------
|
||
|
||
import sys
|
||
import argparse
|
||
from SpectralAnalysisApp import main as SpectralAnalysisApp
|
||
|
||
|
||
def main(argv):
|
||
def str2bool(v):
|
||
if v.lower() in ("True", "TRUE", "yes", "true", "t", "y", "1"):
|
||
return True
|
||
elif v.lower() in ("False", "FALSE", "no", "false", "f", "n", "0"):
|
||
return False
|
||
else:
|
||
raise argparse.ArgumentTypeError("Boolean value expected.")
|
||
|
||
parser = argparse.ArgumentParser()
|
||
parser.add_argument("waveforms", help="Path to input file of type miniseed")
|
||
parser.add_argument("network_inventory", help="Path to input file of type inventory")
|
||
parser.add_argument("picks_qml", help="Path to input file of type phase_association_detections")
|
||
parser.add_argument("--velocity_model", help="Path to input file of type velocity_model", required=False)
|
||
parser.add_argument("--event_latitude", help="", type=float, default=4000, required=True)
|
||
parser.add_argument("--event_longitude", help="", type=float, default=4000, required=True)
|
||
parser.add_argument("--event_depth", help="", type=float, default=4000, required=True)
|
||
parser.add_argument("--vp", help="P wave velocity in the source",
|
||
type=float, default=4000, required=True)
|
||
parser.add_argument("--vs", help="S wave velocity in the source",
|
||
type=float, default=2500, required=True)
|
||
parser.add_argument("--density", help="Rock density in source",
|
||
type=float, default=2700, required=True)
|
||
parser.add_argument("--taper_type", help="Type of taper",
|
||
type=str, default='hann', required=True)
|
||
parser.add_argument("--taper_len", help="Maximum length of the taper",
|
||
type=float, default=0.1, required=True)
|
||
parser.add_argument("--window_len", help="Length of the time window used for spectrum calculation",
|
||
type=float, default=1, required=True)
|
||
parser.add_argument("--freq_min", help="Minimum frequency for bandpass filtering",
|
||
type=float, default=0.1, required=True)
|
||
parser.add_argument("--freq_max", help="Maximum frequency for bandpass filtering",
|
||
type=float, default=40, required=True)
|
||
parser.add_argument("--min_sn_ratio", help="Minimum signal-to-noise ratio for each frequency - for lower S/N values, a given frequency is not taken into account for spectral fitting",
|
||
type=float, default=1, required=True)
|
||
parser.add_argument("--min_energy_ratio", help="Minimum spectral signal-to-noise ratio for the entire time window– for lower S/N values analysis is not performed",
|
||
type=float, default=1, required=True)
|
||
parser.add_argument("--p_wave_analysis", help="P wave analysis",
|
||
type=str2bool, default=True, required=True)
|
||
parser.add_argument("--s_wave_analysis", help="S wave analysis",
|
||
type=str2bool, default=True, required=True)
|
||
parser.add_argument("--raytracing", help="1D model. If False constant velocity values from the source are used for travel time calculations",
|
||
type=str2bool, default=True, required=True)
|
||
parser.add_argument("--allow_station_elevations", help="Use station elevations (otherwise set them to zero)",
|
||
type=str2bool, default=False, required=True)
|
||
parser.add_argument("--source_model", help="Source model. List: Madariaga or Brune",
|
||
type=str, default="Madariaga", required=True)
|
||
parser.add_argument("--sp_fit_model", help="Spectral fitting model. List: FBrune or FBoatwright",
|
||
type=str, default="FBoatwright", required=True)
|
||
parser.add_argument("--norm", help="Norm for spectral fitting calculations. List: L1 or L2",
|
||
type=str, default="L2", required=True)
|
||
parser.add_argument("--z_threshold", help="Z threshold for outliers removal (number of standard deviations)",
|
||
type=int, default=3, required=True)
|
||
parser.add_argument("--q_min", help="Lower bound of Q for spectral fitting",
|
||
type=int, default=1, required=True)
|
||
parser.add_argument("--q_max", help="Upper bound of Q for spectral fitting",
|
||
type=int, default=400, required=True)
|
||
|
||
args = parser.parse_args()
|
||
SpectralAnalysisApp(**vars(args))
|
||
return
|
||
|
||
|
||
if __name__ == '__main__':
|
||
main(sys.argv)
|