/
create_burnman_readable_perplex_table.py
37 lines (30 loc) · 1.9 KB
/
create_burnman_readable_perplex_table.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
30
31
32
33
34
35
36
37
from __future__ import absolute_import
from __future__ import print_function
# This file is part of BurnMan - a thermoelastic and thermodynamic toolkit for the Earth and Planetary Sciences
# Copyright (C) 2012 - 2015 by the BurnMan team, released under the GNU
# GPL v2 or later.
import argparse
import burnman_path # adds the local burnman directory to the path
from burnman.classes.perplex import create_perplex_table
assert burnman_path # silence pyflakes warning
parser = argparse.ArgumentParser(description='Call werami to create a burnman-readable tab file.')
parser.add_argument('--werami_path', metavar='path', type=str, nargs='+', required=True,
help='The path to werami')
parser.add_argument('--project', metavar='project name', type=str, nargs='+', required=True,
help='The name of the project file (without the suffix)')
parser.add_argument('--outfile', metavar='output file', type=str, nargs='+', required=True,
help='The name of the output table file')
parser.add_argument('--n_pressures', type=int, nargs=1, required=True,
help='The number of pressure steps in the grid')
parser.add_argument('--n_temperatures', type=int, nargs=1, required=True,
help='The number of pressure steps in the grid')
parser.add_argument('--pressure_range', type=float, nargs=2,
help='Minimum and maximum values of pressure (Pa; optional)')
parser.add_argument('--temperature_range', type=float, nargs=2,
help='Minimum and maximum values of temperature (K; optional)')
args = parser.parse_args()
if not hasattr(args, 'pressure_range'):
args.pressure_range = None
if not hasattr(args, 'temperature_range'):
args.temperature_range = None
create_perplex_table(args.werami_path, args.project[0], args.outfile[0], args.n_pressures[0], args.n_temperatures[0], args.pressure_range, args.temperature_range)