A python library for generating input files for the CREAM economics analysis suite, using results from ReefModEngine.jl and sampling the intervention cost models using the cost_model_queries package.
Note: This package only works on Windows for now
Once the repository is cloned, simply run:
# Initialize project environment and install all dependencies
$ uv sync
# This should change the initial prompt to:
(cost-eco-model-linker) $Assuming the current directory is the project root:
# Add formatter and linter
(cost-eco-model-linker) $ uv sync --group lint
# Add dev packages
(cost-eco-model-linker) $ uv sync --group devIf working on integrating cost-eco-model-linker with another package:
# Add this package for development
$ uv pip install -e <path to cost-eco-model-linker repository>This project uses the Ruff python formatter.
For Visual Studio Code users, install the Ruff Python formatter extension.
If the uv environment has changed, sync all dependencies with:
$ uv syncimport cost_eco_model_linker as ceml
# Filepath to RME runs to process
rme_files_path = "./path_to_RME_outputs"
deployment_model = "./3.5.5 CA Deployment Model"
production_model = "./3.7.0 CA Production Model"
output_path = "./results"
# Number of sims for metrics sampling (default includes ecological and expert uncertainty
# in RCI calcs)
nsims = 10
ceml.evaluate(rme_files_path, nsims, deployment_model, production_model, output_path)
# Alternatively, run the analyses in parallel
nsims = 10
ncores = 4
if __name__ == "__main__":
ceml.parallel_evaluate(
rme_files_path,
nsims,
ncores,
deployment_model,
production_model,
output_path
)Two configuration files can be defined for the cost model sampling component of this repository.
The first configuration defines the names of output sub-directories.
In the quickstart example, note the call to:
ceml.evaluate(rme_files_path, nsims, deployment_model, production_model, output_path)The last argument, output_path, indicates where outputs of the analyses will be written
to. Three sub-directories will be created inside output_path, by default, these are:
cost_outputsecon_outputsintervention_keys_dir
These can be overridden by creating a .env file in the project root and specifying the
keys.
cost_dir="cost_outputs_changed"
econ_dir="econ_outputs_changed"
intervention_keys_dir="intervention_keys_changed"The second is bundled with the package (for now) and is located at src/config.csv.
It defines the names, types and positions of the cost model parameters in the spreadsheets.
Cost-eco-model-linker generates sampled economics metric files, including the:
- Reef Condition Index
- Reef Fishing Index and
- Reef Tourism Index
in a format suitable for input to CREAM.
The metrics are calculated from results generated by the ecological model ReefModEngine.jl.
Note that the implementation of the metrics are specific to ReefMod and ReefMod Engine.
Cost-eco-model-linker generates sampled cost output files for each of the interventions modelled in a set of ReefModEngine.jl results. Currently the latest version of the cost models that Cost-eco-model-linker is compatiable with are:
- Coral Aquaculture Deployment: "3.5.5 CA Deployment Model.xlsx"
- Coral Aquaculture Production: "3.7.0 CA Production Model.xlsx"
To get access to these models, contact Nick Dendle at QUT.
See the full docs for environment set up, examples, and descriptions of the cost and ecological modelling.
Generate API stubs:
uv run sphinx-apidoc -o docs/source/api cost_eco_model_linkerBuild docs (from repository root):
# Build static html files
uv run sphinx-build docs/source docs/build
# To launch web server that hot-reloads on change:
sphinx-autobuild docs/source docs/build/html