oasislmf.execution.bin¶
Python utilities used for setting up the structure of the run directory in which to prepare the inputs to run a model or generate deterministic losses, and store the outputs.
Functions¶
|
Ensures that the model run directory has the correct folder structure in |
|
Sets up binary files in the model inputs directory. |
|
Create symbolic link to footprint file set that will be used for output |
|
Create symbolic link to vulnerability file set that will be used for output |
|
|
|
Check that all the required files are present in the directory. |
|
Create the binary files. |
|
Checks that all required files are present |
|
Package the binaries in a gzipped tar. |
|
Check that the conversion tools are available |
|
Clean the tar and binary files. |
Module Contents¶
- oasislmf.execution.bin.prepare_run_directory(run_dir, oasis_src_fp, model_data_fp, analysis_settings_fp, inputs_archive=None, user_data_dir=None, ri=False, copy_model_data=False, model_storage_config_fp=None)[source]¶
Ensures that the model run directory has the correct folder structure in order for the model run script (ktools) to be executed. Without the RI flag the model run directory will have the following structure
<run_directory> |-- fifo/ |-- input/ | `-- csv/ |-- output/ |-- static/ |-- work/ |-- analysis_settings.json `-- run_ktools.sh
where the direct GUL and/or FM input files exist in the
input/csv
subfolder and the corresponding binaries exist in theinput
subfolder.With the RI flag the model run directory has the following structure
- ::
<run_directory> |– fifo |– input
|– … |– output |– static |– work |– analysis_settings.json `– run_ktools.sh
where the direct GUL and/or FM input files, and the corresponding binaries exist in the
input
subfolder, and the RI layer input files and binaries exist in theRI
prefixed subfolders.If any subfolders are missing they are created.
Optionally, if the path to a set of Oasis files is provided then they are copied into the
input/csv
subfolder.Optionally, if the path to the analysis settings JSON file is provided then it is copied to the base of the run directory.
Optionally, if the path to model data is provided then the files are symlinked into the
static
subfolder provided the OS is of type Darwin or Linux, otherwise the source folder tree is recursively copied into thestatic
subfolder.- Parameters:
run_dir (str) – the model run directory
oasis_src_fp (str) – path to a set of Oasis files
ri (bool) – Boolean flag for RI mode
analysis_settings_fp (str) – analysis settings JSON file path
model_data_fp (str) – model data source path, if this is a file it will be loaded as a custom storage class
inputs_archive (str) – path to a tar file containing input files
user_data_dir (str) – path to a directory containing additional user-supplied model data
model_storage_config_fp (str) – path to the model storage configuration, if not present the model data will be copied to the static directory
- oasislmf.execution.bin.prepare_run_inputs(analysis_settings, run_dir, model_storage: oasis_data_manager.filestore.backends.base.BaseStorage, ri=False)[source]¶
Sets up binary files in the model inputs directory.
- oasislmf.execution.bin.set_footprint_set(setting_val, run_dir)[source]¶
Create symbolic link to footprint file set that will be used for output calculation.
- Parameters:
setting_val (string) – identifier for footprint set
run_dir (string) – model run directory
- oasislmf.execution.bin.set_vulnerability_set(setting_val, run_dir)[source]¶
Create symbolic link to vulnerability file set that will be used for output calculation.
- Parameters:
setting_val (string) – identifier for vulnerability set
run_dir (string) – model run directory
- oasislmf.execution.bin.check_inputs_directory(directory_to_check, il=False, ri=False, check_binaries=True)[source]¶
Check that all the required files are present in the directory.
- oasislmf.execution.bin.csv_to_bin(csv_directory, bin_directory, il=False, ri=False)[source]¶
Create the binary files.
- Parameters:
- Raises:
OasisException – If one of the conversions fails
- oasislmf.execution.bin.check_binary_tar_file(tar_file_path, check_il=False)[source]¶
Checks that all required files are present
- oasislmf.execution.bin.create_binary_tar_file(directory)[source]¶
Package the binaries in a gzipped tar.
- Parameters:
directory – Path containing the binaries