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
a17a1c24
Commit
a17a1c24
authored
8 months ago
by
Marco Matthies
Browse files
Options
Downloads
Patches
Plain Diff
Add cropcover function, fix cropheight return value in case it isn't a farm plot
parent
9d43f793
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/crop/farmplot.jl
+12
-1
12 additions, 1 deletion
src/crop/farmplot.jl
with
12 additions
and
1 deletion
src/crop/farmplot.jl
+
12
−
1
View file @
a17a1c24
...
...
@@ -59,6 +59,17 @@ Return the height of the crop at this position, or nothing if there is no crop h
(utility wrapper).
"""
function
cropheight
(
pos
::
Tuple
{
Int64
,
Int64
},
model
::
SimulationModel
)
ismissing
(
model
.
landscape
[
pos
...
]
.
fieldid
)
?
nothing
:
ismissing
(
model
.
landscape
[
pos
...
]
.
fieldid
)
?
0.0
cm
:
# TODO: 0.0cm correct here?
cropheight
(
model
.
farmplots
[
model
.
landscape
[
pos
...
]
.
fieldid
])
end
"""
cropcover(model, position)
Return the crop cover of the crop at this position, or nothing if
there is no crop here (utility wrapper).
"""
function
cropcover
(
pos
::
Tuple
{
Int64
,
Int64
},
model
::
SimulationModel
)
ismissing
(
model
.
landscape
[
pos
...
]
.
fieldid
)
?
0.0
:
# TODO: 0.0 correct here?
cropcover
(
model
.
farmplots
[
model
.
landscape
[
pos
...
]
.
fieldid
])
end
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