DeterministicMmaxEstimates/maxmagnitude_wrapper.py

55 lines
3.2 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 Mmax import main as Mmax
def main(argv):
parser = argparse.ArgumentParser()
parser.add_argument("Input_catalog", help="Input catalog: path to input file of type 'catalog'")
parser.add_argument("Input_injection_rate", help="Input injection rate: path to input file of type 'injection_rate'")
parser.add_argument("--time_win_in_hours", help="Time window length (in hours- backward from the current time).", type=int, default=6)
parser.add_argument("--time_step_in_hour", help="Time interval for computation (in hours).", type=int, default=3)
parser.add_argument("--time_win_type", help="Time window type for computation.", type=int, default=0)
parser.add_argument("--End_time", help="End time of the computations (in day).", type=int, default=None)
parser.add_argument("--ev_limit", help="Minimum events number required for model computation.", type=int, default=20)
# Parameters with action='append' are array inputs. We can pass array by using a parameters multiple time. Eg.:
# --Inpar=A --Inpar=B --Inpar=C pass ['A', 'B', 'C'] array as script input.
parser.add_argument("--Inpar", help="Input parameters of the model to be saved and plotted.", type=str, action='append', default=None)
parser.add_argument("--time_inj", help="Injection time for plotting (in day).", type=int, default=None)
parser.add_argument("--time_shut_in", help="Shut-in time for plotting (in day).", type=int, default=None)
parser.add_argument("--time_big_ev", help="Big event time for plotting (in day).", type=int, default=None)
parser.add_argument("--Model_index", help="Model index: parameter of type 'INTEGER'", type=int)
parser.add_argument("--Mc", help="Completeness magnitude.", type=float, default=0.8)
parser.add_argument("--Mu", help="Friction coefficient.", type=float, default=0.6, required=False)
parser.add_argument("--G", help="Shear modulus of reservoir (in Pa).", type=float, default=35000000000)
parser.add_argument("--ssd", help="Static stress drop (in Pa).", type=float, default=3000000)
parser.add_argument("--C", help="Geometrical constant.", type=float, default=0.95)
parser.add_argument("--b_value_type", help="b-value type: parameter of type 'TEXT'", action='append')
parser.add_argument("--cl", help="Confidence level in van der Elst model.", type=float, action='append')
parser.add_argument("--mag_name", help="Magnitude column name", type=str)
args = parser.parse_args()
Mmax(**vars(args))
return
if __name__ == '__main__':
main(sys.argv)