oasislmf.computation.generate.keys

Module Contents

Classes

GenerateKeys

Generates keys from a model lookup, and write Oasis keys and keys error files.

GenerateKeysDeterministic

"Abstract" Class for all Computation Step (ExposurePreAnalysis, GulCalc, ...)

class oasislmf.computation.generate.keys.GenerateKeys(**kwargs)[source]

Bases: KeyComputationStep

Generates keys from a model lookup, and write Oasis keys and keys error files.

The model lookup, which is normally independently implemented by the model supplier, should generate keys as dicts with the following format

{
    "id": <loc. ID>,
    "peril_id": <OED sub-peril ID>,
    "coverage_type": <OED coverage type ID>,
    "area_peril_id": <area peril ID>,
    "vulnerability_id": <vulnerability ID>,
    "message": <loc. lookup status message>,
    "status": <loc. lookup status flag indicating success, failure or no-match>
}

The keys generation command can generate these dicts, and write them to file. It can also be used to write these to an Oasis keys file (which is a requirement for model execution), which has the following format.:

LocID,PerilID,CoverageTypeID,AreaPerilID,VulnerabilityID
..
..

This file only lists the locations for which there has been a successful lookup. The keys errors file lists all the locations with failing or non-matching lookups and has the following format:

LocID,PerilID,CoverageTypeID,Message
..
..
step_params[source]
run()[source]

method that will be call by all the interface to execute the computation step

class oasislmf.computation.generate.keys.GenerateKeysDeterministic(**kwargs)[source]

Bases: KeyComputationStep

“Abstract” Class for all Computation Step (ExposurePreAnalysis, GulCalc, …) initialise the object with all specified param un step_param and sub- ComputationStep provide a generic interface to get the all those parameter definitions (get_params)

the Run method must be implemented and contain le business execution logic.

step_params[source]
run()[source]

method that will be call by all the interface to execute the computation step