oasislmf.pytools.gulmc.structure¶
Pre-compute and persist gulmc read-only data structures.
- Follows the same pattern as
oasislmf.pytools.fm.financial_structure: create_gulmc_structurebuilds all read-only numpy arrays once and saves them as.npyfiles.load_gulmc_structurememory-maps them vianp.load(mmap_mode='r'), allowing multiple gulmc processes to share physical memory pages through the OS page cache.
Attributes¶
Functions¶
|
Check whether pre-computed gulmc structures exist. |
|
Build all read-only gulmc data structures from input files. |
|
Build and save all read-only gulmc data structures as |
|
Load pre-computed gulmc structures via memory-mapped numpy files. |
Module Contents¶
- oasislmf.pytools.gulmc.structure.ARRAY_FILES = ['items', 'coverages', 'item_map_ja_areaperil_ids', 'item_map_ja_offsets',...[source]¶
- oasislmf.pytools.gulmc.structure.gulmc_structure_exists(run_dir)[source]¶
Check whether pre-computed gulmc structures exist.
- oasislmf.pytools.gulmc.structure.build_structures(run_dir, ignore_file_type, peril_filter, dynamic_footprint, model_df_engine)[source]¶
Build all read-only gulmc data structures from input files.
This extracts the preparation logic from
manager.run()into a standalone callable so that it can be invoked once (bycreate_gulmc_structure) rather than repeated in every parallel gulmc process.- Parameters:
run_dir (str) – path to the run directory.
ignore_file_type (set[str]) – file extensions to ignore when loading.
peril_filter (list) – list of perils to include (empty = all).
dynamic_footprint (bool) – whether to apply dynamic footprint logic.
model_df_engine (str) – engine for loading model dataframes.
- Returns:
mapping variable names to numpy arrays / scalars.
- Return type:
- oasislmf.pytools.gulmc.structure.create_gulmc_structure(run_dir, ignore_file_type, peril_filter, dynamic_footprint, model_df_engine)[source]¶
Build and save all read-only gulmc data structures as
.npyfiles.- Parameters:
run_dir (str) – path to the run directory.
ignore_file_type (set[str]) – file extensions to ignore when loading.
peril_filter (list) – list of perils to include (empty = all).
dynamic_footprint (bool) – whether to apply dynamic footprint logic.
model_df_engine (str) – engine for loading model dataframes.