Open sjdaines opened 2 years ago
another attempt at an example syntax (see eg https://github.com/ordovician/QtUIParser.jl/blob/master/examples/color-selector.jl for inspiration):
function create_model(external_parameters)
model = Model(
parameters = external_parameters,
domains = [
:ocean => Domain(
reactions = [
"reservoir_A" => ReactionReservoir(
parameters = [
:isotope_type=>PB.IsotopeLinear,
],
variable_links = [
"R*"=>"A*",
],
variable_attributes = [
("R", :initial_value) => 32.0,
],
),
], # reactions
), # Domain
], # domains
) # model
return model
end
NB: this will need a macro to write Reaction constructors, see eg https://discourse.julialang.org/t/writing-this-inner-constructor-with-a-macro/62945
Overall goal is to make use of PALEO follow best practices in the Julia ecosystem (see eg https://discourse.julialang.org/t/julia-stats-data-ml-expanding-usability/67948 https://docs.google.com/presentation/d/1deIp582Ommw2wQtI1EQaR3lNy8LSLOA2c0FYjKKR-Bo/edit#slide=id.p1 )
This could be straightforward: really just need to define some add methods, with careful attention to syntax to produce code that reads like a config file, eg: