Skip to content

reproject

main()

This script resizes an image to a given ground sample distance (GSD) and compresses it a JPEG formatted image.

Source code in src/tcd_pipeline/scripts/reproject.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
def main():
    """This script resizes an image to a given ground sample distance (GSD) and
    compresses it a JPEG formatted image.
    """

    parser = argparse.ArgumentParser()

    parser.add_argument("input", type=str, help="Input image")
    parser.add_argument(
        "--compress_only", help="Only compress, don't resample", action="store_false"
    )
    parser.add_argument("--gsd", type=float, help="Ground sample distance", default=0.1)
    parser.add_argument("--inplace", help="Operate in place", action="store_true")

    args = parser.parse_args()

    convert_to_projected(
        args.input,
        inplace=(args.inplace == True),
        resample=args.compress_only,
        target_gsd_m=args.gsd,
    )