oasislmf.computation.data.dummy_model.generate

Classes

VulnerabilityFile

Generate random data for Vulnerability dummy model file.

EventsFile

Generate random data for Events dummy model file.

LossFactorsFile

Generate data for Loss Factors dummy model file.

FootprintIdxFile

Generate data for Footprint index dummy model file.

FootprintBinFile

Generate data for Footprint binary dummy model file.

DamageBinDictFile

Generate data for Damage Bin Dictionary dummy model file.

OccurrenceFile

Generate data for Occurrence dummy model file.

RandomFile

Generate data for Random Numbers dummy model file.

CoveragesFile

Generate data for Coverages dummy model Oasis file.

ItemsFile

Generate data for Items dummy model Oasis file.

AmplificationsFile

Generate data for Amplifications dummy model Oasis file.

FMProgrammeFile

Generate data for Financial Model Programme dummy model Oasis file.

FMPolicyTCFile

Generate data for Financial Model Policy dummy model Oasis file.

FMProfileFile

Generate data for Financial Model Profile dummy model Oasis file.

FMXrefFile

Generate data for Financial Model Cross Reference dummy model Oasis file.

GULSummaryXrefFile

Generate data for Ground Up Losses Summary Cross Reference dummy model Oasis

FMSummaryXrefFile

Generate data for Financial Model Summary Cross Reference dummy model Oasis

Module Contents

class oasislmf.computation.data.dummy_model.generate.VulnerabilityFile(num_vulnerabilities, num_intensity_bins, num_damage_bins, vulnerability_sparseness, random_seed, directory)[source]

Bases: ModelFile

Generate random data for Vulnerability dummy model file.

This file shows the conditional distributions of damage for each intensity bin and for each vulnerability ID.

Attributes:

generate_data: Generate Vulnerability dummy model file data.

num_vulnerabilities[source]
num_intensity_bins[source]
num_damage_bins[source]
vulnerability_sparseness[source]
dtypes[source]
start_stats[source]
random_seed[source]
data_length[source]
file_name[source]
generate_data()[source]

Generate Vulnerability dummy model file data.

Yields:

vulnerability (int): vulnerability ID. intensity_bin (int): intensity bin ID. damage_bin (int): damage bin ID. probability (float): impact probability.

class oasislmf.computation.data.dummy_model.generate.EventsFile(num_events, directory)[source]

Bases: ModelFile

Generate random data for Events dummy model file.

This file lists event IDs to be run.

Attributes:

generate_data: Generate Events dummy model file data.

num_events[source]
dtypes[source]
start_stats = None[source]
data_length[source]
file_name[source]
generate_data()[source]

Generate Events dummy model file data.

Yields:

event (int): event ID.

class oasislmf.computation.data.dummy_model.generate.LossFactorsFile(num_events, num_amplifications, min_pla_factor, max_pla_factor, random_seed, directory)[source]

Bases: ModelFile

Generate data for Loss Factors dummy model file.

This file maps post loss amplification/reduction loss factors to event ID-amplification ID pairs.

Attributes:

generate_data: Geenrate Loss Factors dummy model file data. write_file: Write data to Loss Factors dummy model file in binary

format.

num_events[source]
num_amplifications[source]
min_pla_factor[source]
delta_pla_factor[source]
random_seed[source]
file_name[source]
start_stats[source]
dtypes[source]
generate_data()[source]

Generate Loss Factors dummy model file data.

Yields:

event (int): event ID amplification (int): amplification ID factor (float): post loss amplification/reduction factor

write_file()[source]

Write data to output Loss Factors file in binary format.

Checks number of amplifications are greater than 0 before calling base class method.

class oasislmf.computation.data.dummy_model.generate.FootprintIdxFile(directory)[source]

Bases: ModelFile

Generate data for Footprint index dummy model file.

The binary footprint file footprint.bin requires the index file footprint.idx.

Attributes:

write_file: Write data to Footprint index file in binary format.

dtypes[source]
dtypes_list[source]
file_name[source]
write_file(event_id, offset, event_size)[source]

Write data to output Footprint index file in binary format.

Overrides method in base class. Converts data to arguments to binary and writes to file. Called by FootprintBinFile.generate_data().

Args:

event_id (int): event ID. offset (long long): position of data for event ID in generated

Footprint binary file relative to beginning of that file.

size (long long): size of data corresponding to event ID in

generated Footprint binary file, long long.

class oasislmf.computation.data.dummy_model.generate.FootprintBinFile(num_events, num_areaperils, areaperils_per_event, num_intensity_bins, intensity_sparseness, no_intensity_uncertainty, random_seed, directory)[source]

Bases: ModelFile

Generate data for Footprint binary dummy model file.

This file shows the intensity of a given event-areaperil combination. The binary footprint file footprint.bin requires the index file footprint.idx.

Attributes:

generate_data: Generate Footprint binary dummy model file data.

num_events[source]
num_areaperils[source]
areaperils_per_event[source]
num_intensity_bins[source]
intensity_sparseness[source]
no_intensity_uncertainty[source]
random_seed[source]
file_name[source]
event_id = 0[source]
start_stats[source]
dtypes[source]
idx_file[source]
size = 0[source]
offset = 0[source]
generate_data()[source]

Generate Footprint binary dummy model file data.

Yields:

areaperil (int): areaperil ID. intensity_bin (int): intensity bin ID. probability (float): impact probability.

class oasislmf.computation.data.dummy_model.generate.DamageBinDictFile(num_damage_bins, directory)[source]

Bases: ModelFile

Generate data for Damage Bin Dictionary dummy model file.

This file shows the discretisation of the effective damageability cumulative distribution function.

Attributes:

generate_data: Generate Damage Bin Dictionary dummy model file data.

num_damage_bins[source]
dtypes[source]
start_stats = None[source]
data_length[source]
file_name[source]
generate_data()[source]

Generate Damage Bin Dictionary dummy model file data.

First bin always runs from 0 to 0, i.e. has a midpoint (interpolation) of 0. Last bin always runs from 0 to 0, i.e. has a midpoint (interpolation) of 1.

Yields:

bin_id (int): damage bin ID. bin_from (float): damage bin lower limit. bin_to (float): damage bin upper limit. interpolation (float): damage bin midpoint. interval_type (int): interval_type (deprecated).

class oasislmf.computation.data.dummy_model.generate.OccurrenceFile(num_events, num_periods, random_seed, directory, mean, stddev)[source]

Bases: ModelFile

Generate data for Occurrence dummy model file.

This file maps events to periods, which can represent any length of time.

Attributes:
get_num_periods_from_truncated_normal_cdf: Get number of periods on

event-by-event basis.

get_num_periods_from_truncated_normal_cdf: Get number of periods from

truncated normal cumulative distribution function.

set_occ_date_id: Set date of occurrence in ktools format. generate_data: Generate Occurrence dummy model file data.

num_events[source]
num_periods[source]
dtypes[source]
date_algorithm = 1[source]
start_stats[source]
random_seed[source]
data_length[source]
mean[source]
stddev[source]
file_name[source]
get_num_periods_from_truncated_normal_cdf()[source]

Get number of periods from truncated normal cumulative distribution function.

Events can occur mupltiple times over multiple periods in the occurrence file. The number of periods per event is modelled by sampling from a truncated normal distribution with mean self.mean and standard deviation self.stddev. The lower tail of the distribution is truncated at 0.5 and the cumulative distribution function is given by:

F(x) = [Phi(g(x)) - Phi(g(a))] / [Phi(g(b)) - Phi(g(a))] g(y) = (y - mean) / standard_deviation Phi(g(y)) = 1/2 * (1 + erf(g(y) / sqrt(2))) a = lower boundary = 0.5, b = upper boundary = infinity

therefore g(b) -> infinity ===> Phi(g(b)) -> 1

Returns:
bound_a (int): lower boundary, when converted to an integer gives

number of periods for this event.

get_num_periods_per_event()[source]

Get number of periods on event-by-event basis.

Determines whether sampling of truncated normal cumulative distribution function is required to obtain number of periods for this event.

Returns:

mean|bound_a (int): Number of periods for this event.

set_occ_date_id(year, month, day)[source]

Set date of occurrence in ktools format.

Reduce year, month and day information to a single integer.

Args:

year (int): year. month (int): month. day (int): day.

Returns:

date (int): date in ktools format.

generate_data()[source]

Generate Occurrence dummy model file data.

Yields:

event (int): event ID. period_no (int): period number. date (int): date in ktools format.

class oasislmf.computation.data.dummy_model.generate.RandomFile(num_randoms, random_seed, directory)[source]

Bases: ModelFile

Generate data for Random Numbers dummy model file.

This optional file contains random numbers for ground up loss sampling.

Attributes:

generate_data: Generate Random Numbers dummy model file data.

num_randoms[source]
dtypes[source]
start_stats = None[source]
random_seed[source]
data_length[source]
file_name[source]
generate_data()[source]

Generate Random Numbers dummy model file data.

Yields:

random number (float): random number.

class oasislmf.computation.data.dummy_model.generate.CoveragesFile(num_locations, coverages_per_location, random_seed, directory)[source]

Bases: ModelFile

Generate data for Coverages dummy model Oasis file.

This file maps coverage IDs to Total Insured Values.

Attributes:

generate_data: Generate Coverages dummy model Oasis file data.

num_locations[source]
coverages_per_location[source]
dtypes[source]
start_stats = None[source]
random_seed[source]
data_length[source]
file_name[source]
generate_data()[source]

Generate Coverages dummy model file data.

Yields:

total insured value (float): Total Insured Value (TIV).

class oasislmf.computation.data.dummy_model.generate.ItemsFile(num_locations, coverages_per_location, num_areaperils, num_vulnerabilities, random_seed, directory)[source]

Bases: ModelFile

Generate data for Items dummy model Oasis file.

This file lists the exposure items for which ground up loss will be sampled.

Attributes:

generate_data: Generate Items dummy model Oasis file data.

num_locations[source]
coverages_per_location[source]
num_areaperils[source]
num_vulnerabilities[source]
dtypes[source]
start_stats = None[source]
random_seed[source]
data_length[source]
file_name[source]
generate_data()[source]

Generate Items dummy model file data.

Yields:

item (int): item ID. item (int): coverage ID = item ID (1-1 mapping). areaperils[coverage] (int): areaperil ID corresponding to

coverage ID.

vulnerabilities[coverage] (int): vulnerability ID corresponding to

coverage ID.

location (int): group ID mapped to location ID.

class oasislmf.computation.data.dummy_model.generate.AmplificationsFile(num_locations, coverages_per_location, num_amplifications, random_seed, directory)[source]

Bases: ModelFile

Generate data for Amplifications dummy model Oasis file.

This file maps exposure items to amplification IDs.

Attributes:

generate_data: Generate Amplifications dummy model Oasis file data. write_file: Write data to Amplifications dummy model Oasis file in

binary format.

num_items[source]
num_amplifications[source]
random_seed[source]
file_name[source]
start_stats[source]
dtypes[source]
generate_data()[source]

Generate Amplifications dummy model Oasis file data.

Yields:

item (int): item ID amplification (int): amplification ID

write_file()[source]

Write data to output Amplifications file in binary format.

Checks number of amplifications are greater than 0 before calling base class method.

class oasislmf.computation.data.dummy_model.generate.FMProgrammeFile(num_locations, coverages_per_location, directory)[source]

Bases: FMFile

Generate data for Financial Model Programme dummy model Oasis file.

This file shows the level hierarchy.

Attributes:
generate_data: Generate Financial Model Programme dummy model Oasis file

data.

dtypes[source]
data_length[source]
file_name[source]
generate_data()[source]

Generate Financial Model Programme dummy model file data.

Yields:

agg_id (int): from aggregate ID. level (int): level ID. agg_id (int): to aggregate ID.

class oasislmf.computation.data.dummy_model.generate.FMPolicyTCFile(num_locations, coverages_per_location, num_layers, directory)[source]

Bases: FMFile

Generate data for Financial Model Policy dummy model Oasis file.

This file shows the calculation rule (from the Financial Model Policy file) that should be applied to aggregations of loss at a particular level.

Attributes:
generate_data: Generate Financial Model Policy dummy model Oasis file

data.

num_layers[source]
dtypes[source]
data_length[source]
file_name[source]
generate_data()[source]

Generate Financial Model Policy dummy model file data.

Yields:

level (int): level ID. agg_id (int): aggregate ID. layer (int): layer ID. profile_id (int): profile ID.

class oasislmf.computation.data.dummy_model.generate.FMProfileFile(num_layers, directory)[source]

Bases: ModelFile

Generate data for Financial Model Profile dummy model Oasis file.

This file contains the list of calculation rules with profile values used to generate insurance losses.

Attributes:
generate_data: Generate Financial Model Profile dummy model Oasis file

data.

num_layers[source]
dtypes[source]
start_stats = None[source]
data_length[source]
file_name[source]
generate_data()[source]

Generate Financial Model Profile dummy model file data.

Yields:

profile_id (int): profile ID. calculation rule ID (int): calculation rule ID (2 or 100). first deductible (float): first deductible (fixed at 0.0). second deductible (float): second deductible (fixed at 0.0). third deductible (float): third deductible (fixed at 0.0). attachment1 (float): attachment point/excess. limit1 (float): limit. first proportional share (float): first proportional

share (0.0 or 0.3).

second proportional share (float): second proportional

share (fixed at 0.0).

third proportional share (float): third proportional

share (fixed at 0.0).

class oasislmf.computation.data.dummy_model.generate.FMXrefFile(num_locations, coverages_per_location, num_layers, directory)[source]

Bases: FMFile

Generate data for Financial Model Cross Reference dummy model Oasis file.

This file shows the mapping between the financial model output ID, and aggregate and layer IDs.

Attributes:
generate_data: Generate Financial Model Cross Reference dummy model

Oasis file data.

num_layers[source]
dtypes[source]
data_length[source]
file_name[source]
generate_data()[source]

Generate Financial Model Cross Reference dummy model file data.

Yields:

output_count (int): output ID. agg_id (int): aggregate ID. layer (int): layer ID.

class oasislmf.computation.data.dummy_model.generate.GULSummaryXrefFile(num_locations, coverages_per_location, directory)[source]

Bases: FMFile

Generate data for Ground Up Losses Summary Cross Reference dummy model Oasis file.

This file shows how item ground up losses are summed together at various summary levels in summarycalc.

Attributes:
generate_data: Generate Ground Up Losses Summary Cross Reference dummy

model Oasis file data.

dtypes[source]
data_length[source]
file_name[source]
generate_data()[source]

Generate Ground Up Losses Summary Cross Reference dummy model file data.

Yields:

item (int): item ID. summary_id (int): summary ID. summaryset_id (int): summary set ID.

class oasislmf.computation.data.dummy_model.generate.FMSummaryXrefFile(num_locations, coverages_per_location, num_layers, directory)[source]

Bases: FMFile

Generate data for Financial Model Summary Cross Reference dummy model Oasis file.

This file shows how insurance losses are summed together at various levels by summarycalc.

Attributes:
generate_data: Generate Financial Model Summary Cross Reference dummy

model Oasis file data.

num_layers[source]
dtypes[source]
data_length[source]
file_name[source]
generate_data()[source]

Generate Financial Model Summary Cross Reference dummy model file data.

Yields:

output_id (int): output ID. summary_id (int): summary ID. summaryset_id (int): summary set ID.