forked from LBaudoux/MLULC
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
41 lines (32 loc) · 1.05 KB
/
main.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
"""
__author__ = "Hager Rady and Mo'men AbdelRazek"
Main
-Capture the config file
-Process the json config passed
-Create an agent instance
-Run the agent
"""
import matplotlib
import argparse
from mmt.utils import config as utilconf
from mmt.agents import multiLULC
def main():
# Choose the appropriate backend (see: https://matplotlib.org/stable/users/explain/figure/backends.html)
matplotlib.use("AGG")
# Parse the path of the json config file
arg_parser = argparse.ArgumentParser(description="")
arg_parser.add_argument(
'config',
metavar='config_yaml_file',
default='None',
help='The configuration file in YAML format')
args = arg_parser.parse_args()
# Parse the config json file
config = utilconf.process_config(args.config)
# Create the Agent and pass all the configuration to it then run it..
agent_class = getattr(multiLULC, config.agent.type)
agent = agent_class(config, **config.agent.params)
agent.run()
agent.finalize()
if __name__ == '__main__':
main()