Basic GCP Utils

flood_forecast.gcp_integration.basic_utils.get_storage_client(service_key_path: Optional[str] = None) google.cloud.storage.client.Client[source]

Utility function to return a properly authenticated GCS storage client whether working in Colab, CircleCI, Dataverse, or other environments.

flood_forecast.gcp_integration.basic_utils.upload_file(bucket_name: str, file_name: str, upload_name: str, client: google.cloud.storage.client.Client)[source]

A function to upload a file to a GCP bucket.

Parameters
  • bucket_name (str) – The name of the bucket

  • file_name (str) – [description]

  • upload_name (str) – [description]

  • client (storage.Client) – [description]

flood_forecast.gcp_integration.basic_utils.download_file(bucket_name: str, source_blob_name: str, destination_file_name: str, service_key_path: Optional[str] = None) None[source]

Download data file from GCS.

Args:

bucket_name ([str]): bucket name on GCS, eg. task_ts_data source_blob_name ([str]): storage object name destination_file_name ([str]): filepath to save to local