|
11 | 11 | from itertools import zip_longest |
12 | 12 |
|
13 | 13 |
|
14 | | -# _here = os.path.abspath(__file__) |
15 | | -# sys.path.insert(0, _here) |
16 | | -# |
17 | | -# from validator import Validator |
18 | | -# |
19 | | -# config = { |
20 | | -# 'geo_path': 'tmp/PM-MAR-MS-Arsinoes_01/vector/PM-MAR-MS-Arsinoes_01.gpkg', |
21 | | -# 'geopackage_tables': ['units', 'contacts'] |
22 | | -# } |
23 | 14 | import check |
24 | 15 |
|
25 | 16 | import logging |
@@ -75,28 +66,30 @@ def check_raster(pkg_specs, pkg_path): |
75 | 66 | def check_model(pkg_specs, pkg_path): |
76 | 67 | pass |
77 | 68 |
|
78 | | -def run(pkg_path): |
79 | | - #parse package name |
80 | | - pkg_name = os.path.basename(os.path.abspath(pkg_path)) |
81 | | - logger.debug(f"Package name: {pkg_name}") |
82 | | - pkg_specs = parse_package_name(pkg_name) |
83 | | - pkg_specs['name'] = pkg_name |
84 | | - logger.info(pkg_specs) |
| 69 | +def run(geopackage): |
| 70 | + from .validator import vector |
85 | 71 |
|
86 | 72 | # Check geopackage |
87 | | - out = check_vector(pkg_specs, pkg_path) |
| 73 | + out = vector.check(geopackage) |
88 | 74 |
|
89 | 75 |
|
90 | 76 | if __name__ == '__main__': |
91 | 77 | from argparse import ArgumentParser |
92 | 78 |
|
93 | 79 | parser = ArgumentParser() |
94 | | - parser.add_argument('path', type=str, |
95 | | - help="Path of PlanMap package") |
| 80 | + parser.add_argument('fname', type=str, |
| 81 | + help="Path of GeoPackage") |
| 82 | + parser.add_argument('--vector', default=False, action_store=True, |
| 83 | + help="Verifies a vector data file (GeoPackage)") |
| 84 | + parser.add_argument('--schema', type=str, |
| 85 | + help="File with metadata structure to use as model") |
96 | 86 |
|
97 | 87 | args = parser.parse_args() |
98 | | - pkg_path = args.path |
| 88 | + if not args.vector: |
| 89 | + print("Implemented for vectors only") |
| 90 | + sys.exit(1) |
99 | 91 |
|
100 | | - # res = run(args.cfg, args.log) |
| 92 | + fname = args.fname |
| 93 | + schema = args.schema |
101 | 94 |
|
102 | | - res = run(pkg_path) |
| 95 | + res = run(fname) |
0 commit comments