transformez 0.4.0__tar.gz → 0.4.2__tar.gz
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.
- {transformez-0.4.0 → transformez-0.4.2}/PKG-INFO +2 -2
- {transformez-0.4.0 → transformez-0.4.2}/pyproject.toml +1 -1
- {transformez-0.4.0 → transformez-0.4.2}/src/transformez/_version.py +1 -1
- {transformez-0.4.0 → transformez-0.4.2}/src/transformez/cli.py +58 -19
- {transformez-0.4.0 → transformez-0.4.2}/src/transformez/srs.py +17 -2
- {transformez-0.4.0 → transformez-0.4.2}/AUTHORS.md +0 -0
- {transformez-0.4.0 → transformez-0.4.2}/CHANGELOG.md +0 -0
- {transformez-0.4.0 → transformez-0.4.2}/CITATION.cff +0 -0
- {transformez-0.4.0 → transformez-0.4.2}/CONTRIBUTING.md +0 -0
- {transformez-0.4.0 → transformez-0.4.2}/LICENSE +0 -0
- {transformez-0.4.0 → transformez-0.4.2}/README.md +0 -0
- {transformez-0.4.0 → transformez-0.4.2}/src/transformez/__init__.py +0 -0
- /transformez-0.4.0/src/transformez/spatial.py → /transformez-0.4.2/src/transformez/_spatial.py +0 -0
- {transformez-0.4.0 → transformez-0.4.2}/src/transformez/api.py +0 -0
- {transformez-0.4.0 → transformez-0.4.2}/src/transformez/definitions.py +0 -0
- {transformez-0.4.0 → transformez-0.4.2}/src/transformez/grid_engine.py +0 -0
- {transformez-0.4.0 → transformez-0.4.2}/src/transformez/hooks.py +0 -0
- {transformez-0.4.0 → transformez-0.4.2}/src/transformez/htdp.py +0 -0
- {transformez-0.4.0 → transformez-0.4.2}/src/transformez/modules.py +0 -0
- {transformez-0.4.0 → transformez-0.4.2}/src/transformez/transform.py +0 -0
- {transformez-0.4.0 → transformez-0.4.2}/src/transformez/utils.py +0 -0
- {transformez-0.4.0 → transformez-0.4.2}/src/transformez/vdatum.py +0 -0
- {transformez-0.4.0 → transformez-0.4.2}/tests/test_cli.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: transformez
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: A standalone utility for vertical elevation datum transformations.
|
|
5
5
|
Project-URL: Homepage, https://github.com/continuous-dems/transformez
|
|
6
6
|
Project-URL: Issues, https://github.com/continuous-dems/transformez/issues
|
|
@@ -35,7 +35,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
35
35
|
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
36
36
|
Requires-Python: >=3.12
|
|
37
37
|
Requires-Dist: click
|
|
38
|
-
Requires-Dist: fetchez>=0.
|
|
38
|
+
Requires-Dist: fetchez>=0.6.0
|
|
39
39
|
Requires-Dist: fiona
|
|
40
40
|
Requires-Dist: numpy>1.24
|
|
41
41
|
Requires-Dist: pyproj>3.6.1
|
|
@@ -13,20 +13,21 @@ The command-line interface for Transformez.
|
|
|
13
13
|
|
|
14
14
|
import sys
|
|
15
15
|
import click
|
|
16
|
-
import logging
|
|
17
|
-
from transformez import api
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
from fetchez.utils import FetchezMainGroup, FetchezMainCommand
|
|
18
|
+
from fetchez.cli import setup_logging
|
|
19
|
+
|
|
20
|
+
from transformez import api
|
|
20
21
|
|
|
21
22
|
|
|
22
|
-
class
|
|
23
|
+
class TransformezMainGroup(FetchezMainGroup):
|
|
23
24
|
"""A custom Click Group that handles deprecated aliases."""
|
|
24
25
|
|
|
25
26
|
def get_command(self, ctx, cmd_name):
|
|
26
27
|
if cmd_name == "run":
|
|
27
28
|
click.secho(
|
|
28
29
|
" DEPRECATION WARNING: 'transformez run' is deprecated and will be removed in a future release.\n"
|
|
29
|
-
"Please use 'transformez grid' to generate shift grids
|
|
30
|
+
"Please use 'transformez grid' to generate shift grids or 'transformez raster' to shift a raster.",
|
|
30
31
|
fg="yellow",
|
|
31
32
|
err=True,
|
|
32
33
|
)
|
|
@@ -34,17 +35,53 @@ class AliasedGroup(click.Group):
|
|
|
34
35
|
|
|
35
36
|
return click.Group.get_command(self, ctx, cmd_name)
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
# def format_commands(self, ctx, formatter):
|
|
39
|
+
# commands = []
|
|
40
|
+
# for subcommand in self.list_commands(ctx):
|
|
41
|
+
# cmd = self.get_command(ctx, subcommand)
|
|
42
|
+
# if cmd is None or cmd.hidden:
|
|
43
|
+
# continue
|
|
44
|
+
# commands.append((subcommand, cmd))
|
|
45
|
+
|
|
46
|
+
# if not commands:
|
|
47
|
+
# return
|
|
48
|
+
|
|
49
|
+
# categories = {
|
|
50
|
+
# f"{colorize('Execution', YELLOW)}": ["run", "grid", "raster"],
|
|
51
|
+
# f"{colorize('Discovery & Management', YELLOW)}": [
|
|
52
|
+
# "list",
|
|
53
|
+
# "htdp",
|
|
54
|
+
# "vdatum",
|
|
55
|
+
# ],
|
|
56
|
+
# }
|
|
57
|
+
|
|
58
|
+
# for cat_name, cmd_names in categories.items():
|
|
59
|
+
# with formatter.section(cat_name):
|
|
60
|
+
# cat_cmds = [
|
|
61
|
+
# (f"{colorize(name, BOLD):<17}", cmd.get_short_help_str(limit=80))
|
|
62
|
+
# for name, cmd in commands
|
|
63
|
+
# if name in cmd_names
|
|
64
|
+
# ]
|
|
65
|
+
# formatter.write_dl(cat_cmds)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
@click.group(
|
|
69
|
+
name="transform",
|
|
70
|
+
cls=TransformezMainGroup,
|
|
71
|
+
fetchez_commands=["run", "grid", "raster", "list", "htdp", "vdatum"],
|
|
72
|
+
)
|
|
39
73
|
@click.version_option(package_name="transformez")
|
|
40
|
-
|
|
74
|
+
@click.option("--verbose", is_flag=True, help="Enable verbose debug logging.")
|
|
75
|
+
@click.option("--quiet", is_flag=True, help="Suppress non-error output.")
|
|
76
|
+
def transformez_cli(verbose, quiet):
|
|
41
77
|
"""Apply vertical datum transformations and generate shift grids."""
|
|
42
78
|
|
|
43
|
-
|
|
79
|
+
setup_logging(name="transformez", quiet=quiet, verbose=verbose)
|
|
80
|
+
# logging.basicConfig(level=logging.INFO, format="[%(levelname)s] %(message)s")
|
|
44
81
|
pass
|
|
45
82
|
|
|
46
83
|
|
|
47
|
-
@transformez_cli.command("run")
|
|
84
|
+
@transformez_cli.command("run", cls=FetchezMainCommand)
|
|
48
85
|
@click.argument("input_file", required=False)
|
|
49
86
|
@click.option(
|
|
50
87
|
"-R", "--region", help="Bounding box or location string (if no input file)."
|
|
@@ -160,7 +197,7 @@ def transform_run(
|
|
|
160
197
|
# =====================================================================
|
|
161
198
|
# GENERATE SHIFT GRID
|
|
162
199
|
# =====================================================================
|
|
163
|
-
@transformez_cli.command("grid")
|
|
200
|
+
@transformez_cli.command("grid", cls=FetchezMainCommand)
|
|
164
201
|
@click.option("-R", "--region", required=True, help="Bounding box or location string.")
|
|
165
202
|
@click.option("-E", "--increment", required=True, help="Resolution (e.g., 1s, 30m).")
|
|
166
203
|
@click.option(
|
|
@@ -232,7 +269,7 @@ def transform_grid(
|
|
|
232
269
|
# =====================================================================
|
|
233
270
|
# TRANSFORM EXISTING RASTER (DEM)
|
|
234
271
|
# =====================================================================
|
|
235
|
-
@transformez_cli.command("raster")
|
|
272
|
+
@transformez_cli.command("raster", cls=FetchezMainCommand)
|
|
236
273
|
@click.argument("input_file", type=click.Path(exists=True))
|
|
237
274
|
@click.option("-I", "--input-datum", required=True, help="Source Datum (e.g., 'mllw').")
|
|
238
275
|
@click.option(
|
|
@@ -269,7 +306,7 @@ def transform_raster(
|
|
|
269
306
|
decay_pixels,
|
|
270
307
|
use_stations,
|
|
271
308
|
):
|
|
272
|
-
"""Apply a vertical datum shift
|
|
309
|
+
"""Apply a vertical datum shift to an existing DEM."""
|
|
273
310
|
|
|
274
311
|
click.secho(f"Transforming raster: {input_file}", fg="cyan", bold=True)
|
|
275
312
|
click.echo(f" Shift: {input_datum} ➔ {output_datum}")
|
|
@@ -294,7 +331,7 @@ def transform_raster(
|
|
|
294
331
|
|
|
295
332
|
|
|
296
333
|
# --- LIST DATUMS, ETC. ---
|
|
297
|
-
@transformez_cli.command("list")
|
|
334
|
+
@transformez_cli.command("list", cls=FetchezMainCommand)
|
|
298
335
|
def transform_list():
|
|
299
336
|
"""List all supported vertical datums, EPSG codes, and geoids."""
|
|
300
337
|
try:
|
|
@@ -350,14 +387,14 @@ def transform_list():
|
|
|
350
387
|
|
|
351
388
|
|
|
352
389
|
# --- HTDP CLI GROUP ---
|
|
353
|
-
@transformez_cli.group("htdp")
|
|
390
|
+
@transformez_cli.group(cls=FetchezMainGroup, name="htdp", fetchez_commands=["install"])
|
|
354
391
|
def htdp_group():
|
|
355
392
|
"""Manage and run NGS HTDP (Horizontal Time-Dependent Positioning)."""
|
|
356
393
|
|
|
357
394
|
pass
|
|
358
395
|
|
|
359
396
|
|
|
360
|
-
@htdp_group.command("install")
|
|
397
|
+
@htdp_group.command("install", cls=FetchezMainCommand)
|
|
361
398
|
def install_htdp():
|
|
362
399
|
"""Downloads and compiles the HTDP executable."""
|
|
363
400
|
|
|
@@ -367,7 +404,9 @@ def install_htdp():
|
|
|
367
404
|
|
|
368
405
|
|
|
369
406
|
# --- VDATUM CLI GROUP ---
|
|
370
|
-
@transformez_cli.group(
|
|
407
|
+
@transformez_cli.group(
|
|
408
|
+
cls=FetchezMainGroup, name="vdatum", fetchez_commands=["install", "run"]
|
|
409
|
+
)
|
|
371
410
|
def vdatum_group():
|
|
372
411
|
"""Manage and run the NOAA VDatum Java engine."""
|
|
373
412
|
|
|
@@ -383,7 +422,7 @@ def install_vdatum():
|
|
|
383
422
|
install_vdatum_jar()
|
|
384
423
|
|
|
385
424
|
|
|
386
|
-
@vdatum_group.command("run")
|
|
425
|
+
@vdatum_group.command("run", cls=FetchezMainCommand)
|
|
387
426
|
@click.argument("input_file", type=click.Path(exists=True))
|
|
388
427
|
@click.argument("output_file", type=click.Path())
|
|
389
428
|
@click.option(
|
|
@@ -412,7 +451,7 @@ def run_vdatum_cli(
|
|
|
412
451
|
).run_vdatum(input_file)
|
|
413
452
|
|
|
414
453
|
|
|
415
|
-
@vdatum_group.command("list")
|
|
454
|
+
@vdatum_group.command("list", cls=FetchezMainCommand)
|
|
416
455
|
def vdatum_list():
|
|
417
456
|
"""List the supported vdatum grids"""
|
|
418
457
|
|
|
@@ -58,8 +58,18 @@ class SRSParser:
|
|
|
58
58
|
return parts[0], (parts[1] if len(parts) > 1 else None)
|
|
59
59
|
|
|
60
60
|
def _extract_vertical(self, srs_str):
|
|
61
|
-
parts = str(srs_str).split("+")
|
|
62
|
-
return parts[0], (parts[1] if len(parts) > 1 else None)
|
|
61
|
+
# parts = str(srs_str).split("+")
|
|
62
|
+
# return parts[0], (parts[1] if len(parts) > 1 else None)
|
|
63
|
+
if "+" in srs_str:
|
|
64
|
+
horz_str, vert_str = srs_str.rsplit("+", 1)
|
|
65
|
+
try:
|
|
66
|
+
if "EPSG" in vert_str.upper():
|
|
67
|
+
vert_str = vert_str.split(":")[-1]
|
|
68
|
+
return horz_str, int(vert_str)
|
|
69
|
+
except Exception as e:
|
|
70
|
+
logger.debug(f"Failed to build compound CRS from '{srs_str}': {e}")
|
|
71
|
+
return srs_str, None
|
|
72
|
+
return srs_str, None
|
|
63
73
|
|
|
64
74
|
def _get_epsg_int(self, crs):
|
|
65
75
|
"""Extract EPSG integer from a CRS."""
|
|
@@ -108,8 +118,12 @@ class SRSParser:
|
|
|
108
118
|
self.tc["dst_vert_epsg"] = self._get_epsg_int(self.tc["dst_crs"])
|
|
109
119
|
|
|
110
120
|
if self.tc["src_vert_epsg"] is None:
|
|
121
|
+
if vert_epsg_src is None:
|
|
122
|
+
_, vert_epsg_src = self._extract_vertical(self.src_srs_input)
|
|
111
123
|
self.tc["src_vert_epsg"] = vert_epsg_src
|
|
112
124
|
if self.tc["dst_vert_epsg"] is None:
|
|
125
|
+
if vert_epsg_dst is None:
|
|
126
|
+
_, vert_epsg_dst = self._extract_vertical(self.dst_srs_input)
|
|
113
127
|
self.tc["dst_vert_epsg"] = vert_epsg_dst
|
|
114
128
|
|
|
115
129
|
# Lookup default geoids
|
|
@@ -172,6 +186,7 @@ class SRSParser:
|
|
|
172
186
|
epsg_out=d_ident,
|
|
173
187
|
geoid_in=self.tc["src_geoid"],
|
|
174
188
|
geoid_out=self.tc["dst_geoid"],
|
|
189
|
+
cache_dir=self.cache_dir,
|
|
175
190
|
)
|
|
176
191
|
shift_arr, _ = vt._vertical_transform(vt.epsg_in, vt.epsg_out)
|
|
177
192
|
GridWriter.write(self.tc["trans_fn"], shift_arr, proc_region)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/transformez-0.4.0/src/transformez/spatial.py → /transformez-0.4.2/src/transformez/_spatial.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|