CloudStorage
CloudStorage(self,
=RIBASIM_NL_DATA_DIR,
data_dir=RIBASIM_NL_CLOUD_USER,
user=BASE_URL,
url=RIBASIM_NL_CLOUD_PASS,
password )
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
Name | Type | Description |
---|---|---|
list[str] | List of all content directories in a specified path |
dirs
*args) CloudStorage.dirs(
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
Name | Type | Description |
---|---|---|
list[str] | List of directories in a specified path |
download_aangeleverd
=False) CloudStorage.download_aangeleverd(authority, overwrite
Download all files in folder ‘aangeleverd’
download_all
=False) CloudStorage.download_all(authority, overwrite
Download all files for authority.
download_basisgegevens
=[], overwrite=True) CloudStorage.download_basisgegevens(bronnen
Download sources in the folder ‘Basisgegevens’
download_content
=False) CloudStorage.download_content(url, overwrite
Download content of a directory recursively.
download_verwerkt
=False) CloudStorage.download_verwerkt(authority, overwrite
Download all files in folder ‘verwerkt’
upload_content
=False) CloudStorage.upload_content(dir_path, overwrite
Upload content of a directory recursively.
upload_model
CloudStorage.upload_model(
authority,
model,=False,
include_results=False,
include_plots )
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
Name | Type | Description |
---|---|---|
ValueError | If model does not exist locally |
upload_verwerkt
=False) CloudStorage.upload_verwerkt(authority, overwrite
Upload all files in folder ‘verwerkt’
uploaded_models
CloudStorage.uploaded_models(authority)
Get all model versions uploaded for an authority