-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_geometry.py
executable file
·120 lines (95 loc) · 2.95 KB
/
make_geometry.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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import sys
import os
import logging
from optparse import OptionParser
from sverify import options_process
from sverify import options_obs
from sverify import svconfig
import sverify
# import cartopy.crs as ccrs
# import cartopy.feature as cfeature
"""
SCRIPT to obtain CEMS and AQS data
-----------
INPUTS:
inputs are detailed in the attributes of the ConfigFile class.
-----------------------------------------------
options.cems
svcems
options.obs
svobs
svmet
svish
"""
logger = logging.getLogger(__name__)
def main():
parser = OptionParser()
parser.add_option(
"-i",
type="string",
dest="configfile",
default="CONFIG.S",
help="Name of configuration file",
)
parser.add_option(
"-p",
action="store_true",
dest="print_help",
default=False,
help="Print help for configuration file",
)
parser.add_option(
"--debug",
action="store_true",
dest="debug",
default=False,
help="Print messages for debugging",
)
parser.add_option(
"--quiet",
action="store_false",
dest="verbose",
default=True,
help="Don't print messages"
)
(opts, args) = parser.parse_args()
logger.info('Creates file with distance and direction from')
logger.info('AQS measurement sites to CEMS and NEI sources.')
options = svconfig.ConfigFile(opts.configfile)
if opts.print_help:
print("-------------------------------------------------------------")
print("Configuration file options (key words are not case sensitive)")
print("-------------------------------------------------------------")
print(options.print_help(order=options.lorder))
sys.exit()
# options = svconfig.ConfigFile(opts.configfile)
# options.fileread is a boolean attribute of ConfigFile class.
if not options.fileread:
print("configuration file " + opts.configfile + " not found.\ngoodbye")
sys.exit()
##------------------------------------------------------##
##------------------------------------------------------##
# Process some of the options to create new parameters.
##------------------------------------------------------##
##------------------------------------------------------##
svp = options_process.main(options)
# TO DO - may pass svp rather than individual attributes to functions.
d1 = svp.d1
d2 = svp.d2
area = svp.area
#logfile = svp.logfile
logfile = "None"
source_chunks = svp.source_chunks
datem_chunks = svp.datem_chunks
tcmrun = svp.tcmrun
run_duration = svp.run_duration
rfignum = 1
options_obs.options_geometry(options,d1,d2,area)
if __name__ == "__main__":
if sys.argv.count("--debug") > 0:
log_level = logging.DEBUG
elif sys.argv.count("--quiet") == 0:
log_level = logging.INFO
else:
log_level = logging.WARNING
sverify.run(main, 'make_geometry.py', log_level = log_level)