diff --git a/workflow/scripts/satellite-overpass-identification-tool/pass_time_cylc.py b/workflow/scripts/satellite-overpass-identification-tool/pass_time_cylc.py index 9bcb637f..f6f2fb2e 100644 --- a/workflow/scripts/satellite-overpass-identification-tool/pass_time_cylc.py +++ b/workflow/scripts/satellite-overpass-identification-tool/pass_time_cylc.py @@ -4,7 +4,6 @@ # "requests==2.31.0", # "skyfield==1.45.0", # "numpy==1.26", -# "typer" # ] # /// @@ -34,9 +33,6 @@ import numpy as np import csv import math -import typer -import pathlib -from typing_extensions import Annotated # URLs for space track login. uriBase = "https://www.space-track.org" @@ -332,80 +328,61 @@ def find_closest_pass(passes, ascending=True): return aqua_closest, terra_closest -app = typer.Typer() - - -@app.command() -def main( - SPACEUSER: Annotated[ - str, - typer.Option( - "--SPACEUSER", - "-u", - help="space-track.org username") - ], - SPACEPSWD: Annotated[ - str, - typer.Option( - "--SPACEPSWD", - "-p", - help="space-track.org password", - ), - ], - start_date: Annotated[ - str, - typer.Option( - "--startdate", - help="Start date in format YYYY-MM-DD", - metavar="YYYY-MM-DD", - parser=_parsedate, - ), - ], - end_date: Annotated[ - str, - typer.Option( - "--enddate", - help="End date in format YYYY-MM-DD", - metavar="YYYY-MM-DD", - parser=_parsedate, - ), - ], - lat: Annotated[ - float, - typer.Option( - "--centroid-lat", - "--lat", - help="latitude of bounding box centroid", - ), - ], - lon: Annotated[ - float, - typer.Option( - "--centroid-lon", - "--lon", - help="longitude of bounding box centroid", - ), - ], - csvoutpath: Annotated[ - pathlib.Path, - typer.Option( - "--csvoutpath", - help="Path to output CSV file", - ), - ], -): - """Aqua and Terra Satellite Overpass time tool""" - - get_passtimes( - start_date=start_date, - end_date=end_date, - csvoutpath=csvoutpath, - lat=lat, - lon=lon, - SPACEUSER=SPACEUSER, - SPACEPSWD=SPACEPSWD, + +def main(): + parser = argparse.ArgumentParser( + description="Aqua and Terra Satellite Overpass time tool" + ) + parser.add_argument( + "--SPACEUSER", + "-u", + type=str, + help="space-track.org username", + ) + parser.add_argument( + "--SPACEPSWD", + "-p", + type=str, + help="space-track.org password", + ) + parser.add_argument( + "--startdate", + type=_parsedate, + dest="start_date", + help="Start date in format YYYY-MM-DD", + ) + parser.add_argument( + "--enddate", + type=_parsedate, + dest="end_date", + help="End date in format YYYY-MM-DD", ) + parser.add_argument( + "--centroid-lat", + "--lat", + metavar="lat", + dest="lat", + type=float, + help="latitude of bounding box centroid", + ) + parser.add_argument( + "--centroid-lon", + "--lon", + metavar="lon", + dest="lon", + type=float, + help="longitude of bounding box centroid", + ) + parser.add_argument( + "--csvoutpath", + type=str, + help="Path to output CSV file", + ) + + args = parser.parse_args() + + get_passtimes(**vars(args)) if __name__ == "__main__": - app() + main() \ No newline at end of file