"""
This file defines the data types that are loaded from the data files.
"""
import numba as nb
import numpy as np
from oasislmf.pytools.common.data import areaperil_int, oasis_float
# Footprint file formats in order of priority
# filenames
[docs]
event_defintion_filename = 'event_definition.parquet'
[docs]
hazard_case_filename = 'hazard_case.parquet'
[docs]
Event = nb.from_dtype(np.dtype([('areaperil_id', areaperil_int),
('intensity_bin_id', np.int32),
('probability', oasis_float)
]))
[docs]
EventCSV = nb.from_dtype(np.dtype([('event_id', np.int32),
('areaperil_id', areaperil_int),
('intensity_bin_id', np.int32),
('probability', oasis_float)
]))
[docs]
EventIndexBin = nb.from_dtype(np.dtype([('event_id', np.int32),
('offset', np.int64),
('size', np.int64)
]))
[docs]
EventIndexBinZ = nb.from_dtype(np.dtype([('event_id', np.int32),
('offset', np.int64),
('size', np.int64),
('d_size', np.int64)
]))
[docs]
Index_type = nb.from_dtype(np.dtype([('start', np.int64),
('end', np.int64)
]))
[docs]
Vulnerability = nb.from_dtype(np.dtype([('vulnerability_id', np.int32),
('intensity_bin_id', np.int32),
('damage_bin_id', np.int32),
('probability', oasis_float)
]))
[docs]
Item = nb.from_dtype(np.dtype([('id', np.int32),
('coverage_id', np.int32),
('areaperil_id', areaperil_int),
('vulnerability_id', np.int32),
('group_id', np.int32)
]))
[docs]
Event_defintion = nb.from_dtype(np.dtype([('section_id', np.int32),
('return_period', np.int32),
('rp_from', np.int32),
('rp_to', np.int32),
('interpolation', np.int32)
]))
[docs]
Hazard_case = nb.from_dtype(np.dtype([('section_id', np.int32),
('areaperil_id', areaperil_int),
('return_period', np.int32),
('intensity', np.int32)
]))
[docs]
Keys = {'LocID': np.int32,
'PerilID': 'category',
'CoverageTypeID': np.int32,
'AreaPerilID': areaperil_int,
'VulnerabilityID': np.int32}