utilities
Download and management utilities for syncing files
Can list a directory on DLR geoservice host
Checks
MD5orsha1hashes between local and remote files
General Methods
- pointAdvection.utilities.get_data_path(relpath: list | str | Path)[source]
Get the absolute path within a package from a relative path
- Parameters:
- relpath: list, str or pathlib.Path
relative path
- pointAdvection.utilities.get_hash(local: str | IOBase | Path, algorithm: str = 'md5')[source]
Get the hash value from a local file or
BytesIOobject- Parameters:
- local: obj, str or pathlib.Path
BytesIO object or path to file
- algorithm: str, default ‘md5’
hashing algorithm for checksum validation
- pointAdvection.utilities.get_git_revision_hash(refname: str = 'HEAD', short: bool = False)[source]
Get the
githash value for a particular reference- Parameters:
- refname: str, default HEAD
Symbolic reference name
- short: bool, default False
Return the shorted hash value
- pointAdvection.utilities.get_git_status()[source]
Get the status of a
gitrepository as a boolean value
- pointAdvection.utilities.url_split(s: str)[source]
Recursively split a url path into a list
- Parameters:
- s: str
url string
- pointAdvection.utilities.get_unix_time(time_string: str, format: str = '%Y-%m-%d %H:%M:%S')[source]
Get the Unix timestamp value for a formatted date string
- Parameters:
- time_string: str
formatted time string to parse
- format: str, default ‘%Y-%m-%d %H:%M:%S’
format for input time string
- pointAdvection.utilities.isoformat(time_string: str)[source]
Reformat a date string to ISO formatting
- Parameters:
- time_string: str
formatted time string to parse
- pointAdvection.utilities._create_default_ssl_context() SSLContext[source]
Creates the default SSL context
- pointAdvection.utilities._create_ssl_context_no_verify() SSLContext[source]
Creates an SSL context for unverified connections
- pointAdvection.utilities._set_ssl_context_options(context: SSLContext) None[source]
Sets the default options for the SSL context
- pointAdvection.utilities.check_connection(HOST: str, context=<ssl.SSLContext object>)[source]
Check internet connection with http host
- Parameters:
- HOST: str
remote http host
- context: obj, default ssl.SSLContext(ssl.PROTOCOL_TLS)
SSL context for
urllibopener object
- pointAdvection.utilities.geoservice_list(HOST: str | list, timeout: int | None = None, context=<ssl.SSLContext object>, parser=<lxml.etree.HTMLParser object>, format: str = '%Y-%m-%d %H:%M:%S', pattern: str = '', sort: bool = False)[source]
List a directory on DLR geoservice https Server
- Parameters:
- HOST: str or list
remote http host path
- timeout: int or NoneType, default None
timeout in seconds for blocking operations
- context: obj, default ssl.SSLContext(ssl.PROTOCOL_TLS)
SSL context for
urllibopener object- parser: obj, default lxml.etree.HTMLParser()
HTML parser for
lxml- format: str, default ‘%Y-%m-%d %H:%M’
format for input time string
- pattern: str, default ‘’
regular expression pattern for reducing list
- sort: bool, default False
sort output list
- Returns:
- colnames: list
column names in a directory
- collastmod: list
last modification times for items in the directory