Basic GCP Utils
- flood_forecast.gcp_integration.basic_utils.get_storage_client(service_key_path: str | None = None) 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: Client)[source]
A function to upload a file to a GCP bucket.
- Parameters:
bucket_name (str) – The name of the bucket
file_name (str) – The name of the file
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: str | None = 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