Skip to content

Commit f484edc

Browse files
committed
Fix remaining use of Strings for scales (should be symbols now)
1 parent fc921df commit f484edc

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

docs/src/multiscale/multiscale_coupling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Conceptually :
6868

6969
```julia
7070
PlantSimEngine.dep(m::ParentModel) = (
71-
name_provided_in_the_mapping=AbstractHardDependencyModel => ["Organ_Name_1",],
71+
name_provided_in_the_mapping=AbstractHardDependencyModel => [:Organ_Name_1],
7272
)
7373
```
7474

docs/src/multiscale/multiscale_example_3.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ This hard dependency is in fact multiscale, since both models operate at differe
324324
Compared to the single-scale equivalent, the multi-scale declaration additionally requires mapping the scale:
325325

326326
```julia
327-
PlantSimEngine.dep(::ToyRootGrowthDecisionModel) = (root_growth=AbstractRoot_GrowthModel=>["Root"],)
327+
PlantSimEngine.dep(::ToyRootGrowthDecisionModel) = (root_growth=AbstractRoot_GrowthModel=>[:Root],)
328328
```
329329

330330
The `status` argument [`run!`](@ref) function of the root growth decision model only contains variables from the "Plant" scale, or explicitely mapped to this scale, which isn't the case for the root growth's variables. To make use of the root growth model's variables, we need to recover the [`status`](@ref) at the "Root" scale. It is accessible from the `extra` argument in [`run!`](@ref)'s signature.
@@ -362,7 +362,7 @@ PlantSimEngine.inputs_(::ToyRootGrowthDecisionModel) =
362362

363363
PlantSimEngine.outputs_(::ToyRootGrowthDecisionModel) = NamedTuple()
364364

365-
PlantSimEngine.dep(::ToyRootGrowthDecisionModel) = (root_growth=AbstractRoot_GrowthModel=>["Root"],)
365+
PlantSimEngine.dep(::ToyRootGrowthDecisionModel) = (root_growth=AbstractRoot_GrowthModel=>[:Root],)
366366

367367
# "status" is at the "Plant" scale
368368
function PlantSimEngine.run!(m::ToyRootGrowthDecisionModel, models, status, meteo, constants=nothing, extra=nothing)
@@ -500,4 +500,4 @@ We now have a plant with two different growth directions. Roots are added at the
500500

501501
Of course, there are still several design issues with this implementation. It is as utterly unrealistic as the previous one, and doesn't even consume water. Some condition checking is a little ad hoc and could be made more robust. More sanity checks could be added, and the model and variable names could definitely be made more clear.
502502

503-
But once again, this example is only made to illustrate what is possible with this framework, and doesn't strive for ecophysiological consistency. And the approach can be made increasingly more complex by refining models and simulation parameters, and feeding in new information about your plant, and ramp up to realistic, production-ready and predictive simulations.
503+
But once again, this example is only made to illustrate what is possible with this framework, and doesn't strive for ecophysiological consistency. And the approach can be made increasingly more complex by refining models and simulation parameters, and feeding in new information about your plant, and ramp up to realistic, production-ready and predictive simulations.

examples/ToyMultiScalePlantTutorial/ToyPlantSimulation3.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ PlantSimEngine.inputs_(::ToyRootGrowthDecisionModel) =
140140

141141
PlantSimEngine.outputs_(::ToyRootGrowthDecisionModel) = NamedTuple()
142142

143-
PlantSimEngine.dep(::ToyRootGrowthDecisionModel) = (root_growth=AbstractRoot_GrowthModel => ["Root"],)
143+
PlantSimEngine.dep(::ToyRootGrowthDecisionModel) = (root_growth=AbstractRoot_GrowthModel => [:Root],)
144144

145145
function PlantSimEngine.run!(m::ToyRootGrowthDecisionModel, models, status, meteo, constants=nothing, extra=nothing)
146146

@@ -248,4 +248,4 @@ outs = run!(mtg, mapping, meteo_day)
248248
mtg
249249

250250

251-
length(MultiScaleTreeGraph.traverse(mtg, x -> x, symbol=:Leaf))
251+
length(MultiScaleTreeGraph.traverse(mtg, x -> x, symbol=:Leaf))

test/test-corner-cases.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function PlantSimEngine.outputs_(::Msg3LvlScaleEchelle2Model)
9494
(e2=-Inf, f2=-Inf)
9595
end
9696

97-
PlantSimEngine.dep(::Msg3LvlScaleEchelle2Model) = (Msg3Lvl_echelle3=AbstractMsg3Lvl_Echelle3Model => ("E3",),)
97+
PlantSimEngine.dep(::Msg3LvlScaleEchelle2Model) = (Msg3Lvl_echelle3=AbstractMsg3Lvl_Echelle3Model => (:E3,),)
9898
function PlantSimEngine.run!(::Msg3LvlScaleEchelle2Model, models, status, meteo, constants=nothing, extra_args=nothing)
9999
status_E3 = extra_args.statuses["E3"][1]
100100
run!(extra_args.models["E3"].Msg3Lvl_echelle3, models, status_E3, meteo, constants)
@@ -116,7 +116,7 @@ function PlantSimEngine.outputs_(::Msg3LvlScaleEchelle1Model)
116116
(e1=-Inf, f1=-Inf)#, e3 = -Inf)
117117
end
118118

119-
PlantSimEngine.dep(::Msg3LvlScaleEchelle1Model) = (Msg3Lvl_echelle2=AbstractMsg3Lvl_Echelle2Model => ("E2",),)
119+
PlantSimEngine.dep(::Msg3LvlScaleEchelle1Model) = (Msg3Lvl_echelle2=AbstractMsg3Lvl_Echelle2Model => (:E2,),)
120120
function PlantSimEngine.run!(::Msg3LvlScaleEchelle1Model, models, status, meteo, constants=nothing, extra_args=nothing)
121121

122122
status_E2 = extra_args.statuses["E2"][1]
@@ -157,7 +157,7 @@ function PlantSimEngine.outputs_(::Msg3LvlScaleAvalModel)
157157
(g=-Inf,)
158158
end
159159

160-
PlantSimEngine.dep(::Msg3LvlScaleAvalModel) = (Msg3Lvl_aval2=AbstractMsg3Lvl_Aval2Model => ("E2",),)
160+
PlantSimEngine.dep(::Msg3LvlScaleAvalModel) = (Msg3Lvl_aval2=AbstractMsg3Lvl_Aval2Model => (:E2,),)
161161

162162
function PlantSimEngine.run!(::Msg3LvlScaleAvalModel, models, status, meteo, constants=nothing, extra_args=nothing)
163163

@@ -275,7 +275,7 @@ function PlantSimEngine.outputs_(::HardDepSameScaleEchelle1Model)
275275
(e1=-Inf, f1=-Inf)
276276
end
277277

278-
#PlantSimEngine.dep(::HardDepSameScaleEchelle1Model) = (hard_dep_same_scale_echelle3=AbstractHard_Dep_Same_Scale_Echelle3Model => ("E3",),)
278+
#PlantSimEngine.dep(::HardDepSameScaleEchelle1Model) = (hard_dep_same_scale_echelle3=AbstractHard_Dep_Same_Scale_Echelle3Model => (:E3,),)
279279

280280
# exta_args = sim_object
281281
function PlantSimEngine.run!(::HardDepSameScaleEchelle1Model, models, status, meteo, constants=nothing, sim_object=nothing)
@@ -299,7 +299,7 @@ function PlantSimEngine.outputs_(::HardDepSameScaleEchelle1bisModel)
299299
(e2=-Inf, f2=-Inf)
300300
end
301301

302-
PlantSimEngine.dep(::HardDepSameScaleEchelle1bisModel) = (hard_dep_same_scale_echelle3=AbstractHard_Dep_Same_Scale_Echelle3Model => ("E3",),)
302+
PlantSimEngine.dep(::HardDepSameScaleEchelle1bisModel) = (hard_dep_same_scale_echelle3=AbstractHard_Dep_Same_Scale_Echelle3Model => (:E3,),)
303303

304304
# exta_args = sim_object
305305
function PlantSimEngine.run!(::HardDepSameScaleEchelle1bisModel, models, status, meteo, constants=nothing, sim_object=nothing)
@@ -417,7 +417,7 @@ function PlantSimEngine.outputs_(::SingleModelScale3)
417417
(out=-Inf, out3=-Inf)
418418
end
419419

420-
PlantSimEngine.dep(::SingleModelScale1) = (single_model_multiple_scales=AbstractSingle_Model_Multiple_ScalesModel => ("E2bis", "E2"),)
420+
PlantSimEngine.dep(::SingleModelScale1) = (single_model_multiple_scales=AbstractSingle_Model_Multiple_ScalesModel => (:E2bis, :E2),)
421421

422422
# extra_args = sim_object
423423
function PlantSimEngine.run!(::SingleModelScale1, models, status, meteo, constants=nothing, sim_object=nothing)

0 commit comments

Comments
 (0)