cost_eco_model_linker.parallel_cost_sampling¶
Attributes¶
Functions¶
|
Run economics metrics data creation files so that corresponding cost data can be sampled in parallel. |
|
When running multiple cores for cost sampling, metrics calculations are also broken into batches |
|
Save cost samples run in parallel in a single file which is in the correct format for the economics modelling. |
Module Contents¶
- cost_eco_model_linker.parallel_cost_sampling.THIS_DIR¶
- cost_eco_model_linker.parallel_cost_sampling.para_sample_econ(rme_files_path: str, nsims: int, stores: cost_eco_model_linker.setup_results.OutputStores, ncores=5, uncertainty_dict=None, metrics=None, max_dist=25.0)¶
Run economics metrics data creation files so that corresponding cost data can be sampled in parallel. Saves ID key files so that these are available for all cores while sampling cost models in parallel. Also saves scenario references so that parallel samples process the correct scenario sims.
- Parameters:
rme_files_path (string) – String giving the path to resultset folder.
nsims (int) – Number of simulations to sampling (including uncertainty types as specified)
stores (OutputStores) – Data class holding output file paths where economic metric files will be stored.
ncores (int) – Number of cores to sample cost models over.
uncertainty_dict (dict) – Contains information on what uncertainty types to sample.
max_dist (float) – Maximum distance between reefs within a “cluster”. Total distance to port is calculated as distance to port for closest reef cluster + distance between each additional further cluster where distance between clusters is calculated as distance between the reefs furthest from port in each cluster.
- cost_eco_model_linker.parallel_cost_sampling.post_process_metrics(stores: cost_eco_model_linker.setup_results.OutputStores, metric_filepaths: list[str], metrics: list, nsims: int)¶
When running multiple cores for cost sampling, metrics calculations are also broken into batches to avoid memory issues when creating large metrics datacubes (have shape nsims*nyears*nreefs)
Writes metric results NOT as a “large metrics datacubes” but as a flat CSV.
- Parameters:
stores (OutputStore) – Data class defining output directories
metric_filepaths (list{string}) – List of all filepaths where metrics are saved.
metrics (list{function}) – List of metric functions which were calculated.
nsims (int) – Total number of simulations runs
- Return type:
None
- cost_eco_model_linker.parallel_cost_sampling.post_process_costs(result, nsims)¶
Save cost samples run in parallel in a single file which is in the correct format for the economics modelling.
- Parameters:
result (list) – List of filenames for saved parallel cost data runs.
nsims (int) – Total number of draws to sample cost models, should match ecological metrics sampling.