caf.cvt 0.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
caf/cvt/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ """Climate Vulnerability Tool to assess the climate vulnerability of the transport network."""
2
+
3
+ from ._version import __version__
caf/cvt/__main__.py ADDED
@@ -0,0 +1,57 @@
1
+ """Main script."""
2
+
3
+ import argparse
4
+ import logging
5
+ import pathlib
6
+ import warnings
7
+
8
+ import caf.toolkit as ctk
9
+
10
+ from caf import cvt
11
+ from caf.cvt.data_cleaning import data_cleaning
12
+ from caf.cvt.functional_rules import apply_functional_rules
13
+ from caf.cvt.layering import layering
14
+ from caf.cvt.model_config import Config
15
+
16
+ LOG = logging.getLogger(__name__)
17
+
18
+ warnings.filterwarnings(
19
+ "ignore",
20
+ message=r".*organizePolygons\(\) received a polygon with more than 100 parts.*",
21
+ category=RuntimeWarning,
22
+ module=r"pyogrio\.raw",
23
+ )
24
+
25
+
26
+ def _main() -> None:
27
+ """Run Climate Vulnerability Tool."""
28
+ parser = argparse.ArgumentParser(
29
+ __package__, description="CLI for the Climate Vulnerability Tool"
30
+ )
31
+ parser.add_argument(
32
+ "-c", "--config", help="Config file to use", type=pathlib.Path, default="config.yml"
33
+ )
34
+
35
+ args = parser.parse_args()
36
+ config = Config.load_yaml(args.config)
37
+ details = ctk.log_helpers.ToolDetails(__package__, cvt.__version__, full_version=None)
38
+
39
+ with ctk.LogHelper(__package__, details, log_file=config.paths.log_path / "cvt.log"):
40
+ if config.switches.run_data_cleaning:
41
+ LOG.info("Starting data cleaning step...")
42
+ data_cleaning(config)
43
+ LOG.info("Finished data cleaning step.")
44
+
45
+ if config.switches.run_functional_rules:
46
+ LOG.info("Starting functional rules step...")
47
+ apply_functional_rules(config)
48
+ LOG.info("Finished functional rules step.")
49
+
50
+ if config.switches.run_layering:
51
+ LOG.info("Starting layering step...")
52
+ layering(config)
53
+ LOG.info("Finished layering step.")
54
+
55
+
56
+ if __name__ == "__main__":
57
+ _main()
caf/cvt/_version.py ADDED
@@ -0,0 +1,15 @@
1
+ # Always get the current version in "editable" installs
2
+ # `pip install -e .` / `python setup.py develop`
3
+ def _get_version() -> str:
4
+ from pathlib import Path
5
+
6
+ from versioningit import get_version
7
+
8
+ return get_version(
9
+ project_dir=Path(__file__).parents[3],
10
+ )
11
+
12
+
13
+ # The following _get_version() call will get replaced by versioningit with a
14
+ # static version string during a build
15
+ __version__ = "0.1.1"