Source code for viiapackage.pictures.result_pictures.helper_functions.get_result_picture_name

### ===================================================================================================================
###  FUNCTION: Get VIIA result picture name
### ===================================================================================================================
# Copyright ©VIIA 2024

### ===================================================================================================================
###   1. Import modules
### ===================================================================================================================

# References for functions and classes in the viiaPackage
from viiapackage.general.file_handling import viia_to_filename


### ===================================================================================================================
###   2. Function to get the VIIA names for result pictures
### ===================================================================================================================

[docs]def viia_get_result_picture_name( diana_component_abbreviation: str = 'DtZ', scope: str = 'Building', pic_type_key: str = None, layer: str = None, material_type: str = None, analysis_type: str = 'nlth') -> str: """ Function to get the result picture name for the result picture. Input: - diana_component_abbreviation (str): Abbreviation of component in diana style of the plot result type. - scope (str): The scope of the result picture, this is defined in the viia-result_pictures yaml file. - pic_type_key (str): The result type of the result picture, this is defined in the viia-result_pictures yaml file. - layer (str): The result layer of the result type, this is defined in the viia-result_pictures yaml file. - material_type (str): Used to differentiate materials. - analysis_type (str): The analysis type of the result picture. Output: - Returns the name of the result picture according VIIA naming convention. """ if analysis_type == 'nlth': if not pic_type_key: raise ValueError(f"ERROR: The input of pic_type_key should be provided to get the result picture name.") if 'Max' in pic_type_key: pic_type = 'max' elif 'Min' in pic_type_key: pic_type = 'min' elif 'CrackWidth-1' in pic_type_key: pic_type = '1' elif 'CrackWidth-4' in pic_type_key: pic_type = '4' elif 'CrackWidth-7' in pic_type_key: pic_type = '7' else: raise ValueError(f"ERROR: The picture type {pic_type_key} is not recognised.") if 'Building' in scope: return viia_to_filename( f'{diana_component_abbreviation}_Building_{pic_type}_{analysis_type}') elif 'Floors-interstorey' in scope: return viia_to_filename( f'{diana_component_abbreviation}_{layer}_VLOEREN_{pic_type}_{analysis_type}') elif 'Walls-storey' in scope and 'CrackWidth' in pic_type_key: return viia_to_filename( f'{diana_component_abbreviation}_{layer}_{pic_type}_{analysis_type}') elif 'Walls-storey' in scope: return viia_to_filename( f'{diana_component_abbreviation}_{material_type}_WANDEN_{pic_type}_{analysis_type}') elif 'Reinforcements-storey' in scope: return viia_to_filename( f'{diana_component_abbreviation}_{layer}_WAPENING_{pic_type}_{analysis_type}') elif 'Beams-Material-storey' in scope: return viia_to_filename( f'{diana_component_abbreviation}_{layer}_{material_type}_BALKEN_{pic_type}_{analysis_type}') elif 'Columns-Material-storey' in scope: return viia_to_filename( f'{diana_component_abbreviation}_{layer}_{material_type}_KOLOMMEN_{pic_type}_{analysis_type}') elif 'Floors-Material-storey' in scope: return viia_to_filename( f'{diana_component_abbreviation}_{layer}_{material_type}_VLOEREN_{pic_type}_{analysis_type}') elif 'Floors-Timber-storey' in scope: return viia_to_filename( f'{diana_component_abbreviation}_{layer}_{material_type}_{pic_type}_{analysis_type}') elif 'Roofs-Material-storey' in scope: return viia_to_filename( f'{diana_component_abbreviation}_{layer}_{material_type}_DAKEN_{pic_type}_{analysis_type}') elif 'Roofs-Timber' in scope: return viia_to_filename( f'{diana_component_abbreviation}_DAKEN_{material_type}_{pic_type}_{analysis_type}') elif 'Interfaces-storey' in scope: return viia_to_filename( f'{diana_component_abbreviation}_{layer}_{pic_type}_{analysis_type}') elif analysis_type == 'nls': if 'Building' in scope: return viia_to_filename(f'NLS_{diana_component_abbreviation}_MODEL') elif 'Floors-interstorey' in scope: return viia_to_filename(f'NLS_{diana_component_abbreviation}_{layer}_VLOEREN') elif 'Walls-storey' in scope: return viia_to_filename(f'NLS_{diana_component_abbreviation}_{layer}_WANDEN') raise ValueError( f"ERROR: Result picture name cannot be found for {scope}, {diana_component_abbreviation}. " f"Please check the inputs.")
### =================================================================================================================== ### 3. End of script ### ===================================================================================================================