|
127 | 127 | end |
128 | 128 |
|
129 | 129 | @testset "Status initialisation" begin |
130 | | - @test_throws "Variable `carbon_biomass` is not computed by any model, not initialised by the user in the status, and not found in the MTG at scale Internode (checked for MTG node 4)." PlantSimEngine.init_statuses(mtg, mapping_1) |
131 | | - organs_statuses, others = PlantSimEngine.init_statuses(mtg_init, mapping_1) |
| 130 | + # Samuel : internal function, suppressing REPL display errors |
| 131 | + hard_dep_graph = first(PlantSimEngine.hard_dependencies(mapping_1; verbose=false)); |
| 132 | + @test_throws "Variable `carbon_biomass` is not computed by any model, not initialised by the user in the status, and not found in the MTG at scale Internode (checked for MTG node 4)." PlantSimEngine.init_statuses(mtg, mapping_1, hard_dep_graph) |
| 133 | + organs_statuses, others = PlantSimEngine.init_statuses(mtg_init, mapping_1, hard_dep_graph) |
132 | 134 |
|
133 | 135 | @test collect(keys(organs_statuses)) == ["Soil", "Internode", "Plant", "Leaf"] |
134 | 136 | # Check that the soil_water_content is linked between the soil and the leaves: |
|
148 | 150 | @test organs_statuses["Leaf"][1][:carbon_demand] == -Inf |
149 | 151 |
|
150 | 152 | # Testing with a different type: |
151 | | - organs_statuses, others = PlantSimEngine.init_statuses(mtg_init, mapping_1, type_promotion=Dict(Float64 => Float32, Vector{Float64} => Vector{Float32})) |
| 153 | + organs_statuses, others = PlantSimEngine.init_statuses(mtg_init, mapping_1, hard_dep_graph, type_promotion=Dict(Float64 => Float32, Vector{Float64} => Vector{Float32})) |
152 | 154 |
|
153 | 155 | @test isa(organs_statuses["Plant"][1][:carbon_assimilation], PlantSimEngine.RefVector{Float32}) |
154 | 156 | @test isa(organs_statuses["Plant"][1][:carbon_allocation], PlantSimEngine.RefVector{Float32}) |
|
168 | 170 | type_promotion = nothing |
169 | 171 | nsteps = 2 |
170 | 172 | dependency_graph = dep(mapping_1) |
171 | | - organs_statuses, others = PlantSimEngine.init_statuses(mtg_init, mapping_1, first(PlantSimEngine.hard_dependencies(mapping_1; verbose=false)); type_promotion=type_promotion) |
| 173 | + hard_dep_graph = first(PlantSimEngine.hard_dependencies(mapping_1; verbose=false)) |
| 174 | + organs_statuses, others = PlantSimEngine.init_statuses(mtg_init, mapping_1, hard_dep_graph; type_promotion=type_promotion) |
172 | 175 |
|
173 | 176 | @test collect(keys(organs_statuses)) == ["Soil", "Internode", "Plant", "Leaf"] |
174 | 177 | @test collect(keys(organs_statuses["Soil"][1])) == [:node, :soil_water_content] |
|
194 | 197 | @test PlantSimEngine.to_initialize(mapping_1, mtg) == Dict("Internode" => [:carbon_biomass], "Leaf" => [:carbon_biomass]) |
195 | 198 | @test PlantSimEngine.to_initialize(mapping_1, mtg_init) == Dict{String,Symbol}() |
196 | 199 |
|
197 | | - statuses, status_templates, reverse_multiscale_mapping, vars_need_init = PlantSimEngine.init_statuses(mtg_init, mapping_1) |
| 200 | + statuses, status_templates, reverse_multiscale_mapping, vars_need_init = PlantSimEngine.init_statuses(mtg_init, mapping_1, hard_dep_graph) |
198 | 201 | @test collect(keys(statuses)) == ["Soil", "Internode", "Plant", "Leaf"] |
199 | 202 |
|
200 | 203 | @test length(statuses["Internode"]) == length(statuses["Leaf"]) == 2 |
|
0 commit comments