oasislmf.pytools.data_layer.oasis_files.correlations

This file defines the loading and saving for correlations data.

Attributes

Classes

CorrelationsData

This class is responsible for managing the loading and saving of correlation data from binary and CSV files.

Functions

read_correlations(input_path[, ignore_file_type])

Load the correlations from the correlations file.

Module Contents

oasislmf.pytools.data_layer.oasis_files.correlations.logger[source]
oasislmf.pytools.data_layer.oasis_files.correlations.Correlation[source]
class oasislmf.pytools.data_layer.oasis_files.correlations.CorrelationsData(data: pandas.DataFrame | None = None)[source]

This class is responsible for managing the loading and saving of correlation data from binary and CSV files.

Attributes:

data (Optional[pd.DataFrame): correlation data that is either loaded or saved

COLUMNS[source]
data: pandas.DataFrame | None = None[source]
static from_csv(file_path: str) CorrelationsData[source]

Loads correlations data from a CSV file.

Args:

file_path: (str) the path to the CSV file housing the data

Returns: (CorrelationsData) the loaded data from the CSV file

static from_bin(file_path: str) CorrelationsData[source]

Loads correlations data from a binary file.

Args:

file_path: (str) the path to the binary file housing the data

Returns: (CorrelationsData) the loaded data from the binary file

to_csv(file_path: str) None[source]

Writes self.data to a CSV file.

Args:

file_path: (str) the file path for the CSV file to be written to

Returns: None

to_bin(file_path: str) None[source]

Writes self.data to a binary file.

Args:

file_path: (str) the file path for the binary file to be written to

Returns: None

oasislmf.pytools.data_layer.oasis_files.correlations.read_correlations(input_path, ignore_file_type=set())[source]

Load the correlations from the correlations file.

Args:

input_path (str): the path pointing to the file ignore_file_type (Set[str]): file extension to ignore when loading.

Returns:

Tuple[Dict[int, int], List[int], Dict[int, int], List[Tuple[int, int]], List[int]] vulnerability dictionary, vulnerability IDs, areaperil to vulnerability index dictionary, areaperil ID to vulnerability index array, areaperil ID to vulnerability array