utils.ditto_utils
Utility functions for dealing with SMART DS dataset.
Examples:
>>> from erad import ditto_utils
>>> ditto_utils.download_smartds_data('P4R', '.')
create_networkx_from_ditto(output_path, file_name, **kwargs)
Creates networkx graph from OpenDSS model using Ditto.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_path |
str
|
Path to store the networkx data in json file format |
required |
file_name |
str
|
JSON file name used to export the network |
required |
kwargs |
dict
|
Keyword arguments accepted by Ditto |
{}
|
Source code in erad\utils\ditto_utils.py
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
|
create_networkx_from_json(json_file_path)
Returns networkx graph from JSON file.
Source code in erad\utils\ditto_utils.py
249 250 251 252 |
|
download_aws_dir(bucket, path, target, unsigned=True, **kwargs)
Utility function download data from AWS S3 directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bucket |
str
|
Name of the bucket. |
required |
path |
str
|
S3 bucket prefix |
required |
target |
str
|
Path for downloading the data |
required |
unsigned |
bool
|
Indicate whether to use credential or not |
True
|
kwargs |
dict
|
Keyword arguments accepted by |
{}
|
Source code in erad\utils\ditto_utils.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
download_smartds_data(smartds_region, output_path='./smart_ds_downloads', year=2018, area='SFO', s3_bucket_name='oedi-data-lake', folder_name='opendss_no_loadshapes', cache_folder='cache')
Utility function to download SMARTDS data from AWS S3 bucket.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
smartds_region |
str
|
SMARTDS region name |
required |
output_path |
str
|
Path for downloaded data |
'./smart_ds_downloads'
|
year |
int
|
Valid year input for downloading the data |
2018
|
area |
str
|
Valid SMARTDS area |
'SFO'
|
s3_bucket_name |
str
|
S3 bucket name storing the SMARTDS data |
'oedi-data-lake'
|
folder_name |
str
|
S3 bucket folder to download |
'opendss_no_loadshapes'
|
cache_folder |
str
|
Folder path for caching the results |
'cache'
|
Raises:
Type | Description |
---|---|
SMARTDSInvalidInput
|
Raises this error if year and/or area provided is not valid. |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Folder path containing downloaded data. |
Source code in erad\utils\ditto_utils.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
|