From 5f39577554a45efc1b7b734dd7b474f151722e78 Mon Sep 17 00:00:00 2001 From: Eugene Du Date: Wed, 11 Sep 2024 07:16:42 +0000 Subject: [PATCH 1/8] adjust variable names, logging levels, return fields --- gnssanalysis/gn_download.py | 52 +++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/gnssanalysis/gn_download.py b/gnssanalysis/gn_download.py index e3a8196..0618d73 100644 --- a/gnssanalysis/gn_download.py +++ b/gnssanalysis/gn_download.py @@ -503,27 +503,27 @@ def attempt_ftps_download( def attempt_url_download( - download_dir: _Path, url: str, filename: str = None, type_of_file: str = None, if_file_present: str = "prompt_user" + download_dir: _Path, url: str, download_filename: str = None, type_of_file: str = None, if_file_present: str = "prompt_user" ) -> _Path: """Attempt download of file given URL (url) to chosen location (download_dir) :param _Path download_dir: Where to download files (local directory) :param str url: URL to download - :param str filename: Filename to assign for the downloaded file, defaults to None + :param str download_filename: Filename to assign for the downloaded file, defaults to None :param str type_of_file: How to label the file for STDOUT messages, defaults to None :param str if_file_present: What to do if file already present: "replace", "dont_replace", defaults to "prompt_user" :return _Path: The pathlib.Path of the downloaded file """ - # If the filename is not provided, use the filename from the URL - if not filename: - filename = url[url.rfind("/") + 1 :] - logging.info(f"Attempting URL Download of {type_of_file} file - {filename} to {download_dir}") + # If the download_filename is not provided, use the filename from the URL + if not download_filename: + download_filename = url[url.rfind("/") + 1 :] + logging.info(f"Attempting URL Download of {type_of_file} file - {download_filename} to {download_dir}") # Use the check_whether_to_download function to determine whether to download the file download_filepath = check_whether_to_download( - filename=filename, download_dir=download_dir, if_file_present=if_file_present + filename=download_filename, download_dir=download_dir, if_file_present=if_file_present ) if download_filepath: - download_url(url, download_filepath) + download_filepath = download_url(url, download_filepath) return download_filepath @@ -751,7 +751,7 @@ def download_file_from_cddis( except _ftplib.all_errors as e: retries += 1 if retries > max_retries: - logging.info(f"Failed to download {filename} and reached maximum retry count ({max_retries}).") + logging.error(f"Failed to download {filename} and reached maximum retry count ({max_retries}).") if (output_folder / filename).is_file(): (output_folder / filename).unlink() raise e @@ -787,7 +787,7 @@ def download_product_from_cddis( project_type: str = "OPS", timespan: _datetime.timedelta = _datetime.timedelta(days=2), if_file_present: str = "prompt_user", -) -> None: +) -> List[_Path]: """Download the file/s from CDDIS based on start and end epoch, to the download directory (download_dir) :param _Path download_dir: Where to download files (local directory) @@ -803,6 +803,7 @@ def download_product_from_cddis( :param _datetime.timedelta timespan: Timespan of the file/s to download, defaults to _datetime.timedelta(days=2) :param str if_file_present: What to do if file already present: "replace", "dont_replace", defaults to "prompt_user" :raises FileNotFoundError: Raise error if the specified file cannot be found on CDDIS + :return List[_Path]: Return list of download files """ # Download the correct IGS FIN ERP files if file_ext == "ERP" and analysis_center == "IGS" and solution_type == "FIN": # get the correct start_epoch @@ -830,12 +831,15 @@ def download_product_from_cddis( logging.debug( f"Generated filename: {product_filename}, with GPS Date: {gps_date.gpswkD} and reference: {reference_start}" ) + + ensure_folders([download_dir]) + download_filepaths = [] with ftp_tls(CDDIS_FTP) as ftps: try: ftps.cwd(f"gnss/products/{gps_date.gpswk}") except _ftplib.all_errors as e: - logging.info(f"{reference_start} too recent") - logging.info(f"ftp_lib error: {e}") + logging.warning(f"{reference_start} too recent") + logging.warning(f"ftp_lib error: {e}") product_filename, gps_date, reference_start = generate_product_filename( reference_start, file_ext, @@ -851,7 +855,7 @@ def download_product_from_cddis( all_files = ftps.nlst() if not (product_filename in all_files): - logging.info(f"{product_filename} not in gnss/products/{gps_date.gpswk} - too recent") + logging.warning(f"{product_filename} not in gnss/products/{gps_date.gpswk} - too recent") raise FileNotFoundError # reference_start will be changed in the first run through while loop below @@ -877,12 +881,14 @@ def download_product_from_cddis( filename=product_filename, download_dir=download_dir, if_file_present=if_file_present ) if download_filepath: - download_file_from_cddis( - filename=product_filename, - ftp_folder=f"gnss/products/{gps_date.gpswk}", - output_folder=download_dir, - if_file_present=if_file_present, - note_filetype=file_ext, + download_filepaths.append( + download_file_from_cddis( + filename=product_filename, + ftp_folder=f"gnss/products/{gps_date.gpswk}", + output_folder=download_dir, + if_file_present=if_file_present, + note_filetype=file_ext, + ) ) count += 1 remain = end_epoch - reference_start @@ -912,7 +918,7 @@ def download_atx(download_dir: _Path, reference_frame: str = "IGS20", if_file_pr download_filepath = attempt_url_download( download_dir=download_dir, url=url_igs, - filename=atx_filename, + download_filename=atx_filename, type_of_file="ATX", if_file_present=if_file_present, ) @@ -920,7 +926,7 @@ def download_atx(download_dir: _Path, reference_frame: str = "IGS20", if_file_pr download_filepath = attempt_url_download( download_dir=download_dir, url=url_bern, - filename=atx_filename, + download_filename=atx_filename, type_of_file="ATX", if_file_present=if_file_present, ) @@ -938,7 +944,7 @@ def download_satellite_metadata_snx(download_dir: _Path, if_file_present: str = download_filepath = attempt_url_download( download_dir=download_dir, url=IGS_FILES_URL + "station/general/igs_satellite_metadata.snx", - filename="igs_satellite_metadata.snx", + download_filename="igs_satellite_metadata.snx", type_of_file="IGS satellite metadata", if_file_present=if_file_present, ) @@ -959,7 +965,7 @@ def download_yaw_files(download_dir: _Path, if_file_present: str = "prompt_user" download_filepath = attempt_url_download( download_dir=download_dir, url=PRODUCT_BASE_URL + "tables/" + filename, - filename=filename, + download_filename=filename, type_of_file="Yaw Model SNX", if_file_present=if_file_present, ) From 5b087d1b0b52d673976372e5f1683fac96057f0b Mon Sep 17 00:00:00 2001 From: Eugene Du Date: Wed, 11 Sep 2024 07:17:09 +0000 Subject: [PATCH 2/8] Add and fix download_iau2000_file() --- gnssanalysis/gn_download.py | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/gnssanalysis/gn_download.py b/gnssanalysis/gn_download.py index 0618d73..e78ca26 100644 --- a/gnssanalysis/gn_download.py +++ b/gnssanalysis/gn_download.py @@ -894,6 +894,55 @@ def download_product_from_cddis( remain = end_epoch - reference_start +def download_iau2000_file(download_dir: _Path, start_epoch: _datetime, if_file_present: str = "prompt_user"): + """ + Download relevant IAU2000 file from CDDIS or IERS based on start_epoch of data + """ + ensure_folders([download_dir]) + # Download most recent daily IAU2000 file if running for a session within the past week (data is within 3 months) + if _datetime.datetime.now() - start_epoch < _datetime.timedelta(weeks=1): + url_dir = "daily/" + iau2000_filename = "finals2000A.daily" + download_filename = "finals.daily.iau2000.txt" + logging.info("Attempting Download of finals2000A.daily file") + # Otherwise download the IAU2000 file dating back to 1992 + else: + url_dir = "standard/" + iau2000_filename = "finals2000A.data" + download_filename = "finals.data.iau2000.txt" + logging.info("Attempting Download of finals2000A.data file") + filetype = "EOP IAU2000" + + if not check_whether_to_download( + filename=download_filename, download_dir=download_dir, if_file_present=if_file_present + ): + return None + + # Attempt download from the CDDIS website first, if that fails try IERS + # Eugene: should try IERS first and then CDDIS? + try: + logging.info("Downloading IAU2000 file from CDDIS") + download_filepath = download_file_from_cddis( + filename=iau2000_filename, + ftp_folder="products/iers/", + output_folder=download_dir, + decompress=False, + if_file_present=if_file_present, + note_filetype=filetype + ) + download_filepath = download_filepath.rename(download_dir / download_filename) + except: + logging.info("Failed CDDIS download - Downloading IAU2000 file from IERS") + download_filepath = attempt_url_download( + download_dir=download_dir, + url="https://datacenter.iers.org/products/eop/rapid/" + url_dir + iau2000_filename, + download_filename=download_filename, + type_of_file=filetype, + if_file_present=if_file_present, + ) + return download_filepath + + def download_atx(download_dir: _Path, reference_frame: str = "IGS20", if_file_present: str = "prompt_user") -> _Path: """Download the ATX file necessary for running the PEA provided the download directory (download_dir) From 477158b2ceb5795cda18d17a86e227195a0e82da Mon Sep 17 00:00:00 2001 From: Eugene Du Date: Wed, 25 Sep 2024 07:24:26 +0000 Subject: [PATCH 3/8] Add version option in download_product_from_cddis() --- gnssanalysis/gn_download.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gnssanalysis/gn_download.py b/gnssanalysis/gn_download.py index e78ca26..77d246e 100644 --- a/gnssanalysis/gn_download.py +++ b/gnssanalysis/gn_download.py @@ -333,7 +333,7 @@ def generate_long_filename( :param _datetime.timedelta timespan: Timespan of data in file (Start to End epoch), defaults to None :param str solution_type: 3-char string identifier for Solution Type of file, defaults to "" :param str sampling_rate: 3-char string identifier for Sampling Rate of the file, defaults to "15M" - :param str version: 3-char string identifier for Version of the file + :param str version: 1-char string identifier for Version of the file :param str project: 3-char string identifier for Project Type of the file :return str: The IGS long filename given all inputs """ @@ -784,6 +784,7 @@ def download_product_from_cddis( analysis_center: str = "IGS", solution_type: str = "ULT", sampling_rate: str = "15M", + version: str = "0", project_type: str = "OPS", timespan: _datetime.timedelta = _datetime.timedelta(days=2), if_file_present: str = "prompt_user", @@ -826,6 +827,7 @@ def download_product_from_cddis( timespan=timespan, solution_type=solution_type, sampling_rate=sampling_rate, + version=version, project=project_type, ) logging.debug( @@ -849,6 +851,7 @@ def download_product_from_cddis( timespan=timespan, solution_type=solution_type, sampling_rate=sampling_rate, + version=version, project=project_type, ) ftps.cwd(f"gnss/products/{gps_date.gpswk}") @@ -875,6 +878,7 @@ def download_product_from_cddis( timespan=timespan, solution_type=solution_type, sampling_rate=sampling_rate, + version=version, project=project_type, ) download_filepath = check_whether_to_download( From 683260c07a94c3a1a0be02c68873a343c7b49d84 Mon Sep 17 00:00:00 2001 From: Eugene Du Date: Fri, 27 Sep 2024 04:43:10 +0000 Subject: [PATCH 4/8] Revert argunemt name changes to attempt_url_download() --- gnssanalysis/gn_download.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/gnssanalysis/gn_download.py b/gnssanalysis/gn_download.py index 77d246e..23dffd8 100644 --- a/gnssanalysis/gn_download.py +++ b/gnssanalysis/gn_download.py @@ -503,24 +503,24 @@ def attempt_ftps_download( def attempt_url_download( - download_dir: _Path, url: str, download_filename: str = None, type_of_file: str = None, if_file_present: str = "prompt_user" + download_dir: _Path, url: str, filename: str = None, type_of_file: str = None, if_file_present: str = "prompt_user" ) -> _Path: """Attempt download of file given URL (url) to chosen location (download_dir) :param _Path download_dir: Where to download files (local directory) :param str url: URL to download - :param str download_filename: Filename to assign for the downloaded file, defaults to None + :param str filename: Filename to assign for the downloaded file, defaults to None :param str type_of_file: How to label the file for STDOUT messages, defaults to None :param str if_file_present: What to do if file already present: "replace", "dont_replace", defaults to "prompt_user" :return _Path: The pathlib.Path of the downloaded file """ # If the download_filename is not provided, use the filename from the URL - if not download_filename: - download_filename = url[url.rfind("/") + 1 :] - logging.info(f"Attempting URL Download of {type_of_file} file - {download_filename} to {download_dir}") + if not filename: + filename = url[url.rfind("/") + 1 :] + logging.info(f"Attempting URL Download of {type_of_file} file - {filename} to {download_dir}") # Use the check_whether_to_download function to determine whether to download the file download_filepath = check_whether_to_download( - filename=download_filename, download_dir=download_dir, if_file_present=if_file_present + filename=filename, download_dir=download_dir, if_file_present=if_file_present ) if download_filepath: download_filepath = download_url(url, download_filepath) @@ -940,7 +940,7 @@ def download_iau2000_file(download_dir: _Path, start_epoch: _datetime, if_file_p download_filepath = attempt_url_download( download_dir=download_dir, url="https://datacenter.iers.org/products/eop/rapid/" + url_dir + iau2000_filename, - download_filename=download_filename, + filename=download_filename, type_of_file=filetype, if_file_present=if_file_present, ) @@ -971,7 +971,7 @@ def download_atx(download_dir: _Path, reference_frame: str = "IGS20", if_file_pr download_filepath = attempt_url_download( download_dir=download_dir, url=url_igs, - download_filename=atx_filename, + filename=atx_filename, type_of_file="ATX", if_file_present=if_file_present, ) @@ -979,7 +979,7 @@ def download_atx(download_dir: _Path, reference_frame: str = "IGS20", if_file_pr download_filepath = attempt_url_download( download_dir=download_dir, url=url_bern, - download_filename=atx_filename, + filename=atx_filename, type_of_file="ATX", if_file_present=if_file_present, ) @@ -997,7 +997,7 @@ def download_satellite_metadata_snx(download_dir: _Path, if_file_present: str = download_filepath = attempt_url_download( download_dir=download_dir, url=IGS_FILES_URL + "station/general/igs_satellite_metadata.snx", - download_filename="igs_satellite_metadata.snx", + filename="igs_satellite_metadata.snx", type_of_file="IGS satellite metadata", if_file_present=if_file_present, ) @@ -1018,7 +1018,7 @@ def download_yaw_files(download_dir: _Path, if_file_present: str = "prompt_user" download_filepath = attempt_url_download( download_dir=download_dir, url=PRODUCT_BASE_URL + "tables/" + filename, - download_filename=filename, + filename=filename, type_of_file="Yaw Model SNX", if_file_present=if_file_present, ) From 14dba0ed5627d76df180cd466b63931ace755af7 Mon Sep 17 00:00:00 2001 From: Eugene Du Date: Fri, 27 Sep 2024 04:43:31 +0000 Subject: [PATCH 5/8] Fix empty return --- gnssanalysis/gn_download.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gnssanalysis/gn_download.py b/gnssanalysis/gn_download.py index 23dffd8..140b069 100644 --- a/gnssanalysis/gn_download.py +++ b/gnssanalysis/gn_download.py @@ -897,6 +897,8 @@ def download_product_from_cddis( count += 1 remain = end_epoch - reference_start + return download_filepaths + def download_iau2000_file(download_dir: _Path, start_epoch: _datetime, if_file_present: str = "prompt_user"): """ From bf84cd8beb46de2c9da8ee92e2eb23303028b5bc Mon Sep 17 00:00:00 2001 From: Eugene Du Date: Fri, 27 Sep 2024 06:33:23 +0000 Subject: [PATCH 6/8] Docstrings --- gnssanalysis/gn_download.py | 73 ++++++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 21 deletions(-) diff --git a/gnssanalysis/gn_download.py b/gnssanalysis/gn_download.py index 140b069..0e2be73 100644 --- a/gnssanalysis/gn_download.py +++ b/gnssanalysis/gn_download.py @@ -1,9 +1,12 @@ """ Functions to download files necessary for Ginan processing: sp3 -erp clk +erp rnx (including transformation from crx to rnx) +atx +sat meta +yaw """ import concurrent as _concurrent @@ -424,7 +427,9 @@ def generate_product_filename( def check_whether_to_download( - filename: str, download_dir: _Path, if_file_present: str = "prompt_user" + filename: str, + download_dir: _Path, + if_file_present: str = "prompt_user" ) -> Union[_Path, None]: """Determine whether to download given file (filename) to the desired location (download_dir) based on whether it is already present and what action to take if it is (if_file_present) @@ -432,7 +437,7 @@ def check_whether_to_download( :param str filename: Filename of the downloaded file :param _Path download_dir: Where to download files (local directory) :param str if_file_present: What to do if file already present: "replace", "dont_replace", defaults to "prompt_user" - :return _Path or None: pathlib.Path to the downloaded file if file should be downloaded, otherwise returns None + :return _Path or None: The pathlib.Path of the downloaded file if file should be downloaded, otherwise returns None """ # Flag to determine whether to download: download = None @@ -479,7 +484,7 @@ def attempt_ftps_download( filename: str, type_of_file: str = None, if_file_present: str = "prompt_user", -) -> _Path: +) -> Union[_Path, None]: """Attempt download of file (filename) given the ftps client object (ftps) to chosen location (download_dir) :param _Path download_dir: Where to download files (local directory) @@ -487,7 +492,7 @@ def attempt_ftps_download( :param str filename: Filename to assign for the downloaded file :param str type_of_file: How to label the file for STDOUT messages, defaults to None :param str if_file_present: What to do if file already present: "replace", "dont_replace", defaults to "prompt_user" - :return _Path: The pathlib.Path of the downloaded file + :return _Path or None: The pathlib.Path of the downloaded file if successful, otherwise returns None """ "" logging.info(f"Attempting FTPS Download of {type_of_file} file - {filename} to {download_dir}") @@ -503,8 +508,12 @@ def attempt_ftps_download( def attempt_url_download( - download_dir: _Path, url: str, filename: str = None, type_of_file: str = None, if_file_present: str = "prompt_user" -) -> _Path: + download_dir: _Path, + url: str, + filename: str = None, + type_of_file: str = None, + if_file_present: str = "prompt_user" +) -> Union[_Path, None]: """Attempt download of file given URL (url) to chosen location (download_dir) :param _Path download_dir: Where to download files (local directory) @@ -512,7 +521,7 @@ def attempt_url_download( :param str filename: Filename to assign for the downloaded file, defaults to None :param str type_of_file: How to label the file for STDOUT messages, defaults to None :param str if_file_present: What to do if file already present: "replace", "dont_replace", defaults to "prompt_user" - :return _Path: The pathlib.Path of the downloaded file + :return _Path or None: The pathlib.Path of the downloaded file if successful, otherwise returns None """ # If the download_filename is not provided, use the filename from the URL if not filename: @@ -715,7 +724,7 @@ def download_file_from_cddis( decompress: bool = True, if_file_present: str = "prompt_user", note_filetype: str = None, -) -> _Path: +) -> Union[_Path, None]: """Downloads a single file from the CDDIS ftp server :param str filename: Name of the file to download @@ -726,7 +735,7 @@ def download_file_from_cddis( :param str if_file_present: What to do if file already present: "replace", "dont_replace", defaults to "prompt_user" :param str note_filetype: How to label the file for STDOUT messages, defaults to None :raises e: Raise any error that is run into by ftplib - :return _Path: The pathlib.Path of the downloaded file + :return _Path or None: The pathlib.Path of the downloaded file if successful, otherwise returns None """ with ftp_tls(CDDIS_FTP) as ftps: ftps.cwd(ftp_folder) @@ -762,7 +771,11 @@ def download_file_from_cddis( return download_filepath -def download_multiple_files_from_cddis(files: List[str], ftp_folder: str, output_folder: _Path) -> None: +def download_multiple_files_from_cddis( + files: List[str], + ftp_folder: str, + output_folder: _Path +) -> None: """Downloads multiple files in a single folder from cddis in a thread pool. :param files: List of str filenames @@ -804,7 +817,7 @@ def download_product_from_cddis( :param _datetime.timedelta timespan: Timespan of the file/s to download, defaults to _datetime.timedelta(days=2) :param str if_file_present: What to do if file already present: "replace", "dont_replace", defaults to "prompt_user" :raises FileNotFoundError: Raise error if the specified file cannot be found on CDDIS - :return List[_Path]: Return list of download files + :return List[_Path]: Return list of paths of downloaded files """ # Download the correct IGS FIN ERP files if file_ext == "ERP" and analysis_center == "IGS" and solution_type == "FIN": # get the correct start_epoch @@ -900,9 +913,17 @@ def download_product_from_cddis( return download_filepaths -def download_iau2000_file(download_dir: _Path, start_epoch: _datetime, if_file_present: str = "prompt_user"): - """ - Download relevant IAU2000 file from CDDIS or IERS based on start_epoch of data +def download_iau2000_file( + download_dir: _Path, + start_epoch: _datetime, + if_file_present: str = "prompt_user" +) -> Union[_Path, None]: + """Download relevant IAU2000 file from CDDIS or IERS based on start_epoch of data + + :param _Path download_dir: Where to download files (local directory) + :param _datetime start_epoch: Start epoch of data in file + :param str if_file_present: What to do if file already present: "replace", "dont_replace", defaults to "prompt_user" + :return _Path or None: The pathlib.Path of the downloaded file if successful, otherwise returns None """ ensure_folders([download_dir]) # Download most recent daily IAU2000 file if running for a session within the past week (data is within 3 months) @@ -949,14 +970,18 @@ def download_iau2000_file(download_dir: _Path, start_epoch: _datetime, if_file_p return download_filepath -def download_atx(download_dir: _Path, reference_frame: str = "IGS20", if_file_present: str = "prompt_user") -> _Path: +def download_atx( + download_dir: _Path, + reference_frame: str = "IGS20", + if_file_present: str = "prompt_user" +) -> Union[_Path, None]: """Download the ATX file necessary for running the PEA provided the download directory (download_dir) :param _Path download_dir: Where to download files (local directory) :param str reference_frame: Coordinate reference frame file to download, defaults to "IGS20" :param str if_file_present: What to do if file already present: "replace", "dont_replace", defaults to "prompt_user" :raises ValueError: If an invalid option is given for reference_frame variable - :return _Path: The pathlib.Path of the downloaded file + :return _Path or None: The pathlib.Path of the downloaded file if successful, otherwise returns None """ reference_frame_to_filename = {"IGS20": "igs20.atx", "IGb14": "igs14.atx"} try: @@ -988,12 +1013,15 @@ def download_atx(download_dir: _Path, reference_frame: str = "IGS20", if_file_pr return download_filepath -def download_satellite_metadata_snx(download_dir: _Path, if_file_present: str = "prompt_user") -> _Path: +def download_satellite_metadata_snx( + download_dir: _Path, + if_file_present: str = "prompt_user" +) -> Union[_Path, None]: """Download the most recent IGS satellite metadata file :param _Path download_dir: Where to download files (local directory) :param str if_file_present: What to do if file already present: "replace", "dont_replace", defaults to "prompt_user" - :return _Path: The pathlib.Path of the downloaded file + :return _Path or None: The pathlib.Path of the downloaded file if successful, otherwise returns None """ ensure_folders([download_dir]) download_filepath = attempt_url_download( @@ -1006,12 +1034,15 @@ def download_satellite_metadata_snx(download_dir: _Path, if_file_present: str = return download_filepath -def download_yaw_files(download_dir: _Path, if_file_present: str = "prompt_user") -> List[_Path]: +def download_yaw_files( + download_dir: _Path, + if_file_present: str = "prompt_user" +) -> List[_Path]: """Download yaw rate / bias files needed to for Ginan's PEA :param _Path download_dir: Where to download files (local directory) :param str if_file_present: What to do if file already present: "replace", "dont_replace", defaults to "prompt_user" - :return List[_Path]: Return list of download files + :return List[_Path]: Return list paths of downloaded files """ ensure_folders([download_dir]) download_filepaths = [] From c9c620390f49e59116941a9384e47ee2471812bd Mon Sep 17 00:00:00 2001 From: Eugene Du Date: Fri, 27 Sep 2024 07:00:55 +0000 Subject: [PATCH 7/8] , --- gnssanalysis/gn_download.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gnssanalysis/gn_download.py b/gnssanalysis/gn_download.py index 0e2be73..7464cb4 100644 --- a/gnssanalysis/gn_download.py +++ b/gnssanalysis/gn_download.py @@ -429,7 +429,7 @@ def generate_product_filename( def check_whether_to_download( filename: str, download_dir: _Path, - if_file_present: str = "prompt_user" + if_file_present: str = "prompt_user", ) -> Union[_Path, None]: """Determine whether to download given file (filename) to the desired location (download_dir) based on whether it is already present and what action to take if it is (if_file_present) @@ -512,7 +512,7 @@ def attempt_url_download( url: str, filename: str = None, type_of_file: str = None, - if_file_present: str = "prompt_user" + if_file_present: str = "prompt_user", ) -> Union[_Path, None]: """Attempt download of file given URL (url) to chosen location (download_dir) @@ -774,7 +774,7 @@ def download_file_from_cddis( def download_multiple_files_from_cddis( files: List[str], ftp_folder: str, - output_folder: _Path + output_folder: _Path, ) -> None: """Downloads multiple files in a single folder from cddis in a thread pool. @@ -916,7 +916,7 @@ def download_product_from_cddis( def download_iau2000_file( download_dir: _Path, start_epoch: _datetime, - if_file_present: str = "prompt_user" + if_file_present: str = "prompt_user", ) -> Union[_Path, None]: """Download relevant IAU2000 file from CDDIS or IERS based on start_epoch of data @@ -973,7 +973,7 @@ def download_iau2000_file( def download_atx( download_dir: _Path, reference_frame: str = "IGS20", - if_file_present: str = "prompt_user" + if_file_present: str = "prompt_user", ) -> Union[_Path, None]: """Download the ATX file necessary for running the PEA provided the download directory (download_dir) @@ -1015,7 +1015,7 @@ def download_atx( def download_satellite_metadata_snx( download_dir: _Path, - if_file_present: str = "prompt_user" + if_file_present: str = "prompt_user", ) -> Union[_Path, None]: """Download the most recent IGS satellite metadata file @@ -1036,7 +1036,7 @@ def download_satellite_metadata_snx( def download_yaw_files( download_dir: _Path, - if_file_present: str = "prompt_user" + if_file_present: str = "prompt_user", ) -> List[_Path]: """Download yaw rate / bias files needed to for Ginan's PEA From a20fdb5cbdff2a907ab3bd985b46105df7cdf692 Mon Sep 17 00:00:00 2001 From: Eugene Du Date: Tue, 1 Oct 2024 00:15:48 +0000 Subject: [PATCH 8/8] Formatting --- gnssanalysis/gn_download.py | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/gnssanalysis/gn_download.py b/gnssanalysis/gn_download.py index 7464cb4..5cec397 100644 --- a/gnssanalysis/gn_download.py +++ b/gnssanalysis/gn_download.py @@ -427,9 +427,7 @@ def generate_product_filename( def check_whether_to_download( - filename: str, - download_dir: _Path, - if_file_present: str = "prompt_user", + filename: str, download_dir: _Path, if_file_present: str = "prompt_user" ) -> Union[_Path, None]: """Determine whether to download given file (filename) to the desired location (download_dir) based on whether it is already present and what action to take if it is (if_file_present) @@ -508,11 +506,7 @@ def attempt_ftps_download( def attempt_url_download( - download_dir: _Path, - url: str, - filename: str = None, - type_of_file: str = None, - if_file_present: str = "prompt_user", + download_dir: _Path, url: str, filename: str = None, type_of_file: str = None, if_file_present: str = "prompt_user" ) -> Union[_Path, None]: """Attempt download of file given URL (url) to chosen location (download_dir) @@ -771,11 +765,7 @@ def download_file_from_cddis( return download_filepath -def download_multiple_files_from_cddis( - files: List[str], - ftp_folder: str, - output_folder: _Path, -) -> None: +def download_multiple_files_from_cddis(files: List[str], ftp_folder: str, output_folder: _Path) -> None: """Downloads multiple files in a single folder from cddis in a thread pool. :param files: List of str filenames @@ -914,9 +904,7 @@ def download_product_from_cddis( def download_iau2000_file( - download_dir: _Path, - start_epoch: _datetime, - if_file_present: str = "prompt_user", + download_dir: _Path, start_epoch: _datetime, if_file_present: str = "prompt_user" ) -> Union[_Path, None]: """Download relevant IAU2000 file from CDDIS or IERS based on start_epoch of data @@ -971,9 +959,7 @@ def download_iau2000_file( def download_atx( - download_dir: _Path, - reference_frame: str = "IGS20", - if_file_present: str = "prompt_user", + download_dir: _Path, reference_frame: str = "IGS20", if_file_present: str = "prompt_user" ) -> Union[_Path, None]: """Download the ATX file necessary for running the PEA provided the download directory (download_dir) @@ -1013,10 +999,7 @@ def download_atx( return download_filepath -def download_satellite_metadata_snx( - download_dir: _Path, - if_file_present: str = "prompt_user", -) -> Union[_Path, None]: +def download_satellite_metadata_snx(download_dir: _Path, if_file_present: str = "prompt_user") -> Union[_Path, None]: """Download the most recent IGS satellite metadata file :param _Path download_dir: Where to download files (local directory) @@ -1034,10 +1017,7 @@ def download_satellite_metadata_snx( return download_filepath -def download_yaw_files( - download_dir: _Path, - if_file_present: str = "prompt_user", -) -> List[_Path]: +def download_yaw_files(download_dir: _Path, if_file_present: str = "prompt_user") -> List[_Path]: """Download yaw rate / bias files needed to for Ginan's PEA :param _Path download_dir: Where to download files (local directory)