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
aa8f47e9
Commit
aa8f47e9
authored
8 months ago
by
Marco Matthies
Browse files
Options
Downloads
Patches
Plain Diff
Rename crop_state -> cropstate
parent
5561b648
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/farmplot.jl
+8
-8
8 additions, 8 deletions
src/crop/farmplot.jl
with
8 additions
and
8 deletions
src/crop/farmplot.jl
+
8
−
8
View file @
aa8f47e9
...
...
@@ -6,14 +6,14 @@
mutable struct
FarmPlot
{
T
}
<:
ModelAgent
const
id
::
Int64
pixels
::
Vector
{
Tuple
{
Int64
,
Int64
}}
crop
_
state
::
T
cropstate
::
T
end
croptype
(
f
::
FarmPlot
{
T
})
where
{
T
}
=
croptype
(
f
.
crop
_
state
)
croptype
(
f
::
FarmPlot
{
T
})
where
{
T
}
=
croptype
(
f
.
cropstate
)
cropname
(
f
::
FarmPlot
{
T
})
where
{
T
}
=
cropname
(
croptype
(
f
))
cropheight
(
f
::
FarmPlot
{
T
})
where
{
T
}
=
cropheight
(
f
.
crop
_
state
)
cropcover
(
f
::
FarmPlot
{
T
})
where
{
T
}
=
cropcover
(
f
.
crop
_
state
)
cropyield
(
f
::
FarmPlot
{
T
})
where
{
T
}
=
cropyield
(
f
.
crop
_
state
)
cropheight
(
f
::
FarmPlot
{
T
})
where
{
T
}
=
cropheight
(
f
.
cropstate
)
cropcover
(
f
::
FarmPlot
{
T
})
where
{
T
}
=
cropcover
(
f
.
cropstate
)
cropyield
(
f
::
FarmPlot
{
T
})
where
{
T
}
=
cropyield
(
f
.
cropstate
)
"""
stepagent!(farmplot, model)
...
...
@@ -21,7 +21,7 @@ cropyield(f::FarmPlot{T}) where {T} = cropyield(f.crop_state)
Update a farm plot by one day.
"""
function
stepagent!
(
farmplot
::
FarmPlot
{
T
},
model
::
SimulationModel
)
where
T
stepagent!
(
farmplot
.
crop
_
state
,
model
)
stepagent!
(
farmplot
.
cropstate
,
model
)
end
"""
...
...
@@ -32,7 +32,7 @@ Sow the specified crop on the farmplot.
function
sow!
(
farmplot
::
FarmPlot
,
model
::
SimulationModel
,
cropname
::
String
)
#XXX test if the crop is sowable?
createevent!
(
model
,
farmplot
.
pixels
,
sowing
)
sow!
(
farmplot
.
crop
_
state
,
model
,
cropname
)
sow!
(
farmplot
.
cropstate
,
model
,
cropname
)
end
"""
...
...
@@ -42,7 +42,7 @@ Harvest the crop of this farmplot.
"""
function
harvest!
(
farmplot
::
FarmPlot
{
T
},
model
::
SimulationModel
)
where
T
createevent!
(
model
,
farmplot
.
pixels
,
harvesting
)
harvest!
(
farmplot
.
crop
_
state
,
model
)
# TODO: multiply with area to return units of `g`
harvest!
(
farmplot
.
cropstate
,
model
)
# TODO: multiply with area to return units of `g`
end
## UTILITY FUNCTIONS
...
...
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