oq config
config_from_task(task_id, subtasks_folder)
¶
Use nzshm-model to build an openquake config.
This method attempts to handle the three styles stored in toshi api.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
str
|
The ID of the task. |
required |
subtasks_folder
|
Path
|
The folder where subtasks are stored. |
required |
Returns:
Name | Type | Description |
---|---|---|
OpenquakeConfig |
OpenquakeConfig
|
A modern configuration for openquake. |
Raises:
Type | Description |
---|---|
ValueError
|
If the file does not exist or is not a valid JSON file. |
Source code in toshi_hazard_store/oq_import/oq_config.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
|
download_artefacts(gtapi, task_id, hazard_task_detail, subtasks_folder)
¶
Pulls down the files and stores them in the specified folder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gtapi
|
object
|
The API object to use for downloading files. |
required |
task_id
|
str
|
The ID of the task to download files for. |
required |
hazard_task_detail
|
dict
|
A dictionary containing details about the hazard solution, including the URL for the task args file. |
required |
subtasks_folder
|
Path
|
The folder where the downloaded files should be stored. |
required |
Returns:
Type | Description |
---|---|
None |
Source code in toshi_hazard_store/oq_import/oq_config.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
process_hdf5(gtapi, task_id, hazard_task_detail, subtasks_folder, manipulate=True)
¶
Download and unpack the hdf5_file, returning the path object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gtapi
|
object
|
The API object to use for downloading files. |
required |
task_id
|
str
|
The ID of the task to download files for. |
required |
hazard_task_detail
|
dict
|
A dictionary containing details about the hazard solution, including the URL for the HDF5 file. |
required |
subtasks_folder
|
Path
|
The folder where the downloaded files should be stored. |
required |
manipulate
|
bool
|
Whether to manipulate the HDF5 file. Defaults to True. |
True
|
Returns:
Type | Description |
---|---|
Path
|
pathlib.Path: The path to the processed HDF5 file. |
Raises:
Type | Description |
---|---|
ValueError
|
If the archive does not contain exactly one 'calc_' file. |
FileExistsError
|
If multiple HDF5 files are found in the specified folder. |
FileNotFoundError
|
If no HDF5 file is found in the specified folder. |
Source code in toshi_hazard_store/oq_import/oq_config.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 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 |
|
options: filters: public