-
Notifications
You must be signed in to change notification settings - Fork 6
/
ashcalc.py
29 lines (26 loc) · 1.09 KB
/
ashcalc.py
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
import sys
from core import isopach
from command_line import cli
if __name__ == '__main__':
# Get and store command line arguments
parser = cli.setup_parser()
args = parser.parse_args()
# If no filenames are given, run the gui application
if len(args.filelist) == 0:
# Gui import is slow, so it is only done if we are going to use it.
from desktop import gui
ashcalc_application = gui.App()
sys.exit()
# Otherwise, prepare model settings then process the files
model_settings = cli.ModelSettings()
cli.set_model_settings_from_arguments(model_settings, args)
for filename in args.filelist:
isopachs, comments = isopach.read_isopach_file(filename)
results = cli.fit_isopachs(isopachs, model_settings)
if args.json:
cli.print_json_output(filename, results, model_settings, comments)
else:
cli.print_output(filename, results, model_settings, comments)
if args.plot:
cli.plot_results_figure(filename, results, model_settings,
comments)