open-AIMS / ADRIA.jl

ADRIA: Adaptive Dynamic Reef Intervention Algorithms. A multi-criteria decision support platform for informing reef restoration and adaptation interventions.
MIT License
18 stars 6 forks source link

Standardize all the things #465

Open ConnectedSystems opened 1 year ago

ConnectedSystems commented 1 year ago

ADRIA expects a standard order of arguments for most of the basic usage functions

For example:

dom = ADRIA.load_domain("some domain")

scens = ADRIA.sample(dom, 128)

rs = ADRIA.load_results("some result set")
ADRIA.metrics.scenario_total_cover(rs)
ADRIA.metrics.scenario_relative_cover(rs)

Note that the domain (dom) or result set (rs) is expected as the first argument. Except in cases where it is not:

# domain is no longer the first argument!
ADRIA.run_scenarios(scens, dom, "45")

Inconsistent usage patterns like the above are micro-annoyances the user has to account for. ADRIA API/functions should be standardized to follow a single approach/pattern.

Later on, this standard approach could facilitate piping:

using ADRIA: sample, run_scenarios
using ADRIA.metrics: scenario_total_cover

coral_cover = sample(dom, 128) |> run_scenarios("45") |> scenario_total_cover

Names of metric names are also not standardized.

There is potential to remove all scenario-based metrics and instead apply a macro, e.g:

@scenario total_absolute_cover(rs)

On this subject, the identifiers "total" and "cover" never made much sense to me, particularly as we begin to consider other ecosystems (cover of what? total in what sense?)

The below make more sense and make for a more seamless set of function names:

Units for each could be standardized for conceptual alignment. Some use m^2, but are more readily communicated in km^2 or hectares for example.


On visualization:

ADRIA.viz.scenario(...)

Should in fact be ADRIA.viz.scenarios() as we are plotting a set of scenarios, not a singular trajectory.

There are other inconsistencies across the board.

These should all be addressed.

ConnectedSystems commented 1 year ago

Tasks: