Source code for oasislmf.pytools.lec.data

import numba as nb
import numpy as np

from oasislmf.pytools.common.data import oasis_float, oasis_int

# Output flags
[docs] AGG_FULL_UNCERTAINTY = 0
[docs] AGG_WHEATSHEAF = 1
[docs] AGG_SAMPLE_MEAN = 2
[docs] AGG_WHEATSHEAF_MEAN = 3
[docs] OCC_FULL_UNCERTAINTY = 4
[docs] OCC_WHEATSHEAF = 5
[docs] OCC_SAMPLE_MEAN = 6
[docs] OCC_WHEATSHEAF_MEAN = 7
# EPCalcs
[docs] MEANDR = 1
[docs] FULL = 2
[docs] PERSAMPLEMEAN = 3
[docs] MEANSAMPLE = 4
# EPTypes
[docs] OEP = 1
[docs] OEPTVAR = 2
[docs] AEP = 3
[docs] AEPTVAR = 4
# Outloss mean and sample dtype, summary_id, period_no (and sidx) obtained from index
[docs] OUTLOSS_DTYPE = np.dtype([ ("row_used", np.bool_), ("agg_out_loss", oasis_float), ("max_out_loss", oasis_float), ])
[docs] EPT_output = [ ('SummaryId', oasis_int, '%d'), ('EPCalc', oasis_int, '%d'), ('EPType', oasis_int, '%d'), ('ReturnPeriod', oasis_float, '%.6f'), ('Loss', oasis_float, '%.6f'), ]
[docs] PSEPT_output = [ ('SummaryId', oasis_int, '%d'), ('SampleId', oasis_int, '%d'), ('EPType', oasis_int, '%d'), ('ReturnPeriod', oasis_float, '%.6f'), ('Loss', oasis_float, '%.6f'), ]
[docs] EPT_headers = [c[0] for c in EPT_output]
[docs] PSEPT_headers = [c[0] for c in PSEPT_output]
[docs] EPT_dtype = np.dtype([(c[0], c[1]) for c in EPT_output])
[docs] PSEPT_dtype = np.dtype([(c[0], c[1]) for c in PSEPT_output])
[docs] EPT_fmt = ','.join([c[2] for c in EPT_output])
[docs] PSEPT_fmt = ','.join([c[2] for c in PSEPT_output])
[docs] LOSSVEC2MAP_dtype = np.dtype([ ("summary_id", oasis_int), ("period_no", np.int32), ("period_weighting", np.float64), ("value", oasis_float), ])
[docs] WHEATKEYITEMS_dtype = np.dtype([ ("summary_id", oasis_int), ("sidx", oasis_int), ("period_no", np.int32), ("period_weighting", np.float64), ("value", oasis_float), ])
[docs] MEANMAP_dtype = np.dtype([ ("retperiod", np.float64), ("mean", np.float64), ("count", np.int32), ])
# For Dict of summary_id (oasis_int) to nb_Tail_valtype
[docs] TAIL_valtype = np.dtype([ ("retperiod", np.float64), ("tvar", oasis_float), ])
[docs] NB_TAIL_valtype = nb.types.Array(nb.from_dtype(TAIL_valtype), 1, "C")