Skip to content

Commit

Permalink
Merge branch 'main' into experimenter_bug
Browse files Browse the repository at this point in the history
  • Loading branch information
barneydobson committed May 28, 2024
2 parents b66352b + 7ec7209 commit 0170d46
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion swmmanywhere/__main__.py
Original file line number Diff line number Diff line change
@@ -1 +1,45 @@
"""The entry point for the myproject program."""
"""The entry point for the swmmanywhere program."""
from __future__ import annotations

import argparse
import os
from pathlib import Path

from swmmanywhere import swmmanywhere
from swmmanywhere.custom_logging import logger


def parse_arguments():
"""Parse the command line arguments.
Returns:
Path: The path to the configuration file.
"""
parser = argparse.ArgumentParser(description='Process command line arguments.')
parser.add_argument('--config_path',
type=Path,
default=Path(__file__).parent.parent / 'tests' /\
'test_data' / 'demo_config.yml',
help='Configuration file path')
parser.add_argument('--verbose',
type=bool,
default=False,
help='Configuration verbosity')
args = parser.parse_args()
return args.config_path, args.verbose

def run():
"""Run a swmmanywhere config file."""
# Parse the arguments
config_path, verbose = parse_arguments()
os.environ["SWMMANYWHERE_VERBOSE"] = str(verbose).lower()

config = swmmanywhere.load_config(config_path)

# Run the model
inp, metrics = swmmanywhere.swmmanywhere(config)
logger.info(f"Model run complete. Results saved to {inp}")
logger.info(f"Metrics:\n {metrics}")

if __name__ == '__main__':
run()

0 comments on commit 0170d46

Please sign in to comment.