oasislmf.pytools.gulmc.manager

Ground-up loss Monte Carlo (gulmc) manager.

Jagged Array Naming Convention

<key_name>_ja_id_ind — optional sparse ID → dense index (id_index.py) <key_name>_ja_offsets — row boundaries: row i spans [offsets[i], offsets[i+1]) <key_name>_ja_<values> — one or more parallel flat arrays holding payload data

Two-level (nested) jagged arrays repeat the pattern on the payload: <key_name>_ja_<inner_key>_ja_offsets — L2 row boundaries <key_name>_ja_<inner_key>_ja_<values> — L2 payload data

Attributes

Functions

run(run_dir, ignore_file_type, sample_size, ...[, ...])

Execute the main gulmc workflow.

get_last_non_empty(cdf, bin_i)

Remove empty bucket from the end

pdf_to_cdf(pdf, empty_cdf)

Return the cumulative distribution from the probality distribution

calc_eff_damage_cdf(vuln_pdf, haz_pdf, ...)

Calculate the covoluted cumulative distribution between vulnerability damage and hazard probability distribution

get_gul_from_vuln_cdf(vuln_rval, vuln_cdf, ...)

compute_damage_bin_scaling(damage_bins, ...)

Determine the tiv scaling factor to apply to gul values for a coverage.

compute_haz_bin_id(haz_pdf_record, item, ...)

Resolve the hazard intensity bin ids for an item's hazard pdf records.

build_vuln_pdf(item, Nhaz_bins, haz_bin_id, ...)

Assemble the per-hazard-bin vulnerability pdf for an item.

resolve_item_cdfs(compute_info, cdf_group, ...)

Return an item's effective-damage CDF (and per-hazard-bin vuln CDFs), computing or reading the cache.

draw_correlation_samples(compute_info, item, ...)

Draw the (optionally correlated) hazard and damage random values for one item.

sample_item_losses(compute_info, item_j, sample_size, ...)

Write the per-sample gul (or debug random values) for one item into losses.

compute_event_losses(compute_info, coverages, ...)

Compute ground-up losses for all coverages in a single event.

process_areaperils_in_footprint(event_footprint, ...)

Process areaperils in the footprint, filtering to those with vulnerability functions.

reconstruct_coverages(compute_info, ap_inds, ...)

Register each item to its coverage and prepare per-item event data for loss computation.

Module Contents

oasislmf.pytools.gulmc.manager.logger[source]
oasislmf.pytools.gulmc.manager.CDF_CACHE_EMPTY[source]
oasislmf.pytools.gulmc.manager.NO_RNG_INDEX[source]
oasislmf.pytools.gulmc.manager.run(run_dir, ignore_file_type, sample_size, loss_threshold, alloc_rule, debug, random_generator, peril_filter=[], file_in=None, file_out=None, data_server=None, ignore_correlation=False, ignore_haz_correlation=False, effective_damageability=False, max_cached_vuln_cdf_size_MB=200, model_df_engine='oasis_data_manager.df_reader.reader.OasisPandasReader', dynamic_footprint=False, **kwargs)[source]

Execute the main gulmc workflow.

Parameters:
  • run_dir (str) – the directory of where the process is running

  • ignore_file_type (set(str)) – file extension to ignore when loading

  • sample_size (int) – number of random samples to draw.

  • loss_threshold (float) – threshold above which losses are printed to the output stream.

  • alloc_rule (int) – back-allocation rule.

  • debug (int) – for each random sample, print to the output stream the random loss (if 0), the random value used to draw the hazard intensity sample (if 1), the random value used to draw the damage sample (if 2). Defaults to 0.

  • random_generator (int) – random generator function id.

  • peril_filter (list[int], optional) – list of perils to include in the computation (if None, all perils will be included). Defaults to [].

  • file_in (str, optional) – filename of input stream. Defaults to None.

  • file_out (str, optional) – filename of output stream. Defaults to None.

  • data_server (bool, optional) – if True, run the data server. Defaults to None.

  • ignore_correlation (bool, optional) – if True, do not compute correlated random samples. Defaults to False.

  • ignore_haz_correlation (bool, optional) – if True, do not compute correlated hazard intensity samples. Defaults to False.

  • effective_damageability (bool, optional) – if True, it uses effective damageability to draw damage samples instead of using the full monte carlo approach (i.e., to draw hazard intensity first, then damage).

  • max_cached_vuln_cdf_size_MB (int, optional) – size in MB of the in-memory cache to store and reuse vulnerability cdf. Defaults to 200.

  • model_df_engine (str, optional) – The engine to use when loading model dataframes. Defaults to OasisPandasReader.

  • dynamic_footprint (bool, optional) – if True, load the dynamic footprint data and adjust hazard intensities at runtime. Defaults to False.

  • **kwargs – additional keyword arguments. socket_server (str) enables the progress ping and, when numeric, gives the port to override; analysis_pk is reported with each ping.

Raises:
  • ValueError – if alloc_rule is not 0, 1, 2, or 3.

  • ValueError – if alloc_rule is 1, 2, or 3 when debug is 1 or 2.

Returns:

0 if no errors occurred.

Return type:

int

oasislmf.pytools.gulmc.manager.get_last_non_empty(cdf, bin_i)[source]

Remove empty bucket from the end

Parameters:
  • cdf – cumulative distribution

  • bin_i – last valid bin index

Returns:

last bin index with an increased in the cdf

oasislmf.pytools.gulmc.manager.pdf_to_cdf(pdf, empty_cdf)[source]

Return the cumulative distribution from the probality distribution

Parameters:
  • pdf (np.array[float]) – probality distribution

  • empty_cdf (np.array[float]) – cumulative distribution buffer for output

Returns:

here we return only the valid part if needed

Return type:

cdf (np.array[float])

oasislmf.pytools.gulmc.manager.calc_eff_damage_cdf(vuln_pdf, haz_pdf, eff_damage_cdf_empty)[source]

Calculate the covoluted cumulative distribution between vulnerability damage and hazard probability distribution

Parameters:
  • vuln_pdf (np.array[float]) – vulnerability damage probability distribution

  • haz_pdf (np.array[float]) – hazard probability distribution

  • eff_damage_cdf_empty (np.array[float]) – output buffer

Returns:

cdf is stored in eff_damage_cdf_empty, here we return only the valid part if needed

Return type:

eff_damage_cdf (np.array[float])

oasislmf.pytools.gulmc.manager.get_gul_from_vuln_cdf(vuln_rval, vuln_cdf, Ndamage_bins, damage_bins, bin_scaling)[source]
oasislmf.pytools.gulmc.manager.compute_damage_bin_scaling(damage_bins, Neff_damage_bins, tiv)[source]

Determine the tiv scaling factor to apply to gul values for a coverage.

The scaling depends on the damage type recorded in the last effective damage bin: relative functions scale by tiv, absolute by 1, duration converts annual tiv to daily, and the default path infers relative-vs-absolute from whether the last bin_to is <= 1.

Parameters:
  • damage_bins (np.array) – damage bin dictionary with bin_to and damage_type fields.

  • Neff_damage_bins (int) – number of effective damage bins.

  • tiv (float) – total insured value of the coverage.

Returns:

the scaling factor applied to damage-bin values to produce gul.

Return type:

float

oasislmf.pytools.gulmc.manager.compute_haz_bin_id(haz_pdf_record, item, intensity_adjustment, dynamic_footprint, intensity_bin_peril_ids, intensity_bins)[source]

Resolve the hazard intensity bin ids for an item’s hazard pdf records.

With no dynamic footprint the intensity bin ids are read directly from the hazard pdf. With a dynamic footprint the recorded intensities are shifted by intensity_adjustment, clamped to the valid range, and re-mapped to bin ids via the per-peril intensity_bins lookup table.

Parameters:
  • haz_pdf_record (np.array[haz_arr_type]) – hazard pdf records for this item’s areaperil.

  • item (np.void) – the item record (needs peril_id when dynamic footprint is active).

  • intensity_adjustment (int) – intensity shift to apply under a dynamic footprint.

  • dynamic_footprint (None or object) – None if no dynamic footprint, otherwise truthy.

  • intensity_bin_peril_ids (np.array[int32]) – sorted unique encoded peril_ids.

  • intensity_bins (np.array[int32, 2d]) – [peril_idx, intensity_value] -> intensity_bin_id.

Returns:

intensity bin ids, one per hazard pdf record.

Return type:

np.array

oasislmf.pytools.gulmc.manager.build_vuln_pdf(item, Nhaz_bins, haz_bin_id, vuln_array, Ndamage_bins_max, areaperil_agg_vuln_idx_ja_offsets, areaperil_agg_vuln_idx_ja_data, vuln_pdf_empty)[source]

Assemble the per-hazard-bin vulnerability pdf for an item.

For a single (non-aggregate) vulnerability the pdf is read straight out of vuln_array. For an aggregate vulnerability the weighted sum of the member vulnerabilities is built from the jagged arrays; bins with no probability collapse to 100% no-loss in the first damage bin, and the result is normalised by the total weight (or by the member count when all weights are zero).

Parameters:
  • item (np.void) – the item record (uses areaperil_agg_vuln_idx / vulnerability_idx).

  • Nhaz_bins (int) – number of hazard bins for this item.

  • haz_bin_id (np.array) – intensity bin id per hazard record.

  • vuln_array (np.array[float]) – 3d vulnerability array (Nvulnerability, Ndamage_bins_max, Nintensity_bins).

  • Ndamage_bins_max (int) – maximum number of damage bins.

  • areaperil_agg_vuln_idx_ja_offsets (np.array[oasis_int]) – jagged array offsets.

  • areaperil_agg_vuln_idx_ja_data (np.array) – merged structured array with ‘vuln_idx’ and ‘weight’.

  • vuln_pdf_empty (np.array[float]) – reusable buffer sliced to (Nhaz_bins, Ndamage_bins_max).

Returns:

the vulnerability pdf, shape (Nhaz_bins, Ndamage_bins_max).

Return type:

np.array[float]

oasislmf.pytools.gulmc.manager.resolve_item_cdfs(compute_info, cdf_group, do_calc_vuln_ptf, Nhaz_bins, item, haz_bin_id, haz_pdf_prob, vuln_array, areaperil_agg_vuln_idx_ja_offsets, areaperil_agg_vuln_idx_ja_data, cdf_cache_tag, cdf_cache_nbins, cdf_cache_mask, cached_vuln_cdfs, vuln_pdf_empty, eff_damage_cdf_empty, haz_i_to_Ndamage_bins_empty, haz_i_to_vuln_cdf_empty)[source]

Return an item’s effective-damage CDF (and per-hazard-bin vuln CDFs), computing or reading the cache.

On a cache miss the vulnerability pdf is (re)built, the effective damage CDF is computed and written to cache slot 0, and — when not running effective_damageability — each per-hazard-bin vulnerability CDF is computed and written to the following contiguous slots. On a cache hit the same CDFs are read back from those slots. compute_info['cdf_cache_ctr'], cdf_cache_tag, cdf_cache_nbins and cached_vuln_cdfs are mutated in place.

The haz_i_to_* outputs are always returned (sliced from their reusable buffers) so the return type is stable; they are only populated when effective_damageability is False, which is also the only case in which the caller reads them.

Returns:

(eff_damage_cdf, haz_i_to_Ndamage_bins, haz_i_to_vuln_cdf).

Return type:

tuple

oasislmf.pytools.gulmc.manager.draw_correlation_samples(compute_info, item, hazard_rng_index, rng_index, sample_size, haz_rndms_base, vuln_rndms_base, haz_eps_ij, damage_eps_ij, norm_inv_parameters, norm_inv_cdf, norm_cdf, vuln_adj, haz_z_unif, vuln_z_unif)[source]

Draw the (optionally correlated) hazard and damage random values for one item.

Writes sample_size values into haz_z_unif and vuln_z_unif in place. When correlation is enabled for the relevant dimension the values are drawn through the Gaussian copula (get_corr_rval); otherwise the item’s base random values are copied straight across. Hazard values are only drawn when hazard_rng_index >= 0 (non-deterministic hazard under full Monte Carlo). For a single (non-aggregate) vulnerability the damage values are scaled by the per-vulnerability adjustment.

Parameters:
  • compute_info (gulmc_compute_info_type) – computation state (do_haz_correlation, do_correlation).

  • item (np.void) – the item record (correlation values, peril_correlation_group, vuln idx).

  • hazard_rng_index (int) – index into haz_rndms_base, or < 0 if hazard is deterministic.

  • rng_index (int) – index into vuln_rndms_base for damage sampling.

  • sample_size (int) – number of random samples to draw.

  • haz_rndms_base (np.array[float64]) – base random values for hazard sampling.

  • vuln_rndms_base (np.array[float64]) – base random values for damage sampling.

  • haz_eps_ij (np.array[float]) – correlated random values for hazard sampling.

  • damage_eps_ij (np.array[float]) – correlated random values for damage sampling.

  • norm_inv_parameters (NormInversionParameters) – parameters for Gaussian inversion.

  • norm_inv_cdf (np.array[float]) – inverse Gaussian cdf lookup table.

  • norm_cdf (np.array[float]) – Gaussian cdf lookup table.

  • vuln_adj (np.array[float]) – per-vulnerability adjustment factors.

  • haz_z_unif (np.array[float]) – output buffer for hazard random values.

  • vuln_z_unif (np.array[float]) – output buffer for damage random values.

oasislmf.pytools.gulmc.manager.sample_item_losses(compute_info, item_j, sample_size, hazard_rng_index, dynamic_footprint, item_event_data, haz_z_unif, vuln_z_unif, haz_cdf_prob, Nhaz_bins, eff_damage_cdf, Neff_damage_bins, haz_i_to_Ndamage_bins, haz_i_to_vuln_cdf, damage_bins, damage_bin_scaling, losses)[source]

Write the per-sample gul (or debug random values) for one item into losses.

In debug modes 1/2 the drawn hazard/damage random values are stored directly. Otherwise the gul is computed per sample: under effective_damageability from the single effective damage CDF; with a single hazard bin from that bin’s vulnerability CDF; and in the general case by drawing the hazard bin per sample (with per-sample return-period protection under a dynamic footprint) and using that bin’s vulnerability CDF.

Parameters:
  • compute_info (gulmc_compute_info_type) – computation state (debug, effective_damageability).

  • item_j (int) – column index of this item within the coverage’s loss buffer.

  • sample_size (int) – number of random samples.

  • hazard_rng_index (int) – index into hazard random values, or < 0 if hazard deterministic.

  • dynamic_footprint (None or object) – None if no dynamic footprint, otherwise truthy.

  • item_event_data (np.void) – per-item event data (return_period, event_rp).

  • haz_z_unif (np.array[float]) – hazard random values for this item.

  • vuln_z_unif (np.array[float]) – damage random values for this item.

  • haz_cdf_prob (np.array[float]) – hazard intensity cdf.

  • Nhaz_bins (int) – number of hazard bins.

  • eff_damage_cdf (np.array[oasis_float]) – effective damage cdf.

  • Neff_damage_bins (int) – number of effective damage bins.

  • haz_i_to_Ndamage_bins (np.array[oasis_int]) – per-hazard-bin vulnerability cdf lengths.

  • haz_i_to_vuln_cdf (np.array) – per-hazard-bin vulnerability cdfs.

  • damage_bins (np.array) – damage bin dictionary.

  • damage_bin_scaling (float) – tiv scaling factor.

  • losses (np.array[oasis_float]) – loss buffer written in place at column item_j.

oasislmf.pytools.gulmc.manager.compute_event_losses(compute_info, coverages, coverage_ids, items_event_data, items, sample_size, haz_pdf, haz_arr_ptr, vuln_array, damage_bins, cdf_cache_tag, cdf_cache_nbins, cdf_cache_mask, cached_vuln_cdfs, areaperil_agg_vuln_idx_ja_offsets, areaperil_agg_vuln_idx_ja_data, losses, haz_rndms_base, vuln_rndms_base, vuln_adj, haz_eps_ij, damage_eps_ij, norm_inv_parameters, norm_inv_cdf, norm_cdf, vuln_z_unif, haz_z_unif, byte_mv, dynamic_footprint, intensity_bin_peril_ids, intensity_bins)[source]

Compute ground-up losses for all coverages in a single event.

Iterates over coverages and their items, looking up or computing the vulnerability cdf for each item, then sampling losses using the pre-generated random numbers. Results are written into a byte buffer for streaming output.

CDF caching uses a monotonic write counter and array-based slot tracking. Each unique (areaperil, vuln_id[, intensity_adjustment]) CDF group has a pre-computed index stored in eff_cdf_id. cdf_cache_tag[triplet_idx] records the write counter value when the CDFs were cached. A slot is valid when cdf_cache_tag[triplet_idx] >= 0 and cdf_cache_ctr - cdf_cache_tag[triplet_idx] < cdf_cache_size. Physical slot indexing uses bitwise AND with cdf_cache_mask (power-of-two sized cache).

For effective_damageability=False, CDFs are stored as contiguous blocks: slot 0 = effective damage CDF, slots 1..Nhaz_bins = per-intensity-bin vulnerability CDFs.

Parameters:
  • compute_info (gulmc_compute_info_type) – computation state (event_id, cursor position, coverage range, cdf_cache_ctr, thresholds, flags).

  • coverages (numpy.array[coverage_type]) – coverage data indexed by coverage_id.

  • coverage_ids (numpy.array[int]) – ordered list of coverage_ids to process in this event.

  • items_event_data (numpy.array[items_MC_data_type]) – per-item event data populated by reconstruct_coverages, containing item_idx, haz_arr_i, rng_index, hazard_rng_index, and eff_cdf_id (CDF group index).

  • items (np.ndarray) – items table merged with correlation parameters.

  • sample_size (int) – number of random samples to draw.

  • haz_pdf (np.array[haz_arr_type]) – hazard intensity pdf records for this event.

  • haz_arr_ptr (np.array[int64]) – indices where each areaperil’s hazard records start in haz_pdf.

  • vuln_array (np.array[float]) – 3d vulnerability array of shape (Nvulnerability, Ndamage_bins_max, Nintensity_bins).

  • damage_bins (np.array) – damage bin dictionary with bin_from, bin_to, interpolation, damage_type.

  • cdf_cache_tag (np.array[int64]) – CDF group index → write counter when cached (CDF_CACHE_EMPTY = -1).

  • cdf_cache_nbins (np.array[int32]) – physical slot → CDF length (Ndamage_bins).

  • cdf_cache_mask (int64) – bitmask for physical slot indexing (cdf_cache_size - 1).

  • cached_vuln_cdfs (np.array[oasis_float]) – 2d cdf cache of shape (cdf_cache_size, Ndamage_bins_max).

  • areaperil_agg_vuln_idx_ja_offsets (np.array[oasis_int]) – jagged array offsets.

  • areaperil_agg_vuln_idx_ja_data (np.array[agg_vuln_idx_weight_dtype]) – merged structured array with fields ‘vuln_idx’ (dense vulnerability index) and ‘weight’ (vulnerability weight).

  • losses (numpy.array[oasis_float]) – reusable 2d buffer for loss values.

  • haz_rndms_base (numpy.array[float64]) – base random values for hazard intensity sampling.

  • vuln_rndms_base (numpy.array[float64]) – base random values for damage sampling.

  • vuln_adj (np.array[float]) – per-vulnerability adjustment factors.

  • haz_eps_ij (np.array[float]) – correlated random values for hazard sampling.

  • damage_eps_ij (np.array[float]) – correlated random values for damage sampling.

  • norm_inv_parameters (NormInversionParameters) – parameters for Gaussian inversion.

  • norm_inv_cdf (np.array[float]) – inverse Gaussian cdf lookup table.

  • norm_cdf (np.array[float]) – Gaussian cdf lookup table.

  • vuln_z_unif (np.array[float]) – reusable buffer for correlated vulnerability random values.

  • haz_z_unif (np.array[float]) – reusable buffer for correlated hazard random values.

  • byte_mv (numpy.array[byte]) – output byte buffer for the binary stream.

  • dynamic_footprint (None or object) – None if no dynamic footprint, otherwise truthy.

  • intensity_bin_peril_ids (np.array[int32]) – sorted unique encoded peril_ids (length n_perils).

  • intensity_bins (np.array[int32, 2d]) – shape (n_perils, max_intensity + 1) mapping [peril_idx, intensity_value] -> intensity_bin_id.

Returns:

True if all coverages have been processed, False if the buffer is full and

the caller should flush and call again.

Return type:

bool

oasislmf.pytools.gulmc.manager.process_areaperils_in_footprint(event_footprint, areaperil_id_ind, dynamic_footprint, ap_inds, event_rps, haz_arr_ptr)[source]

Process areaperils in the footprint, filtering to those with vulnerability functions.

Writes into pre-allocated arrays (ap_inds, event_rps, haz_arr_ptr) that are owned by the caller and reused across events.

The buffer stores the dense areaperil index (from areaperil_id_ind) rather than the raw areaperil_id, so downstream consumers (reconstruct_coverages) can index item_map_ja_offsets directly and skip a second id_index lookup.

Parameters:
  • event_footprint (np.array[Event or footprint_event_dtype]) – footprint entries.

  • areaperil_id_ind (np.array) – id_index structure for known areaperil_ids.

  • dynamic_footprint (bool) – true if there is dynamic_footprint.

  • ap_inds (np.array[uint32]) – pre-allocated output buffer for dense areaperil indices.

  • event_rps (np.array[int32]) – pre-allocated output buffer for return periods (dynamic only).

  • haz_arr_ptr (np.array[int64]) – pre-allocated output buffer for hazard pdf offsets.

Returns:

number of areaperils stored. If zero, no items have losses. haz_pdf (np.array[haz_arr_type]): hazard intensity pdf (freshly sliced).

Return type:

Nhaz_arr_this_event (int)

oasislmf.pytools.gulmc.manager.reconstruct_coverages(compute_info, ap_inds, Nhaz_arr_this_event, haz_arr_ptr, event_rps, item_map_ja_offsets, item_map_ja_vuln_ja_offsets, item_map_ja_vuln_ja_item_idxs, items, item_cdf_group_idx, coverages, compute, haz_seeds, haz_peril_correlation_groups, haz_corr_seeds, vuln_seeds, damage_peril_correlation_groups, damage_corr_seeds, dynamic_footprint, byte_mv, group_seq_rng_index, hazard_group_seq_rng_index)[source]

Register each item to its coverage and prepare per-item event data for loss computation.

For each (areaperil_id, vulnerability_id) pair present in the event footprint, iterates over all mapped items and:

  1. Computes deterministic hash-based random seeds for hazard and damage sampling, using group_id and hazard_group_id respectively. Seeds are deduplicated via pre-allocated arrays indexed by sequential group ids.

  2. Maps each item to its coverage structure, tracking the start offset and count.

  3. Stores per-item event data (haz_arr_i, rng_index, hazard_rng_index, eff_cdf_id) in the items_event_data array. The eff_cdf_id is the pre-computed CDF group index from item_cdf_group_idx.

Parameters:
  • compute_info (gulmc_compute_info_type) – computation state; coverage_i, coverage_n, and event_id fields are read/written.

  • ap_inds (np.array[uint32]) – dense areaperil indices present in the event footprint (from process_areaperils_in_footprint), length >= Nhaz_arr_this_event.

  • Nhaz_arr_this_event (int) – number of valid entries in ap_inds.

  • haz_arr_ptr (np.array[int64]) – per-areaperil offsets into the event hazard pdf; the number of hazard intensity bins for areaperil ap_i is haz_arr_ptr[ap_i+1] - haz_arr_ptr[ap_i]. A count of 1 means the hazard is deterministic and no hazard rng row is needed.

  • event_rps (np.array[int32]) – parallel array of return periods per areaperil (dynamic only).

  • item_map_ja_offsets (np.array[oasis_int]) – L1 CSR offsets (N_areaperil + 1).

  • item_map_ja_vuln_ja_offsets (np.array[oasis_int]) – L2 CSR offsets (N_pairs + 1).

  • item_map_ja_vuln_ja_item_idxs (np.array[oasis_int]) – flat item indices into items array.

  • items (np.ndarray) – items table merged with correlation parameters, containing group_id, hazard_group_id, coverage_id, group_seq_id, hazard_group_seq_id, etc.

  • item_cdf_group_idx (np.array[int64]) – pre-computed mapping from item_idx to CDF group index.

  • coverages (numpy.array[coverage_type]) – coverage data indexed by coverage_id.

  • compute (numpy.array[int]) – output buffer for the list of coverage_ids to be computed.

  • haz_seeds (numpy.array[int]) – output buffer for hazard intensity random seeds.

  • haz_peril_correlation_groups (numpy.array[int]) – unique peril correlation groups for hazard.

  • haz_corr_seeds (numpy.array[int]) – output buffer for hazard correlation seeds.

  • vuln_seeds (numpy.array[int]) – output buffer for damage random seeds.

  • damage_peril_correlation_groups (numpy.array[int]) – unique peril correlation groups for damage.

  • damage_corr_seeds (numpy.array[int]) – output buffer for damage correlation seeds.

  • dynamic_footprint (None or object) – None if no dynamic footprint, otherwise truthy.

  • byte_mv (numpy.array[byte]) – output byte buffer, may be resized if needed.

  • group_seq_rng_index (numpy.array[int64]) – pre-allocated array of size n_unique_groups, used for O(1) group_id to rng_index mapping (reset to NO_RNG_INDEX each event).

  • hazard_group_seq_rng_index (numpy.array[int64]) – pre-allocated array of size n_unique_haz_groups, for hazard_group_id to rng_index mapping.

Returns:

(items_event_data, rng_index, hazard_rng_index, byte_mv)
  • items_event_data (numpy.array[items_MC_data_type]): per-item data including item_idx, haz_arr_i, rng_index, hazard_rng_index, eff_cdf_id.

  • rng_index (int): number of unique damage random seeds generated.

  • hazard_rng_index (int): number of unique hazard random seeds generated. Only hazard groups touching a non-deterministic areaperil (and only under full Monte Carlo, not effective damageability) are counted, so this is 0 for events with no hazard uncertainty. Items not assigned a hazard rng row carry the NO_RNG_INDEX sentinel in items_event_data[‘hazard_rng_index’].

  • byte_mv (numpy.array[byte]): output buffer, possibly resized.

Return type:

tuple

oasislmf.pytools.gulmc.manager.kwargs[source]