Source code for oasislmf.cli.model

__all__ = [
    'GenerateExposurePreAnalysisCmd',
    'GenerateKeysCmd',
    'GeneratePostFileGenCmd',
    'GeneratePrelossCmd',
    'GenerateLossesCmd',
    'GenerateLossesPartialCmd',
    'GenerateLossesOutputCmd',
    'GenerateOasisFilesCmd',
    'ModelCmd',
    'RunCmd'
]

from argparse import RawDescriptionHelpFormatter

from .command import OasisBaseCommand, OasisComputationCommand


[docs] class GenerateExposurePreAnalysisCmd(OasisComputationCommand): """ Generate a new EOD from original one by specifying a model specific pre-analysis hook for exposure modification see ExposurePreAnalysis for more detail """
[docs] formatter_class = RawDescriptionHelpFormatter
[docs] computation_name = 'ExposurePreAnalysis'
[docs] class GeneratePostFileGenCmd(OasisComputationCommand): """ Generate a new EOD from original one by specifying a model specific pre-analysis hook for exposure modification see ExposurePreAnalysis for more detail """
[docs] formatter_class = RawDescriptionHelpFormatter
[docs] computation_name = 'PostFileGen'
[docs] class GeneratePrelossCmd(OasisComputationCommand): """ Generate a new EOD from original one by specifying a model specific pre-analysis hook for exposure modification see ExposurePreAnalysis for more detail """
[docs] formatter_class = RawDescriptionHelpFormatter
[docs] computation_name = 'PreLoss'
[docs] class GenerateKeysCmd(OasisComputationCommand): """ Generates keys from a model lookup, and write Oasis keys and keys error files. """
[docs] formatter_class = RawDescriptionHelpFormatter
[docs] computation_name = 'GenerateKeys'
[docs] class GenerateOasisFilesCmd(OasisComputationCommand): """ Generates the standard Oasis GUL input files + optionally the IL/FM input files and the RI input files. """
[docs] formatter_class = RawDescriptionHelpFormatter
[docs] computation_name = 'GenerateOasisFiles'
[docs] class GenerateLossesCmd(OasisComputationCommand): """ Generates the standard Oasis GUL input files + optionally the IL/FM input files and the RI input files. """
[docs] formatter_class = RawDescriptionHelpFormatter
[docs] computation_name = 'GenerateOasisLosses'
[docs] class GenerateLossesPartialCmd(OasisComputationCommand): """ Distributed Oasis CMD: desc todo """
[docs] formatter_class = RawDescriptionHelpFormatter
[docs] computation_name = 'GenerateLossesPartial'
[docs] class GenerateLossesOutputCmd(OasisComputationCommand): """ Distributed Oasis CMD: desc todo """
[docs] formatter_class = RawDescriptionHelpFormatter
[docs] computation_name = 'GenerateLossesOutput'
[docs] class RunCmd(OasisComputationCommand): """ Run models end to end. The command line arguments can be supplied in the configuration file (``oasislmf.json`` by default or specified with the ``--config`` flag). """
[docs] formatter_class = RawDescriptionHelpFormatter
[docs] computation_name = 'RunModel'
class RunPostAnalysisCmd(OasisComputationCommand): """ Run the output postprocessing step. The command line arguments can be supplied in the configuration file (``oasislmf.json`` by default or specified with the ``--config`` flag). """ formatter_class = RawDescriptionHelpFormatter computation_name = 'PostAnalysis'
[docs] class ModelCmd(OasisBaseCommand): """ Model subcommands:: * generating keys files from model lookups * generating Oasis input CSV files (GUL [+ IL, RI]) * generating losses from a preexisting set of Oasis input CSV files * generating deterministic losses (no model) * running a model end-to-end """
[docs] sub_commands = { 'generate-exposure-pre-analysis': GenerateExposurePreAnalysisCmd, 'generate-keys': GenerateKeysCmd, 'generate-oasis-files': GenerateOasisFilesCmd, 'generate-post-file-gen': GeneratePostFileGenCmd, 'generate-pre-loss': GeneratePrelossCmd, 'generate-losses': GenerateLossesCmd, 'generate-losses-chunk': GenerateLossesPartialCmd, 'generate-losses-output': GenerateLossesOutputCmd, 'run': RunCmd, 'run-postanalysis': RunPostAnalysisCmd, }