SeismicHazardForecasting/src/shf_wrapper.py

66 lines
2.6 KiB
Python

# -----------------
# Copyright © 2025 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 seismic_hazard_forecasting import main as shf
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("catalog_file", help="Path to input file of type 'catalog'")
parser.add_argument("--mc_file", help="Path to input file of type 'mccalc_output'", type=str, default=None, required=False)
parser.add_argument("--pdf_file", help="Path to input file of type 'PDF'", type=str, default=None, required=False)
parser.add_argument("--m_file", help="Path to input file of type 'm'", type=str, default=None, required=False)
parser.add_argument("--m_select", type=str2bool)
parser.add_argument("--mag_label", type=str, default=None, required=False)
parser.add_argument("--mc", type=float, default=None, required=False)
parser.add_argument("--m_max", type=float, default=None, required=False)
parser.add_argument("--m_kde_method", type=str)
parser.add_argument("--xy_select", type=str2bool)
parser.add_argument("--grid_dim", type=int)
parser.add_argument("--xy_win_method", type=str2bool)
parser.add_argument("--rate_select", type=str2bool)
parser.add_argument("--time_win_duration", type=float)
parser.add_argument("--forecast_select", type=str2bool)
parser.add_argument("--custom_rate", type=float, default=None, required=False)
parser.add_argument("--forecast_len", type=float)
parser.add_argument("--time_unit", type=str)
parser.add_argument("--model", type=str)
parser.add_argument("--products_string", type=str)
parser.add_argument("--verbose", type=str2bool)
args = parser.parse_args()
shf(**vars(args))
return
if __name__ == '__main__':
main(sys.argv)