Skip to content

Commit

Permalink
start implementing a stricter orbit type selection
Browse files Browse the repository at this point in the history
  • Loading branch information
scottstanie committed Jan 24, 2024
1 parent 8a4d06c commit 5812b0d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
4 changes: 2 additions & 2 deletions eof/asf_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ def get_download_urls(self, orbit_dts, missions, orbit_type="precise"):
remaining_orbits.append((dt, mission))

if remaining_orbits:
logger.warning("The following dates were not found: %s", remaining_orbits)
logger.info("The following dates were not found: %s", remaining_orbits)
if orbit_type == "precise":
logger.warning(
logger.info(
"Attempting to download the restituted orbits for these dates."
)
remaining_dts, remaining_missions = zip(*remaining_orbits)
Expand Down
9 changes: 5 additions & 4 deletions eof/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@
)
@click.option(
"--orbit-type",
type=click.Choice(["precise", "restituted"]),
default="precise",
help="Optionally specify the type of orbit file to get "
"(default: precise (POEORB), but fallback to restituted (RESORB))",
type=click.Choice(["precise", "restituted", None]),
default=None,
help="Optionally specify the type of orbit file to get. "
"If None, will attempt precise (POEORB) but fallback to restituted (RESORB)."
" Otherwise, will fail if selected orbit type is not available.",
)
@click.option(
"--force-asf",
Expand Down
14 changes: 11 additions & 3 deletions eof/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import os
from multiprocessing.pool import ThreadPool
from pathlib import Path
from typing import Literal, Optional

from dateutil.parser import parse
from requests.exceptions import HTTPError
Expand All @@ -45,7 +46,7 @@ def download_eofs(
missions=None,
sentinel_file=None,
save_dir=".",
orbit_type="precise",
orbit_type: Optional[Literal["precise", "restituted"]] = None,
force_asf: bool = False,
asf_user: str = "",
asf_password: str = "",
Expand All @@ -61,7 +62,14 @@ def download_eofs(
No input downloads both, must be same len as orbit_dts
sentinel_file (str): path to Sentinel-1 filename to download one .EOF for
save_dir (str): directory to save the EOF files into
orbit_type (str): precise or restituted
orbit_type (str): "precise" or "restituted", optional.
If None, will attempt "precise" first, then fallback to "restituted"
force_asf (bool): force download from ASF even if credentials are provided
asf_user (str): ASF username
asf_password (str): ASF password
cdse_user (str): CDSE username
cdse_password (str): CDSE password
max_workers (int): number of workers to use for parallel downloads
Returns:
list[str]: all filenames of saved orbit files
Expand Down Expand Up @@ -204,7 +212,7 @@ def main(
sentinel_file=None,
mission=None,
date=None,
orbit_type="precise",
orbit_type: Optional[Literal["precise", "restituted"]] = None,
force_asf: bool = False,
asf_user: str = "",
asf_password: str = "",
Expand Down

0 comments on commit 5812b0d

Please sign in to comment.