Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Persefone.jl
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Persefone
Persefone.jl
Commits
de93a853
Commit
de93a853
authored
10 months ago
by
Marco Matthies
Browse files
Options
Downloads
Patches
Plain Diff
Fix ALMaSS.growcrop! to use daily growing-degree days and not total gdd
parent
c0d891c1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/crop/almass.jl
+16
-18
16 additions, 18 deletions
src/crop/almass.jl
with
16 additions
and
18 deletions
src/crop/almass.jl
+
16
−
18
View file @
de93a853
...
@@ -201,10 +201,10 @@ function stepagent!(cs::CropState, model::SimulationModel)
...
@@ -201,10 +201,10 @@ function stepagent!(cs::CropState, model::SimulationModel)
# (https://www.eea.europa.eu/publications/europes-changing-climate-hazards-1/heat-and-cold/heat-and-cold-2014-mean)
# (https://www.eea.europa.eu/publications/europes-changing-climate-hazards-1/heat-and-cold/heat-and-cold-2014-mean)
basetemp
=
cs
.
croptype
.
mingrowthtemp
basetemp
=
cs
.
croptype
.
mingrowthtemp
ismissing
(
basetemp
)
&&
(
basetemp
=
5.0
)
ismissing
(
basetemp
)
&&
(
basetemp
=
5.0
)
gdd
=
(
maxtemp
(
model
)
+
mintemp
(
model
))
/
2
-
basetemp
delta_gdd
=
bounds
(
(
maxtemp
(
model
)
+
mintemp
(
model
))
/
2
-
basetemp
)
gdd
>
0
&&
(
cs
.
growingdegreedays
+=
gdd
)
cs
.
growingdegreedays
+=
delta_
gdd
# update crop growth
# update crop growth
growcrop!
(
cs
,
gdd
,
model
)
growcrop!
(
cs
,
delta_
gdd
,
model
)
end
end
...
@@ -248,14 +248,18 @@ end
...
@@ -248,14 +248,18 @@ end
#TODO till!()
#TODO till!()
"""
"""
growcrop!(cropstate, gdd, model)
growcrop!(cropstate,
delta_
gdd, model)
Apply the relevant crop growth model to update the plants crop state
Update the crop state on this farm plot for a given daily change in
on this farm plot. Implements the ALMaSS crop growth model by Topping
growing-degree days `delta_gdd` (units of 'Kelvin Days').
et al. (see `ALMaSS/Landscape/plant.cpp:PlantGrowthData::FindDiff()` and
Implements the ALMaSS crop growth model by Topping et al. (see
`ALMaSS/Landscape/plant.cpp:PlantGrowthData::FindDiff()` and
`ALMaSS/Landscape/elements.cpp:VegElement::DoDevelopment()`).
`ALMaSS/Landscape/elements.cpp:VegElement::DoDevelopment()`).
"""
"""
function
growcrop!
(
cs
::
CropState
,
gdd
::
Float64
,
model
::
SimulationModel
)
function
growcrop!
(
cs
::
CropState
,
delta_gdd
::
Real
,
model
::
SimulationModel
)
total_gdd
=
cs
.
growingdegreedays
# TODO: logic the wrong way around for fertiliser?
fertiliser
in
cs
.
events
?
fertiliser
in
cs
.
events
?
curve
=
cs
.
croptype
.
lownutrientgrowth
:
curve
=
cs
.
croptype
.
lownutrientgrowth
:
curve
=
cs
.
croptype
.
highnutrientgrowth
curve
=
cs
.
croptype
.
highnutrientgrowth
...
@@ -270,17 +274,11 @@ function growcrop!(cs::CropState, gdd::Float64, model::SimulationModel)
...
@@ -270,17 +274,11 @@ function growcrop!(cs::CropState, gdd::Float64, model::SimulationModel)
cs
.
LAIgreen
=
curve
.
LAIgreen
[
cs
.
phase
][
p
]
cs
.
LAIgreen
=
curve
.
LAIgreen
[
cs
.
phase
][
p
]
return
return
else
else
gdd
=
cs
.
growingdegreedays
# figure out which is the correct slope value to use for growth
# figure out which is the correct slope value to use for growth
if
p
==
length
(
points
)
||
gdd
<
points
[
p
+
1
]
if
p
==
length
(
points
)
||
total_gdd
<
points
[
p
+
1
]
#FIXME it appears to me from the ALMaSS source code that the curve value
cs
.
height
+=
curve
.
height
[
cs
.
phase
][
p
]
*
delta_gdd
# for the day is multiplied with that day's growingdegreedays to give the
cs
.
LAItotal
+=
curve
.
LAItotal
[
cs
.
phase
][
p
]
*
delta_gdd
# diff, which is then added to the previous values. However, this results
cs
.
LAIgreen
+=
curve
.
LAIgreen
[
cs
.
phase
][
p
]
*
delta_gdd
# in values that are staggeringly too large. I'm not quite sure what the
# issue is here...
cs
.
height
+=
bounds
(
curve
.
height
[
cs
.
phase
][
p
]
*
gdd
)
cs
.
LAItotal
+=
bounds
(
curve
.
LAItotal
[
cs
.
phase
][
p
]
*
gdd
)
cs
.
LAIgreen
+=
bounds
(
curve
.
LAIgreen
[
cs
.
phase
][
p
]
*
gdd
)
return
return
end
end
#XXX To be precise, we ought to figure out if one or more inflection
#XXX To be precise, we ought to figure out if one or more inflection
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment