cost_eco_model_linker.process_RME_data

Attributes

Functions

load_reef_data()

Loads key reef spatial data.

load_regions_data(economics_spatial_filepath)

Loads key economics spatial data.

load_result_files(rme_files_path)

Loads results files generated from running scenarios in ReefModEngine.jl.

create_base_economics_dataframe(regions_data, ...)

Creates base structure for metrics summary files input to economics modelling.

area_weighted_rti(metrics_dict, metrics_df)

Processes metrics dict into continuous reef condition weighted by reef area.

rci(metrics_dict, metrics_df[, rci_threshold])

Processes metrics dict into area at threshold RCI and above.

coral_area_saved(metrics_dict, metrics_df)

Processes metrics dict into total area of coral cover in hectares.

rfi(metrics_dict, metrics_df[, rfi_thresholds])

Processes metrics dict into area at threshold RFI and above.

raw_rci(metrics_dict, metrics_df)

Processes metrics dict into raw RCI for table storage.

raw_rti(metrics_dict, metrics_df)

Processes metrics dict into raw RTI for table storage.

create_economics_metric_files(→ tuple[str, list[str]])

Main function for creating metric file summaries for input to economics modelling.

Module Contents

cost_eco_model_linker.process_RME_data.THIS_DIR
cost_eco_model_linker.process_RME_data.load_reef_data()

Loads key reef spatial data.

cost_eco_model_linker.process_RME_data.load_regions_data(economics_spatial_filepath: str)

Loads key economics spatial data.

Parameters:

economics_spatial_filepath (string) – String giving the path to economics spatial data.

Returns:

regions_data

Return type:

dataframe

cost_eco_model_linker.process_RME_data.load_result_files(rme_files_path: str)

Loads results files generated from running scenarios in ReefModEngine.jl.

Parameters:

rme_files_path (string) – String giving the path to resultset folder.

Returns:

  • results_data (dict) – Dict containing numpy arrays of results data from running ReefModEngine.jl.

  • scens_df (dataframe) – Describes scenario parameters year-by-year, including rep, year and intervention levels.

  • iv_dict (dict) – Contains other key scenario info, such as whether the scenario is counterfactual or intervention.

cost_eco_model_linker.process_RME_data.create_base_economics_dataframe(regions_data: pandas.DataFrame, reef_spatial_data: pandas.DataFrame, years: list)

Creates base structure for metrics summary files input to economics modelling.

Parameters:
  • regions_data (dataframe) – A dataframe with key spatial and economics data for each reef in the GBR (loaded from econ_spatial.csv).

  • reef_spatial_data (dataframe) – A dataframe from the RME specified key reef IDs and spatial information (loaded from reefmod_gbr.gpkg).

  • years (list) – Years to be included in the economics output file from the ecological modelling.

Returns:

data_store – Basic economics file structure to save for each intervention/counterfactual scenario.

Return type:

dataframe

cost_eco_model_linker.process_RME_data.area_weighted_rti(metrics_dict: dict, metrics_df: pandas.DataFrame)

Processes metrics dict into continuous reef condition weighted by reef area.

Parameters:
  • metrics_dict (dict) – Dict containing key sampled metrics and the RCI

  • metrics_df (dataframe) – Dataframe containing scenario summary dataframe

cost_eco_model_linker.process_RME_data.rci(metrics_dict: dict, metrics_df: pandas.DataFrame, rci_threshold=0.6)

Processes metrics dict into area at threshold RCI and above.

Parameters:
  • metrics_dict (dict) – Dict containing key sampled metrics and the RCI

  • metrics_df (dataframe) – Dataframe containing scenario summary dataframe

  • rci_threshold (float) – RCI threshold (in (0.0, 1.0)) above which to calculate area saved for.

cost_eco_model_linker.process_RME_data.coral_area_saved(metrics_dict: dict, metrics_df: pandas.DataFrame)

Processes metrics dict into total area of coral cover in hectares.

Parameters:
  • metrics_dict (dict) – Dict containing key sampled metrics and the RCI

  • metrics_df (dataframe) – Dataframe containing scenario summary dataframe

cost_eco_model_linker.process_RME_data.rfi(metrics_dict: dict, metrics_df: pandas.DataFrame, rfi_thresholds=[0.74, 29.91])

Processes metrics dict into area at threshold RFI and above. Minimum fish biomass is 0.74 kg km2. This was the minimum observation in the Graham and Nash, 2012 dataset. Similarly, max fish biomass is 29.91kg km2.

Parameters:
  • metrics_dict (dict) – Dict containing key sampled metrics and the RFI

  • metrics_df (dataframe) – Dataframe containing scenario summary dataframe

  • rfi_thresholds (float) – RFI thresholds (min and max fish biomass)

cost_eco_model_linker.process_RME_data.raw_rci(metrics_dict: dict, metrics_df: pandas.DataFrame)

Processes metrics dict into raw RCI for table storage.

Parameters:
  • metrics_dict (dict) – Array containing key sampled metrics and the RCI

  • metrics_df (dataframe) – Dataframe containing scenario summary dataframe

cost_eco_model_linker.process_RME_data.raw_rti(metrics_dict: dict, metrics_df: pandas.DataFrame)

Processes metrics dict into raw RTI for table storage.

Parameters:
  • metrics_dict (dict) – Array containing key sampled metrics and the RTI

  • metrics_df (dataframe) – Dataframe containing scenario summary dataframe

cost_eco_model_linker.process_RME_data.create_economics_metric_files(rme_files_path: str, nsims: int, stores, nbatches=None, uncertainty_dict: dict = None, ncores: int = 1, metrics=None, max_dist=25.0, economics_spatial_filepath=None) tuple[str, list[str]]

Main function for creating metric file summaries for input to economics modelling.

Parameters:
  • rme_files_path (str) – Path to resultset folder.

  • nsims (int) – Number of simulations to sample (including uncertainty types as specified).

  • stores (object) – Storage paths object with econ_dir and intervention_keys_dir attributes.

  • nbatches (int, optional) – Number of batches. If None, defaults to nsims (single batch).

  • uncertainty_dict (dict, optional) – Information on uncertainty types to sample.

  • ncores (int, default=1) – Number of cores for output file generation.

  • metrics (list, optional) – List of metric functions to calculate. Defaults to [rci, raw_rti, rfi].

  • max_dist (float, default=25.0) – Maximum distance (NM) between reefs within a cluster for distance calculations.

  • economics_spatial_filepath (str, optional) – Path to economics spatial data (econ_spatial.csv).

Returns:

  • run_id (str) – Base filename identifier for this run.

  • metric_filepaths (list) – List of generated metric file paths for each intervention.