-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_code.sh
More file actions
96 lines (74 loc) · 3.06 KB
/
run_code.sh
File metadata and controls
96 lines (74 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
set -e
# ---------- User Input ----------
IMT="PGA"
T="1_000" # FOR SA ONLY (will be ignored for other IMT)
N_SCENS=1000
NUM_GMFs=10
PROC=8
POIS_FILE="grid.txt"
IMT_MIN=0.001
IMT_MAX=1.0
BUFFER=1
HOME_DIR=$(pwd)
echo "HOME_DIR: $HOME_DIR"
# Load Conda
source [your_path]/conda.sh
# ---------- Step 1: Run SeisEnsMan ----------
# Comment lines 26-41 if the ensemble already exists
echo "-----------------------------"
echo "Step 1: Running SeisEnsMan..."
echo "-----------------------------"
source [your_path]/SeisEnsMan/bin/activate
cd ./SeisEnsManV2 || exit
mainFolder=$(pwd)
python write_json_file.py
python run_ens.py --cfg $mainFolder/input/main.config --event $mainFolder/input/event_stat.json --nb_scen "$N_SCENS"
cd "$HOME_DIR" || exit
# OPTIONAL: --angles Strike Dip Rake
# Example for Norcia event: --angles 151 47 -89
deactivate
# ---------- Step 2: Run ProbShakemap ----------
echo "------------------------------"
echo "Step 2: Running ProbShakemap..."
echo "------------------------------"
conda activate probshakemap
if [[ "$IMT" == "SA" ]]; then
T_FLOAT="${T/_/.}" # Convert 1_000 -> 1.000
IMT_STR="SA(${T_FLOAT})"
else
IMT_STR="$IMT"
fi
echo "Running with IMT: $IMT_STR"
# ######## Tools ########
# TOOL: 'StationRecords'
echo "Tool: StationRecords"
python ProbShakemap.py --imt "$IMT_STR" --tool StationRecords --imt_min "$IMT_MIN" --imt_max "$IMT_MAX" --station_file stationlist.json
#
# # TOOL: 'Save_Output'
echo "Tool: Save_Output"
python ProbShakemap.py --imt "$IMT_STR" --tool Save_Output --num_processes "$PROC" --pois_file "$POIS_FILE" --numGMPEsRealizations "$NUM_GMFs"
#
# # TOOL: 'QueryHDF5'
echo "Tool: QueryHDF5"
python ProbShakemap.py --imt "$IMT_STR" --tool QueryHDF5 --scenario 50 --pois_file "$POIS_FILE"
#
#
# # ######## Prob_tools ########
#
# # TOOL: 'GetStatistics'
echo "Tool: GetStatistics"
python ProbShakemap.py --imt "$IMT_STR" --prob_tool GetStatistics --num_processes "$PROC" --pois_file "$POIS_FILE" --numGMPEsRealizations "$NUM_GMFs" --imt_min "$IMT_MIN" --imt_max "$IMT_MAX" --vector_npy --buffer "$BUFFER"
#
# # TOOL: 'GetDistributions'
echo "Tool: GetDistributions"
python ProbShakemap.py --imt "$IMT_STR" --prob_tool GetDistributions --num_processes "$PROC" --pois_file "$POIS_FILE" --numGMPEsRealizations "$NUM_GMFs" --imt_min "$IMT_MIN" --imt_max "$IMT_MAX" --station_file stationlist.json --reuse_pois_subset --buffer "$BUFFER"
# TOOL: 'EnsemblePlot'
echo "Tool: EnsemblePlot"
python ProbShakemap.py --imt "$IMT_STR" --prob_tool EnsemblePlot --num_processes "$PROC" --pois_file "$POIS_FILE" --numGMPEsRealizations "$NUM_GMFs" --reuse_pois_subset --buffer "$BUFFER"
# TOOL: ' GetDistributions & EnsemblePlot'
# Merge if applying to the same subset of POIs
# echo "Tool: GetDistributions & EnsemblePlot"
# python ProbShakemap.py --imt "$IMT_STR" --prob_tool GetDistributions EnsemblePlot --num_processes "$PROC" --pois_file "$POIS_FILE" --imt_min "$IMT_MIN" --imt_max "$IMT_MAX" --station_file stationlist.json --numGMPEsRealizations "$NUM_GMFs" --reuse_pois_subset --buffer "$BUFFER"
#
conda deactivate