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
892abe23
Commit
892abe23
authored
8 months ago
by
Marco Matthies
Browse files
Options
Downloads
Patches
Plain Diff
Try to better set maturity for maize (and other late crops)
parent
ffe37c33
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
-5
16 additions, 5 deletions
src/crop/almass.jl
with
16 additions
and
5 deletions
src/crop/almass.jl
+
16
−
5
View file @
892abe23
...
...
@@ -67,7 +67,6 @@ function Base.show(io::IO, ::MIME"text/plain", curve::CropCurveParams)
(
curve
.
GDD
,
"GDD"
),
(
curve
.
LAItotal
,
"LAItotal"
),
(
curve
.
LAIgreen
,
"LAIgreen"
),
# (curve.height, "height"),
]
println
(
"
$
name:"
)
for
(
phase
,
arr
)
in
dict
...
...
@@ -333,8 +332,9 @@ function growcrop!(cs::CropState, delta_gdd::Real, model::SimulationModel)
error
(
"Missing curve"
)
end
points
=
curve
.
GDD
[
cs
.
phase
]
if
length
(
points
)
==
1
&&
points
[
1
]
==
99999.0
!
(
cs
.
phase
in
(
janfirst
,
sow
))
&&
(
cs
.
mature
=
true
)
#FIXME only in the last phase?
!
(
cs
.
phase
in
(
janfirst
,
sow
))
&&
(
cs
.
mature
=
true
)
#
FIXME only in the last phase?
return
# the marker that there is no further growth this phase
end
...
...
@@ -344,14 +344,25 @@ function growcrop!(cs::CropState, delta_gdd::Real, model::SimulationModel)
idx
=
findfirst
(
x
->
x
>
total_gdd
,
points
)
if
isnothing
(
idx
)
idx
=
lastindex
(
points
)
#
elseif idx != firstindex(points)
#
idx -= 1 # we need the last index that is
not >
total_gdd
elseif
idx
!=
firstindex
(
points
)
idx
-=
1
# we need the last index that is
smaller than
total_gdd
end
cs
.
height
+=
curve
.
height
[
cs
.
phase
][
idx
]
*
delta_gdd
cs
.
LAItotal
+=
curve
.
LAItotal
[
cs
.
phase
][
idx
]
*
delta_gdd
cs
.
LAIgreen
+=
curve
.
LAIgreen
[
cs
.
phase
][
idx
]
*
delta_gdd
#if cs.phase == janfirst && length(points
function
lastphase
(
cs
::
CropState
)
if
cs
.
croptype
.
name
==
"maize"
return
sow
else
return
marchfirst
end
end
# set mature if it's the last growth point of the last phase
if
idx
==
lastindex
(
points
)
&&
cs
.
phase
==
lastphase
(
cs
)
cs
.
mature
=
true
end
end
end
# module ALMaSS
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