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
f4e92a8e
Commit
f4e92a8e
authored
7 months ago
by
Marco Matthies
Browse files
Options
Downloads
Patches
Plain Diff
Cosmetics, no functional change
parent
246e1a5c
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
+52
-53
52 additions, 53 deletions
src/crop/almass.jl
with
52 additions
and
53 deletions
src/crop/almass.jl
+
52
−
53
View file @
f4e92a8e
...
...
@@ -36,59 +36,6 @@ import Persefone:
using
Dates
:
Date
,
month
,
monthday
using
CSV
:
CSV
"Temperature to solar conversion factor for C3 plants."
const
temperature_to_solar_conversion_c3
::
Vector
{
Float64
}
=
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
# -30°C to -21°C
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
# -20°C to -11°C
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
# -10°C to -1°C
0
,
0
,
0
,
0
,
0
,
0.28
,
0.56
,
0.84
,
1.12
,
1.4
,
# 0°C to 9°C
1.4
,
1.4
,
1.4
,
1.4
,
1.4
,
1.4
,
1.4
,
1.4
,
1.4
,
1.4
,
# 10°C to 19°C
1.4
,
1.4
,
1.4
,
1.4
,
1.4
,
1.4
,
1.26
,
1.12
,
0.98
,
0.84
,
# 20°C to 29°C
0.7
,
0.56
,
0.42
,
0.28
,
0.14
,
0
,
0
,
0
,
0
,
0
,
# 30°C to 39°C
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
# 40°C to 49°C
0
# 50°C
]
"Temperature to solar conversion factor for C4 plants."
const
temperature_to_solar_conversion_c4
::
Vector
{
Float64
}
=
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
# -30°C to -21°C
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
# -20°C to -11°C
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
# 0°C to 9°C
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0.242857
,
0.485714
,
# 10°C to 19°C
0.728571
,
0.971429
,
1.214286
,
1.457143
,
1.7
,
1.7
,
1.7
,
1.7
,
1.7
,
1.7
,
# 20°C to 29°C
1.7
,
1.7
,
1.7
,
1.7
,
1.7
,
1.7
,
1.7
,
1.7
,
1.7
,
1.7
,
# 30°C to 39°C
1.7
,
1.7
,
1.7
,
1.7
,
1.7
,
1.7
,
1.53
,
1.36
,
1.19
,
1.02
,
# 40°C to 49°C
0.85
,
0.68
,
0.51
,
0.34
,
0.17
,
0
,
0
,
0
,
0
,
0
,
# 50°C
0
]
"""
solar_conversion_c3(temperature)
Solar conversion factor (no units) for C3 plants.
"""
function
solar_conversion_c3
(
temperature
)
if
temperature
<
-
30
||
temperature
>
50
return
0.0
end
idx
=
Int
(
floor
(
0.5
+
temperature
))
+
30
+
1
return
temperature_to_solar_conversion_c3
[
idx
]
end
"""
solar_conversion_c3(temperature)
Solar conversion factor (no units) for C4 plants.
"""
function
solar_conversion_c4
(
temperature
)
if
temperature
<
-
30
||
temperature
>
50
return
0.0
end
idx
=
Int
(
floor
(
0.5
+
temperature
))
+
30
+
1
return
temperature_to_solar_conversion_c4
[
idx
]
end
"""
GrowthPhase
...
...
@@ -183,6 +130,58 @@ cropcover(cs::CropState) = 0.0 # TODO: related to LAItotal, LAIgreen?
cropyield
(
cs
::
CropState
)
=
0.0
# TODO: units? needs biomass?
isharvestable
(
cs
::
CropState
)
=
cs
.
mature
"Temperature to solar conversion factor for C3 plants."
const
temperature_to_solar_conversion_c3
::
Vector
{
Float64
}
=
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
# -30°C to -21°C
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
# -20°C to -11°C
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
# -10°C to -1°C
0
,
0
,
0
,
0
,
0
,
0.28
,
0.56
,
0.84
,
1.12
,
1.4
,
# 0°C to 9°C
1.4
,
1.4
,
1.4
,
1.4
,
1.4
,
1.4
,
1.4
,
1.4
,
1.4
,
1.4
,
# 10°C to 19°C
1.4
,
1.4
,
1.4
,
1.4
,
1.4
,
1.4
,
1.26
,
1.12
,
0.98
,
0.84
,
# 20°C to 29°C
0.7
,
0.56
,
0.42
,
0.28
,
0.14
,
0
,
0
,
0
,
0
,
0
,
# 30°C to 39°C
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
# 40°C to 49°C
0
# 50°C
]
"Temperature to solar conversion factor for C4 plants."
const
temperature_to_solar_conversion_c4
::
Vector
{
Float64
}
=
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
# -30°C to -21°C
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
# -20°C to -11°C
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
# 0°C to 9°C
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0.242857
,
0.485714
,
# 10°C to 19°C
0.728571
,
0.971429
,
1.214286
,
1.457143
,
1.7
,
1.7
,
1.7
,
1.7
,
1.7
,
1.7
,
# 20°C to 29°C
1.7
,
1.7
,
1.7
,
1.7
,
1.7
,
1.7
,
1.7
,
1.7
,
1.7
,
1.7
,
# 30°C to 39°C
1.7
,
1.7
,
1.7
,
1.7
,
1.7
,
1.7
,
1.53
,
1.36
,
1.19
,
1.02
,
# 40°C to 49°C
0.85
,
0.68
,
0.51
,
0.34
,
0.17
,
0
,
0
,
0
,
0
,
0
,
# 50°C
0
]
"""
solar_conversion_c3(temperature)
Solar conversion factor (no units) for C3 plants.
"""
function
solar_conversion_c3
(
temperature
)
if
temperature
<
-
30
||
temperature
>
50
return
0.0
end
idx
=
Int
(
floor
(
0.5
+
temperature
))
+
30
+
1
return
temperature_to_solar_conversion_c3
[
idx
]
end
"""
solar_conversion_c3(temperature)
Solar conversion factor (no units) for C4 plants.
"""
function
solar_conversion_c4
(
temperature
)
if
temperature
<
-
30
||
temperature
>
50
return
0.0
end
idx
=
Int
(
floor
(
0.5
+
temperature
))
+
30
+
1
return
temperature_to_solar_conversion_c4
[
idx
]
end
"""
Base.tryparse(type, str)
...
...
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