vptstools.bin namespace

Submodules

vptstools.bin.click_exception module

Utility to support SNS topic publishing on failed CLI commands

vptstools.bin.click_exception.catch_all_exceptions(cls, handler)[source]

Catch exceptions raised by a click CLI command to override exception handler.

Credits to https://stackoverflow.com/questions/52213375/python-click-exception-handling-under-setuptools

vptstools.bin.click_exception.report_click_exception_to_sns(cmd, info_name, exc, aws_sns_topic, subject, profile_name=None, region_name=None)[source]

Push exceptions from click to SNS topic, used as handler for click applications

Parameters:
  • cmd (Click handler arguments)

  • info_name (Click handler arguments)

  • exc (Click handler arguments)

  • aws_sns_topic (str) – arn of the AWS SNS topic

  • subject (str) – Mail subject when sending notifications,

  • profile_name (aws profile (optional)) – AWS profile

  • region_name (aws region (optional)) – AWS region

vptstools.bin.click_exception.report_message_to_sns(subject, message, aws_sns_topic, profile_name=None, region_name=None)[source]

Push exceptions from click to SNS topic, used as handler for click applications

Parameters:
  • subject (str) – Mail subject when sending notifications

  • message (str) – Mail message when sending notifications

  • aws_sns_topic (str) – arn of the AWS SNS topic

  • profile_name (aws profile (optional)) – AWS profile

  • region_name (aws region (optional)) – AWS region

vptstools.bin.transfer_baltrad module

vptstools.bin.transfer_baltrad.extract_metadata_from_filename(filename: str) tuple[source]

Extract the metadata from the filename (format such as ‘fropo_vp_20220809T051000Z_0xb’)

All returned values are strings, month and days are 0-prefixed if they are single-digit.

Parameters:

filename (str) – Filename of a HDF5 incoming file from FTP

vptstools.bin.transfer_baltrad.s3_key_exists(key: str, bucket: str, s3_client) bool[source]

Check if an S3 key is existing in a bucket

Parameters:
  • key (str) – Key of the object

  • bucket (str) – Bucket name to search for key

  • s3_client (boto3.Session) – Boto3 session

Return type:

bool

vptstools.bin.vph5_to_vpts module