Skip to content

cli

main()

Top-level command line interface to the workflows.

Source code in src/dolphin/cli.py
 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
def main() -> int:
    """Top-level command line interface to the workflows."""
    import sys

    from dolphin import __version__

    # TODO: Is there any way to slot this into tyro's argparse
    # Only found this hacky way
    # https://github.com/brentyi/tyro/issues/132#issuecomment-1978319762
    if len(sys.argv) > 1 and sys.argv[1] == "--version":
        print(__version__)
        raise SystemExit(os.EX_OK)

    import tyro

    from dolphin.filtering import filter_rasters
    from dolphin.geocode import run as run_geocode
    from dolphin.timeseries import run as run_timeseries
    from dolphin.unwrap import run as run_unwrap
    from dolphin.workflows._cli_config import ConfigCli

    tyro.extras.subcommand_cli_from_dict(
        {
            "run": run_cli,
            "config": ConfigCli,
            "unwrap": run_unwrap,
            "timeseries": run_timeseries,
            "filter": filter_rasters,
            "geocode": run_geocode,
        },
        prog=__package__,
    )

    return os.EX_OK

run_cli(config_file, /, debug=False)

Run the displacement workflow.

Parameters:

Name Type Description Default
config_file str

YAML file containing the workflow options.

required
debug bool

Enable debug logging, by default False.

False
Source code in src/dolphin/cli.py
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
def run_cli(
    config_file: str,
    /,
    debug: bool = False,
) -> None:
    """Run the displacement workflow.

    Parameters
    ----------
    config_file : str
        YAML file containing the workflow options.
    debug : bool, optional
        Enable debug logging, by default False.

    """
    from .workflows import displacement
    from .workflows.config import DisplacementWorkflow

    cfg = DisplacementWorkflow.from_yaml(config_file)
    displacement.run(cfg, debug=debug)