CloudStorage

CloudStorage(self, data_dir=RIBASIM_NL_DATA_DIR, user=RIBASIM_NL_CLOUD_USER, url=BASE_URL, password=RIBASIM_NL_CLOUD_PASS)

Connect a local ’data_dir` to cloud-storage.

Attributes

Name Description
auth Auth tuple for requests
source_data List of all source_data (directories) in sub-folder ’Basisgegevens`.
water_authorities List of all water authorities (directories)

Methods

Name Description
content List all content in a directory
dirs List sub-directories in a directory
download_aangeleverd Download all files in folder ‘aangeleverd’
download_all Download all files for authority.
download_basisgegevens Download sources in the folder ‘Basisgegevens’
download_content Download content of a directory recursively.
download_verwerkt Download all files in folder ‘verwerkt’
upload_content Upload content of a directory recursively.
upload_model Upload a model to a water authority
upload_verwerkt Upload all files in folder ‘verwerkt’
uploaded_models Get all model versions uploaded for an authority

content

CloudStorage.content(url)

List all content in a directory

User can specify a path to the directory with additional arguments.

Examples

>>> cloud = Cloud()
>>> cloud.dirs()
    ["AaenMaas", "AmselGooienVecht", ...]
>>> cloud.dirs("AaenMaas")
    ["aangeleverd", "modellen", "verwerkt"]

Returns

Type Description
list[str] List of all content directories in a specified path

dirs

CloudStorage.dirs(*args)

List sub-directories in a directory

User can specify a path to the directory with additional arguments.

Examples

>>> cloud = Cloud()
>>> cloud.dirs()
    ["AaenMaas", "AmselGooienVecht", ...]
>>> cloud.dirs("AaenMaas")
    ["aangeleverd", "modellen", "verwerkt"]

Returns

Type Description
list[str] List of directories in a specified path

download_aangeleverd

CloudStorage.download_aangeleverd(authority, overwrite=False)

Download all files in folder ‘aangeleverd’

download_all

CloudStorage.download_all(authority, overwrite=False)

Download all files for authority.

download_basisgegevens

CloudStorage.download_basisgegevens(bronnen=[], overwrite=True)

Download sources in the folder ‘Basisgegevens’

download_content

CloudStorage.download_content(url, overwrite=False)

Download content of a directory recursively.

download_verwerkt

CloudStorage.download_verwerkt(authority, overwrite=False)

Download all files in folder ‘verwerkt’

upload_content

CloudStorage.upload_content(dir_path, overwrite=False)

Upload content of a directory recursively.

upload_model

CloudStorage.upload_model(authority, model, include_results=False, include_plots=False)

Upload a model to a water authority

Parameters

Name Type Description Default
authority str Water authority to upload a model for required
model str name of the model (directory) to upload required
include_results to include results dir in upload; yes/no = True/False. defaults to False. False
include_plots to include plots dir in upload; yes/no = True/False. defaults to False. False

Raises

Type Description
ValueError If model does not exist locally

upload_verwerkt

CloudStorage.upload_verwerkt(authority, overwrite=False)

Upload all files in folder ‘verwerkt’

uploaded_models

CloudStorage.uploaded_models(authority)

Get all model versions uploaded for an authority