geodezyx.operational.download_gnss package

download_gnss – GNSS data & product download subpackage.

Re-exports everything from the three constituent modules so that the parent package geodezyx.operational can simply do:

from .download_gnss import *

Submodules

geodezyx.operational.download_gnss.download_prods module

@author: psakic This sub-module of geodezyx.operational contains functions to download gnss data and products from distant IGS servers. it can be imported directly with: from geodezyx import operational The geodezyx toolbox is a software for simple but useful functions for Geodesy and Geophysics under the GNU LGPL v3 License Copyright (C) 2019 Pierre Sakic et al. (IPGP, sakic@ipgp.fr) GitHub repository : https://github.com/GeodeZYX/geodezyx-toolbox

geodezyx.operational.download_gnss.download_prods.download_gnss_products(archive_dir, startdate, enddate=None, ac_names=('grg', 'cod'), prod_types=('sp3', 'clk'), remove_patterns=('ULA',), archtype='week', new_name_conv=True, parallel_download=1, archive_center='ign', mgex=False, repro=0, return_also_uncompressed_files=True, dow_manu=False, quiet_mode=False, force=False, path_ftp_crawled_files_save=None, path_ftp_crawled_files_load=None, skip_crawl=False, path_all_ftp_files_save=None)

Download GNSS products from different IGS data centers.

Uses a unified table-based crawl approach shared with download_gnss_rinex: first builds a crawl table, then crawls the FTP server to locate available files (checking local existence first), and finally downloads the matched files.

Parameters:
  • archive_dir (str) – the parent directory where the products will be stored.

  • startdate (datetime or list of datetime) – the start date in regular calendar date.

  • enddate (datetime or None) – the end date in regular calendar date. If None, only the startdate is be considered as a date list.

  • ac_names (tuple, optional) – the names of the wished analysis centers. It also control the product’s lattency with the new naming convention: simply add it completly in the AC name e.g. IGS0OPSRAP The default is (“grg”,”cod”).

  • prod_types (tuple, optional) – the wished products. The default is (“sp3”,”clk”).

  • remove_patterns (tuple, optional) – the patterns you want to exclude. The default is (“ULA”,).

  • archtype (str, optional) – structure of the local archive sub-directories. see effective_save_dir_orbit function for more details. The default is ‘week’. an alternative can be ‘year/doy’.

  • new_name_conv (bool, optional) – Also handle the new name convention. The default is True.

  • parallel_download (int, optional) – control parallel download. The default is 4.

  • archive_center (str, optional) – name of the IGS’s archive/data center. The default is ‘ign’.

  • mgex (bool, optional) – get MGEX products. The default is False.

  • repro (int, optional) – get repro products. The default is 0 i.e. operational products.

  • sorted_mode (bool, optional) – sort the download or not. The default is False.

  • return_also_uncompressed_files (bool, optional) – in the final list output, return also already downloaded and uncompressed files. The default is True.

  • ftp_download (bool, optional) – kept for backward compatibility. The default is False.

  • dow_manu (int or bool or None, optional) – Control the download for weekly files. dow_manu = False: use computed DOW (regular case). dow_manu = None: no DOW in regex, search only by week. dow_manu = 0 or 7: specific DOW. The default is False.

  • quiet_mode (bool, optional) – List the available products without downloading them. Useful with path_ftp_crawled_files_save. Default is False.

  • force (bool, optional) – Force re-download even if files exist locally. Default is False.

  • path_ftp_crawled_files_save (str, optional) – Save the crawled files table as CSV at this path. Default is None.

  • path_ftp_crawled_files_load (str, optional) – Load a previously saved crawl table from this path. Default is None.

  • skip_crawl (bool, optional) – Skip the FTP crawl step (use loaded table as-is). Default is False.

  • path_all_ftp_files_save (str, optional) – Save ALL remote files found on the FTP server as CSV. Default is None.

Returns:

list of the local files’s paths.

Return type:

list

Note

The new naming convention has been fully adopted since GPS Week 2238-0.

To control the lattency with the new naming convention, simply add it completly in the AC name e.g. IGS0OPSRAP.

geodezyx.operational.download_gnss.download_prods.gen_table_prods(dates_list, ac_names, prod_types, archive_dir, archive_center, archtype='week', new_name_conv=True, mgex=False, repro=0, dow_manu=False)

Generate a crawl table for GNSS product downloads.

Analogous to gen_crawl_table in download_rinex.py, this function builds a pandas DataFrame describing all the remote files to search for, with their host, directory, regex pattern, and local output directory.

Parameters:
  • dates_list (list of datetime) – List of dates to download products for.

  • ac_names (tuple of str) – Analysis center names.

  • prod_types (tuple of str) – Product types (e.g., “sp3”, “clk”).

  • archive_dir (str) – Parent local archive directory.

  • archive_center (str) – Name of the IGS archive/data center.

  • archtype (str, optional) – Local archive directory structure. Default is “week”.

  • new_name_conv (bool, optional) – Also handle the new naming convention. Default is True.

  • mgex (bool, optional) – Get MGEX products. Default is False.

  • repro (int, optional) – Reprocessing campaign number. Default is 0.

  • dow_manu (int, bool, or None, optional) – Manual DOW override. Default is False.

Returns:

Table with download metadata for each product file, with columns: date, ac, prod, outdir, host, dir, regex, protocol, crawled, ok_dwl, ok_loc, url_true, filename.

Return type:

pd.DataFrame

geodezyx.operational.download_gnss.download_prods.multi_downloader_orbs_clks_2(**kwargs)

geodezyx.operational.download_gnss.download_rinex module

Created on 23/04/2024 21:31:45

@author: psakic

geodezyx.operational.download_gnss.download_rinex.download_gnss_rinex(statdico, output_dir, startdate, enddate, archtype='year/doy', parallel_download=4, user='anonymous', passwd='anonymous@isp.com', path_ftp_crawled_files_save=None, path_ftp_crawled_files_load=None, skip_crawl=False, path_all_ftp_files_save=None, quiet_mode=False, final_archive_for_sup_check=None, force=False, no_rnx2=False, no_rnx3=False, intuitive_output=False)
Parameters:
  • statdico (dict) –

    a statdico is a dictionary associating Archives Centers to list of stations

    Exemple:
    >>> statdico['archive center 1'] = ['STA1','STA200XXX','STA3', ...]
    >>> statdico['archive center 2'] = ['STA200XXX','STA1','STA4', ...]
    
    the supported archive center are (april 2024):
    • igs_cddis or igs (CDDIS data center)

    • igs_sopac (for the SOPAC/UCSD/SIO data center, but not very reliable)

    • igs_ign (IGN’s data center, main server at St Mandé)

    • igs_ign_ensg (IGN’s data center, secondary server at ENSG, Marne-la-Vallée)

    • igs_bkg (BKG’s IGS data center, for the IGS stations)

    • sonel

    • euref (EPN data center hosted at ROB)

    • nav or brdc as archive center allows to download nav files (using ‘BRDC’ as station name)

    • from the ROB server, using GOP files

    • nav_rt or brdc_rt as archive center allows to download real time nav files from the BKG server

    • rgp (IGN’s RGP main server at St Mandé)

    • rgp_ensg (IGN’s RGP, secondary server at ENSG, Marne-la-Vallée)

    • rgp_v3 (IGN’s RGP main server at St Mandé - RINEX3)

    • rgp_ensg_v3 (IGN’s RGP, secondary server at ENSG, Marne-la-Vallée - RINEX3)

    • rgp_01s (IGN’s RGP, all the 24 hourly rinex for the day will be downloaded)

    • renag

    • renag_crtk & renag_crtk_01s (Centipede RTK data hosted at RENAG)

    • ovsg

    • unavco

    • geoaus (Geosciences Australia)

    • ens_fr

  • output_dir (str) – the root directory on your local drive were to store the RINEXs

  • archtype (str) –

    string describing how the archive directory is structured, e.g:
    • stat

    • stat/year

    • stat/year/doy

    • year/doy

    • year/stat

    • week/dow/stat

    • etc …

  • passwd (user &) – user & password for a secure server

  • path_ftp_crawled_files_save (str) – will save at the given path (directory+filename) in a CSV file containing the list of the existing RINEXs found on the server by the FTP crawler. It allows to use this list directly if one face a timeout during the download part.

  • path_ftp_crawled_files_load (str) – load and use the list of the existing RINEXs found on the FTP server, generated by a previous run of the FTP crawler (called by download_gnss_rinex or directly by crawl_ftp_files). a new call of crawl_ftp_files can be bypassed with skip_crawl.

  • skip_crawl (bool) – when a list of the existing RINEXs found on the FTP server is provided with path_ftp_crawled_files_load, skip a new call of crawl_ftp_files. Then, we assume the provided list as a complete one, ready for the download step

  • path_all_ftp_files_save (str) – will save at the given path (directory+filename) in a CSV file ALL the remote files found on the FTP server. NB: CSV file will be saved each time a new FTP instance is created, i.e. every 50 days

  • quiet_mode (bool) – List the available RINEXs without downloading them. Useful only if path_ftp_crawled_files_save is given

  • final_archive_for_sup_check (str) – The final archive path or a file containing the archived RINEXs in their final destination. useful if the final archive is different from archive_dir * not re-implemented yet *

  • force (bool) – Force the download even if the file already exists locally

  • no_rnx3 (no_rnx2 &) – limit the search/download to RINEX2 (short names) and/or RINEX3 (long names) depending on the boolean given

Returns:

  • out_tup_lis (List of tuples) – Returns a list of tuples containing the local path of the downloaded file and a boolean indicating whether the download was successful. e.g. [(local_path1, True), (local_path2, False), …] NB: files that already exist locally are marked as (local_path, True)

  • Minimal exemple

  • —————

  • .. code-block:: python – >>> statdic = dict() >>> statdic[‘igs_cddis’] = [‘ZIMM’,’tlse’] >>> archive_dir = ‘/home/USER/test_dl_rnx’ >>> startdate = dt.datetime(2020,1,1) >>> enddate = dt.datetime(2020,1,31) >>> geodezyx.operational.download_gnss_rinex(statdic, output_dir, startdate, enddate)

geodezyx.operational.download_gnss.download_rinex.gen_table_rnx(statdico, date_range, output_dir, archtype, no_rnx2, no_rnx3)

Generate a crawl table for RINEX file downloads.

Parameters:
  • statdico (dict) – Dictionary mapping data centers to station lists.

  • date_range (list) – List of datetime objects for the date range.

  • output_dir (str) – Root output directory.

  • archtype (str) – Archive directory structure type.

  • no_rnx2 (bool) – Skip RINEX2 files if True.

  • no_rnx3 (bool) – Skip RINEX3 files if True.

Returns:

Table with download metadata for each RINEX file.

Return type:

pd.DataFrame

geodezyx.operational.download_gnss.download_utils module

@author: psakic This sub-module of geodezyx.operational contains functions to download gnss data and products from distant IGS servers. it can be imported directly with: from geodezyx import operational The geodezyx toolbox is a software for simple but useful functions for Geodesy and Geophysics under the GNU LGPL v3 License Copyright (C) 2019 Pierre Sakic et al. (IPGP, sakic@ipgp.fr) GitHub repository : https://github.com/IPGP/geodezyx

class geodezyx.operational.download_gnss.download_utils.MyFTP_TLS(host='', user='', passwd='', acct='', *, context=None, timeout=<object object>, source_address=None, encoding='utf-8')

Bases: FTP_TLS

This class is a subclass of FTP_TLS from the ftplib module. It is used to create an FTPS client that shares the TLS session. This is to avoid the error: ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2396) Source: https://stackoverflow.com/questions/14659154/ftps-with-python-ftplib-session-reuse-required

ntransfercmd(cmd, rest=None)

Initiate a data transfer over a new connection.

Parameters:
  • cmd (str) – The command to send to the server.

  • rest (str, optional) – A string that contains a marker representing where the server is to restart the operation’s data transfer. Default is None.

Returns:

The connection and the expected size of the data.

Return type:

tuple

Notes

If the protection level is set to private (i.e., _prot_p is True), the connection is wrapped in an SSL/TLS layer.

class geodezyx.operational.download_gnss.download_utils.TimeoutHTTPAdapter(timeout, *args, **kwargs)

Bases: HTTPAdapter

Custom HTTP adapter that enforces a timeout on all requests.

This adapter ensures that socket timeouts are properly applied to streaming HTTP requests, preventing indefinite hangs during downloads.

send(request, **kwargs)

Sends PreparedRequest object. Returns Response object.

Parameters:
  • request – The PreparedRequest being sent.

  • stream – (optional) Whether to stream the request content.

  • timeout (float or tuple or urllib3 Timeout object) – (optional) How long to wait for the server to send data before giving up, as a float, or a (connect timeout, read timeout) tuple.

  • verify – (optional) Either a boolean, in which case it controls whether we verify the server’s TLS certificate, or a string, in which case it must be a path to a CA bundle to use

  • cert – (optional) Any user-provided SSL certificate to be trusted.

  • proxies – (optional) The proxies dictionary to apply to the request.

Return type:

requests.Response

geodezyx.operational.download_gnss.download_utils.check_loc_file(filergx, outdir, local_files_cache, force=False, all_files_mode=False)

Check if a file matching a regex exists locally.

Parameters:
  • filergx (str) – Regex pattern to match filenames.

  • outdir (str) – Local output directory path.

  • local_files_cache (list of str) – Cached list of local files in the directory.

  • force (bool, optional) – Force re-download even if file exists. Default is False.

  • all_files_mode (bool, optional) – If True, check for all matching files. Default is False.

Returns:

  • ok_loc (bool) – True if file exists locally and should not be re-downloaded.

  • ok_dwl (bool) – True if file should be downloaded (not local or force=True).

  • filename (str) – Filename if found locally (semicolon-separated if all_files_mode=True), empty string otherwise.

geodezyx.operational.download_gnss.download_utils.collect_local_files(table)

Collect local file paths for files that exist locally.

Parameters:

table (pd.DataFrame) – Table with crawl results containing ‘ok_loc’, ‘outdir’ columns, and ‘filename’ column.

Returns:

Series of local file paths, or empty Series if no local files.

Return type:

pd.Series

geodezyx.operational.download_gnss.download_utils.crawl_ftp_files(table, sftp='auto', user=None, passwd=None, path_ftp_crawled_files_save=None, path_all_ftp_files_save=None, force=False, all_files_mode=False, exclude_patterns=None, timeout=120)

Crawl FTP servers to find available files and update download table.

This is a generic function used by both RINEX and products downloaders. It checks for existing local files, connects to FTP servers, lists remote files, and updates the table with availability status and actual file URLs.

Parameters:
  • table (pd.DataFrame) – Input table containing download metadata with columns: - ‘host’: FTP server hostname - ‘dir’: Remote directory path - ‘outdir’: Local output directory - ‘regex’: Filename regex pattern - ‘protocol’: String indicating protocol (“ftp” or “sftp”) - ‘crawled’: Boolean indicating if already crawled

  • sftp (str or bool, optional) – SFTP mode setting. Default is ‘auto’.

  • user (str, optional) – FTP username. Default is None (anonymous).

  • passwd (str, optional) – FTP password. Default is None (anonymous).

  • path_ftp_crawled_files_save (str, optional) – Path to save the crawled files table as CSV.

  • path_all_ftp_files_save (str, optional) – Path to save all discovered FTP files as CSV.

  • force (bool, optional) – Force re-download even if files exist locally. Default is False.

  • all_files_mode (bool, optional) – If True, download ALL files matching the regex. Default is False.

  • exclude_patterns (list of str, optional) – List of regex patterns to exclude from matched files. Default is None.

  • timeout (int, optional) – The timeout for FTP connections in seconds. Default is 30 seconds.

Returns:

  • table_use (pd.DataFrame) – Updated table with crawl results.

  • all_ftp_files (pd.Series) – All files discovered on FTP servers.

  • all_loc_files (pd.Series) – Local file paths for files that already exist.

geodezyx.operational.download_gnss.download_utils.create_ftp_obj(secure_ftp_inp=False, host='', chdir='', parallel_download=1, user='anonymous', passwd='', retry_count=3, timeout=120)

This function creates and returns an FTP object and a list of FTP objects for multiple downloads.

Parameters:
  • secure_ftp_inp (bool) – If True, uses FTPS for secure file transfer. Default is False.

  • host (str, optional) – The hostname of the FTP server. Default is an empty string.

  • chdir (str, optional) – The directory to change to after connecting to the FTP server. Default is an empty string.

  • parallel_download (int, optional) – The number of parallel downloads to be performed. Default is 1.

  • user (str, optional) – The username for the FTP server. Default is “anonymous”.

  • passwd (str, optional) – The password for the FTP server. Default is an empty string.

  • retry_count (int, optional) – The number of times to retry creating the FTP object. Default is 3.

  • timeout (int, optional) – The timeout for FTP connections in seconds. Default is 120 seconds.

Returns:

The main FTP object for crawling and a list of FTP objects for parallel downloads.

Return type:

tuple

Notes

This function creates an FTP object using the appropriate constructor based on the secure_ftp_inp parameter. It then creates a list of FTP objects for multiple downloads. If a directory is specified, it changes the current working directory of the main FTP object to that directory.

geodezyx.operational.download_gnss.download_utils.download_http(url, output_dir, timeout=120, max_try=4, sleep_time=5, force=False)

Download a file from an HTTP server with retry logic and progress bar.

Parameters:
  • url (str) – The URL of the file to download.

  • output_dir (str) – The directory where the downloaded file will be saved.

  • timeout (int, optional) – The timeout for the HTTP connection in seconds. Default is 120 seconds. This timeout applies to: - Initial connection - Headers reading - Each chunk reading (per iteration)

  • max_try (int, optional) – The maximum number of retry attempts in case of failure. Default is 4.

  • sleep_time (int, optional) – The sleep time between retry attempts in seconds. Default is 5 seconds.

  • force (bool, optional) – If True, forces the download even if the file already exists locally. Default is False.

Returns:

  • output_path (str) – The path to the downloaded file, or the URL string if the download failed.

  • downloaded (bool) – True if the file was actually fetched from the server during this call, False if it already existed locally or the download failed.

Notes

The timeout is enforced using socket.settimeout() on the underlying HTTP connection, which ensures that the entire download operation (including streaming) will timeout if no data is received for the specified duration.

geodezyx.operational.download_gnss.download_utils.effective_save_dir(parent_archive_dir, site, date, archtype='stat')

INTERNAL_FUNCTION

archtype =

site site/year site/year/doy year/doy year/site week/dow OR only ‘/’ for a dirty saving in the parent folder … etc …

If site is None or empty, it will be replaced with “ALL_STATIONS” in the path.

geodezyx.operational.download_gnss.download_utils.effective_save_dir_orbit(parent_archive_dir, calc_center, date, archtype='year/doy/')

INTERNAL_FUNCTION

archtype =

stat stat/year stat/year/doy year/doy year/stat week/dow wkwwww : use a GFZ’s CF-ORB wk<wwww> naming OR only ‘/’ for a dirty saving in the parent folder … etc …

geodezyx.operational.download_gnss.download_utils.ftp_downld_core(ftp_obj, filename, localdir, force=False)

Performs the FTP download if we are already in the correct FTP folder. This is an internal function of ftp_downld.

Parameters:
  • ftp_obj (FTP object) – The FTP object used to connect to the FTP server.

  • filename (str) – The name of the file to be downloaded.

  • localdir (str) – The local directory where the downloaded file should be saved.

  • force (bool, optional) – If True, forces the download even if the file already exists locally. Default is False.

Returns:

The local path of the downloaded file and a boolean indicating whether the download was successful.

Return type:

tuple

Notes

This function first checks if the local directory exists, if not it creates it. Then it checks if the file already exists locally, if it does, it logs a message and returns. If the file does not exist, it tries to download the file from the FTP server. If the download is successful, it logs a success message and returns the local path and True. If the download fails, it logs a failure message and returns the local path and False.

geodezyx.operational.download_gnss.download_utils.ftp_downld_front(urls, savedirs, parallel_download=1, secure_ftp=False, user='anonymous', passwd='anonymous@isp.com', force=True, timeout=120)

This function is used to download files from FTP servers in parallel.

Parameters:
  • urls (str or list) – The URL or list of URLs of the files to be downloaded.

  • savedirs (str or list) – The directory or list of directories where the downloaded files should be saved.

  • parallel_download (int, optional) – The number of parallel downloads to be performed. Default is 1.

  • secure_ftp (bool, optional) – If True, uses FTPS for secure file transfer. Default is False.

  • user (str, optional) – The username for the FTP server. Default is “anonymous”.

  • passwd (str, optional) – The password for the FTP server. Default is ‘anonymous@isp.com’.

  • force (bool, optional) – If True, forces the download even if the file already exists. Default is True.

  • timeout (int, optional) – The timeout for FTP connections in seconds. Default is 30 seconds.

Returns:

out_tup_lis – Returns a list of tuples containing the local path of the downloaded file and a boolean indicating whether the download was successful. e.g. [(local_path1, True), (local_path2, False), …]

Return type:

List of tuples

Notes

This function uses the ThreadPool for parallel downloads.

geodezyx.operational.download_gnss.download_utils.ftp_downld_mono(ftp_obj, full_remote_path, localdir, force=False)

Downloads a file through FTP protocol.

Parameters:
  • ftp_obj (FTP object) – The FTP object used to connect to the FTP server.

  • full_remote_path (str) – The full path of the file on the FTP server.

  • localdir (str) – The local directory where the downloaded file should be saved.

  • force (bool, optional) – If True, forces the download even if the file already exists locally. Default is False.

Returns:

The output of the ftp_downloader_core function.

Return type:

tuple

Notes

This function changes the current working directory of the FTP object to the directory of the file to be downloaded, and then calls the ftp_downloader_core function to download the file.

geodezyx.operational.download_gnss.download_utils.ftp_downld_wrap(intup)

This function is a wrapper for the ftp_downld function. It unpacks the input tuple and passes it to the ftp_downld function.

Parameters:

intup (tuple) – A tuple containing the parameters to be passed to the ftp_downld function.

Returns:

The output of the ftp_downld function.

Return type:

tuple

geodezyx.operational.download_gnss.download_utils.generate_download_urls(table, all_files_mode=False)

Generate complete FTP URLs for files to be downloaded.

Parameters:
  • table (pd.DataFrame) – Table with crawl results. Must have columns: ok_dwl, ok_loc, host, dir, filename.

  • all_files_mode (bool, optional) – If True, handle semicolon-separated filenames. Default is False.

geodezyx.operational.download_gnss.download_utils.list_ftp_dir(ftpobj, dir_inp, host, prev_dir)

Get FTP directory file listing.

Changes to the specified directory and retrieves the list of files. Returns empty list if directory change fails.

Parameters:
  • ftpobj (FTP) – FTP connection object.

  • dir_inp (str) – Remote directory path.

  • host (str) – FTP server hostname (for logging/URL generation).

  • prev_dir (str) – Previous directory path.

Returns:

  • ftp_files_list (list of str) – Filenames in the remote directory. None if directory is unchanged.

  • ftp_files_urls (list of str) – Complete FTP URLs for all files in the directory. None if directory is unchanged. Empty list if the directory change failed.

geodezyx.operational.download_gnss.download_utils.list_ftp_dir_core(ftpobj)

Lists the files in the current directory of the FTP object.

Parameters:

ftpobj (FTP object) – The FTP object used to connect to the FTP server.

Returns:

A list of filenames in the current directory of the FTP object.

Return type:

list

Notes

This function tries to get the list of filenames in the current directory of the FTP object. If it encounters a permission error, it checks if the error message is “550 No files found”. If it is, it logs a warning message and returns an empty list. If the error message is different, it raises the exception.

geodezyx.operational.download_gnss.download_utils.match_files_in_dir(filergx, ftp_files_list, all_files_mode=False)

Match files in FTP directory using regex pattern.

Parameters:
  • filergx (str) – Regex pattern to match filenames.

  • ftp_files_list (list of str) – List of filenames in the FTP directory.

  • all_files_mode (bool, optional) – If True, return all matching files. Default is False.

Returns:

Matched filename(s).

Return type:

str or list of str or None

geodezyx.operational.download_gnss.download_utils.orbclk_long2short_name(longname_filepath_in, rm_longname_file=False, center_id_last_letter=None, center_manual_short_name=None, force=False, dryrun=False, output_dirname=None)

Rename a long naming new convention IGS product file to the short old convention.

Naming will be done automatically based on the 3 first characters of the long AC id. e.g. CODE => cod, GRGS => grg, NOAA => noa …

Parameters:
  • longname_filepath_in (str) – Full path of the long name product file.

  • rm_longname_file (bool) – Remove the original long name product file.

  • center_id_last_letter (str) – Replace the last letter of the short AC id by another letter (see note below).

  • center_manual_short_name (str) – Replace completely the long name with this one. Overrides center_id_last_letter.

  • force (bool) – If False, skip if the file already exists.

  • dryrun (bool) – If True, don’t rename effectively, just output the new name.

  • output_dirname (str) – Directory where the output shortname will be created. If None, will be created in the same folder as the input longname.

Returns:

shortname_filepath – Path of the short old-named product file.

Return type:

str

Note

If you rename MGEX orbits, we advise to set center_id_last_letter=”m”. The AC code name will be changed to keep a MGEX convention (but any other character can be used too).

e.g. for Bern’s products, the long id is CODE

if center_id_last_letter=None, it will become cod, if center_id_last_letter=m, it will become com

geodezyx.operational.download_gnss.download_utils.regex_match_indir(regex, dir_files_list)

Match files in a directory against a given regex pattern.

Parameters:
  • regex (str) – Regex pattern to match filenames.

  • dir_files_list (list of str) – List of filenames in the directory.

Returns:

The first matching filename, or None if no match is found.

Return type:

str or None

geodezyx.operational.download_gnss.download_utils.regex_match_indir_all(regex, dir_files_list)

Match all files in a directory against a given regex pattern.

Parameters:
  • regex (str) – Regex pattern to match filenames.

  • dir_files_list (list of str) – List of filenames in the directory.

Returns:

List of all matching filenames, or empty list if no match is found.

Return type:

list of str

geodezyx.operational.download_gnss.download_utils.renew_ftp_obj(ftpobj, host, protocol, sftp, user, passwd, prev_host, count_loop, count_nmax, timeout=120)

Get or create an FTP connection.

Creates a new connection if the host has changed, counter exceeds max, or this is the first connection. Otherwise returns the existing connection.

Parameters:
  • ftpobj (FTP or None) – Current FTP connection object.

  • host (str) – Target FTP server hostname.

  • protocol (str) – Protocol string (“ftp” or “sftp”).

  • sftp (str or bool) – SFTP mode setting (‘auto’, True, or False).

  • user (str or None) – FTP username.

  • passwd (str or None) – FTP password.

  • prev_host (str) – Previous host name.

  • count_loop (int) – Current operation counter.

  • count_nmax (int) – Maximum operations before reconnection.

  • timeout (int, optional) – The timeout for FTP connections in seconds. Default is 30 seconds.

Returns:

  • ftpobj (FTP) – FTP connection object.

  • new_host (str) – The host name for connection tracking.

geodezyx.operational.download_gnss.download_utils.start_end_date_easy(start_year, start_doy, end_year, end_doy)

generates start/end datetimes from a start/end year/day of year

Parameters:
  • start_year (int) – start year.

  • start_doy (int) – start day of year.

  • end_year (int) – end year.

  • end_doy (int) – end day of year.

Returns:

  • start (datetime) – converted start datetime.

  • end (datetime) – converted end datetime.

geodezyx.operational.download_gnss.download_utils.update_table_row_with_match(table, irow, file_match, all_files_mode=False)

Update table row based on file match results.

Parameters:
  • table (pd.DataFrame) – Table to update.

  • irow (int) – Row index to update.

  • file_match (str or list of str or None) – Matched filename(s) from FTP directory.

  • all_files_mode (bool, optional) – If True, file_match is a list of files. Default is False.

geodezyx.operational.download_gnss.servers_prods module

Server definitions and dispatcher for GNSS product downloads.

Contains _server_select_products, the central dispatcher used exclusively by download_prods.

geodezyx.operational.download_gnss.servers_rinex module

Server definitions and dispatcher for GNSS RINEX downloads.

Contains the individual *_server helper functions, the generic server builder _generic_server, regex helpers _rnx_obs_rgx / _rnx_nav_rgx, and the central dispatcher _server_select. All used exclusively by download_rinex.

geodezyx.operational.download_gnss.servers_rinex.ens_fr_server(date, site=None)

ENS (École Normale Supérieure) France GNSS server.

Adapted from legacy function to standard format.

geodezyx.operational.download_gnss.servers_rinex.euref_server(date, site=None)
geodezyx.operational.download_gnss.servers_rinex.geoaus_server(date, site=None)

Geosciences Australia GNSS server.

Adapted from legacy function to standard format. Example: ftp://ftp.ga.gov.au/geodesy-outgoing/gnss/data/daily/2010/10063/

geodezyx.operational.download_gnss.servers_rinex.igs_bkg_server(date, site=None)
geodezyx.operational.download_gnss.servers_rinex.igs_cddis_nav_server(date, site=None)

IGS CDDIS navigation file server.

Adapted from legacy function to standard format.

geodezyx.operational.download_gnss.servers_rinex.igs_cddis_server(date, site=None)
geodezyx.operational.download_gnss.servers_rinex.igs_ign_ensg_server(date, site=None)
geodezyx.operational.download_gnss.servers_rinex.igs_ign_server(date, site=None)
geodezyx.operational.download_gnss.servers_rinex.igs_sopac_server(date, site=None)
geodezyx.operational.download_gnss.servers_rinex.nav_bkg_server(date, site=None)
geodezyx.operational.download_gnss.servers_rinex.nav_rob_server(date, site=None)
geodezyx.operational.download_gnss.servers_rinex.orpheon_server(date, site=None)

Orpheon server for RINEX observation files (RENAG hosted).

Adapted from legacy function to standard format. Note: Authentication may be required, use user/passwd parameters in download_gnss_rinex.

geodezyx.operational.download_gnss.servers_rinex.ovsg_server(date, site=None)

OVSG (Observatoire Volcanologique et Sismologique de Guadeloupe) server.

Adapted from legacy function to standard format. Note: Uses HTTP, authentication may be required.

geodezyx.operational.download_gnss.servers_rinex.renag_server(date, site=None)

RENAG server for RINEX observation files.

Adapted from legacy function to standard format.

geodezyx.operational.download_gnss.servers_rinex.renag_server_crtk(date, site=None, smp_01s=False)
geodezyx.operational.download_gnss.servers_rinex.rgp_ensg_rnx3_server(date, site=None)
geodezyx.operational.download_gnss.servers_rinex.rgp_ensg_server(date, site=None)
geodezyx.operational.download_gnss.servers_rinex.rgp_ign_smn_01s_server(date, site=None)

RGP IGN 01S/1Hz data server (hourly RINEX files).

Adapted from legacy function to standard format. Returns URLs for all 24 hourly sessions.

Note

This function returns a list of urldic instead of a single urldic, one for each hourly session of the day.

geodezyx.operational.download_gnss.servers_rinex.rgp_rnx3_server(date, site=None)
geodezyx.operational.download_gnss.servers_rinex.rgp_server(date, site=None)
geodezyx.operational.download_gnss.servers_rinex.sonel_server(date, site=None)
geodezyx.operational.download_gnss.servers_rinex.spotgins_eost_server(date, site=None)
geodezyx.operational.download_gnss.servers_rinex.unavco_server(date, site=None)

UNAVCO server for RINEX observation files.

Adapted from legacy function to standard format.

geodezyx.operational.download_gnss.servers_rinex.uwiseismic_server(date, site=None)

UWISeismic server for RINEX observation files.

Adapted from legacy function to standard format. Note: Authentication may be required, use user/passwd parameters in download_gnss_rinex.