Skip to content

Conversation

@Rosejoycrocker
Copy link
Collaborator

@Rosejoycrocker Rosejoycrocker commented Apr 8, 2025

Changes the way intervention scenarios are recorded so that variables needed for economics modelling, including number of corals outplanted per year, are saved.

Intervention scenarios are saved in a dataframecalled iv_yearly_scenarios.csv that records the intervention type, reefset deployment volume and year for each intervention year, replicate, coral outplants per m2 and deployment area in km2. Other key values previously saved in scenarios.csv, are now saved in scenario_info.json, which saves the counterfactual flag vector, dhw enhancement of each scenario, and the reefs in each reefset used.

Example iv_yearly_scenarios.csv:
Screenshot 2025-04-09 165054
Example scenario_info.json:
Screenshot 2025-04-09 165106

Should be divided by number of species to maintain the input total number of corals
Also density needs to be input as Ptr{Cint} not Vector{Cint}
Needs to be extracted as a vector in the current version of the RME (also add version checks)
Save as json to avoid vectors being converted to strings when saved as a dataframe
- Intervention scenarios as saved with intervention year, type, outplant/enrich volume, rep and reefset in a csv format
- Other info such as whether it is a counterfactual or intervention scenario, dhw adaptation levels and reefset names and reefs are saved in a json file
Add saving previously saved parameters including outplants per m2 and intervention area

Formatting

Add GCM name save
@Rosejoycrocker Rosejoycrocker force-pushed the add-save-num-outplants branch from 592bfe2 to 80de00c Compare April 10, 2025 01:01
"The way I calculate number of corals to be outplanted on the restored is to fix either outplanting density or proportion of reef to restore on. This is so you can compare different scenarios. Normally, I fix the outplanting density with deployment area being determined by the number of outplants.
For example, if I outplant 1M corals at 6.8 ind./m2 in 2035, then the area needed to outplant this number on the reef would be:
-	1,000,000 / 6.8 ind. Per m2=147058.8 m2
-	Transform to square km2= 147058.8 * 0.000001=0.14706 km2
Area needed to outplant 1M corals is (0.14706 / 0.835531) * 100 =17.6 % (0.835531 is reef area of reef “10-330” as example).

To now we have 6.8 ind/m2 (stocking density) and 17.6% (percentage of reef restored) as metrics that represent outplanting 1M corals at one given year

To set the parameterisation in the Engine, we need to divide the stocking density by 2 as outplanting occurs twice a year in the code/
-	6.8/2=3.4 ind/m2, so dens_season=3.4
-	Then we define what proportion of outplants is represented by which species following the function:

density_on_reef  = (density_in_deployment_area*proportion of outplanted represented by species X) * deployment_area_proportion

Let’s say we only outplant species 1 and 2, at 0.6 and 0.4 proportional representation, respectively. Then the count_per_m2 in function rme_iv_add will be

outplanting_count_per_m2 = [(dens_season*0.6).*(17.6/100), (dens_season*0.4).*(17.6100), (dens_season*0).*(17.6./100), (dens_season*0).*(17.6./100), (dens_season*0).*(17.6./100), (dens_season*0).*(17.6./100)

The parameterisation of the intervention then will be (example):
rme_iv_add('VR_outplant', 'outplant', 'All reefs', 2035,2035,1,17.6,outplanting_count_per_m2
"
Copy link
Collaborator

@ConnectedSystems ConnectedSystems left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Rosejoycrocker for this. Goes a long way to easily supporting intervention runs and subsequent assessment.

Generally things look okay to me, but two comments:

  1. I'm not 100% convinced JSON is the most appropriate format to use for the scenario info. Based on the screenshot, it kind of looks like a tabular format (or multidimensional format if needed, e.g., netCDF) with associated metadata would be better. I generally dislike outputting multiple different formats if there is not a very good reason. But I agree to accept it at this moment as I can see the benefit of being able to open the file up in a text editor. I may change this later though.

  2. The outputted CSV could indicate the units (e.g., number of corals? Is that millions? Can't be number of colonies as they're not whole numbers...)

As they're relatively minor and can be changed later, I'm merging this in now.

@ConnectedSystems ConnectedSystems merged commit 5ecdbc5 into main May 31, 2025
1 check passed
@ConnectedSystems ConnectedSystems deleted the add-save-num-outplants branch May 31, 2025 09:21
@Rosejoycrocker
Copy link
Collaborator Author

Thanks @Rosejoycrocker for this. Goes a long way to easily supporting intervention runs and subsequent assessment.

Generally things look okay to me, but two comments:

  1. I'm not 100% convinced JSON is the most appropriate format to use for the scenario info. Based on the screenshot, it kind of looks like a tabular format (or multidimensional format if needed, e.g., netCDF) with associated metadata would be better. I generally dislike outputting multiple different formats if there is not a very good reason. But I agree to accept it at this moment as I can see the benefit of being able to open the file up in a text editor. I may change this later though.
  2. The outputted CSV could indicate the units (e.g., number of corals? Is that millions? Can't be number of colonies as they're not whole numbers...)

As they're relatively minor and can be changed later, I'm merging this in now.

Hi Takuya,

Thanks for reviewing. I agree with your comments, I think it would be great to have all this info in a single csv. I was unsure how to do this without creating a CSV with a lot of repeated info (for example, to record all intervention reefs, you'd need to repeat year, intervention level etc for each intervention reef). It's also a bit awkward to do with preallocation, because you can only extract info for one intervention at a time, so you have to do an initial loop to get size info for the dataframe and then another to extract the data. Keen to discuss how this could be done in a neat way.

@ConnectedSystems ConnectedSystems mentioned this pull request Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants