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
a3ce5121
Commit
a3ce5121
authored
1 year ago
by
xo30xoqa
Browse files
Options
Downloads
Patches
Plain Diff
Renamed EventType to Management
parent
04b3efec
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/crop/farmplot.jl
+2
-2
2 additions, 2 deletions
src/crop/farmplot.jl
src/nature/insects.jl
+1
-1
1 addition, 1 deletion
src/nature/insects.jl
src/nature/species/skylark.jl
+10
-7
10 additions, 7 deletions
src/nature/species/skylark.jl
src/world/landscape.jl
+6
-6
6 additions, 6 deletions
src/world/landscape.jl
with
19 additions
and
16 deletions
src/crop/farmplot.jl
+
2
−
2
View file @
a3ce5121
...
...
@@ -22,7 +22,7 @@ mutable struct FarmPlot <: ModelAgent
LAItotal
::
Float64
LAIgreen
::
Float64
#biomass::Float64 #XXX I need to figure out how to calculate this
events
::
Vector
{
EventType
}
events
::
Vector
{
Management
}
end
"""
...
...
@@ -50,7 +50,7 @@ function initfields!(model::SimulationModel)
month
(
model
.
date
)
<
3
?
phase
=
janfirst
:
phase
=
marchfirst
fp
=
FarmPlot
(
length
(
model
.
farmplots
)
+
1
,
[(
x
,
y
)],
model
.
crops
[
"natural grass"
],
phase
,
0.0
,
0.0
,
0.0
,
0.0
,
Vector
{
EventType
}())
0.0
,
0.0
,
0.0
,
0.0
,
Vector
{
Management
}())
push!
(
model
.
farmplots
,
fp
)
model
.
landscape
[
x
,
y
]
.
fieldid
=
fp
.
id
convertid
[
rawid
]
=
fp
.
id
...
...
This diff is collapsed.
Click to expand it.
src/nature/insects.jl
+
1
−
1
View file @
a3ce5121
...
...
@@ -38,7 +38,7 @@ function insectbiomass(pixel::Pixel, model::SimulationModel)::Float64
## based on fig. 3a in Paquette et al. (2013)
if
"season"
in
@param
(
nature
.
insectmodel
)
calendarday
=
dayofyear
(
model
.
date
)
seasonfactor
=
-
0.085
(
calendarday
-
187
)
^
2
seasonfactor
=
(
-
0.085
(
calendarday
-
187
)
^
2
)
mg
/
m²
end
## habitat dependence of insect biomass,
...
...
This diff is collapsed.
Click to expand it.
src/nature/species/skylark.jl
+
10
−
7
View file @
a3ce5121
...
...
@@ -31,9 +31,9 @@ At the moment, this implementation is still in development.
"""
@species
Skylark
begin
# species parameters
const
eggtime
::
Int64
=
11
#
11
days from laying to hatching
const
nestlingtime
::
UnitRange
{
Int64
}
=
7
:
11
#
7-11
days from hatching to leaving nest
const
fledglingtime
::
UnitRange
{
Int64
}
=
25
:
30
#
25-30
days from hatching to independence
const
eggtime
::
Int64
=
11
# days from laying to hatching
const
nestlingtime
::
UnitRange
{
Int64
}
=
7
:
11
# days from hatching to leaving nest
const
fledglingtime
::
UnitRange
{
Int64
}
=
25
:
30
# days from hatching to independence
const
eggpredationmortality
::
Float64
=
0.03
# per-day egg mortality from predation
const
nestharvestmortality
::
Float64
=
0.9
# egg/nestling mortality after a harvest event (XXX guess)
...
...
@@ -45,8 +45,8 @@ At the moment, this implementation is still in development.
const
nestingbegin
::
Tuple
{
Int64
,
Int64
}
=
(
April
,
10
)
# begin nesting in the middle of April
const
nestbuildingtime
::
UnitRange
{
Int64
}
=
4
:
5
# 4-5 days needed to build a nest (doubled for first nest)
const
eggsperclutch
::
UnitRange
{
Int64
}
=
2
:
5
#
2-5
eggs laid per clutch
const
breedingdelay
::
Int64
=
18
#
wait 18
days after hatching
to
start a new brood
const
eggsperclutch
::
UnitRange
{
Int64
}
=
2
:
5
# eggs laid per clutch
const
breedingdelay
::
Int64
=
18
# days after hatching
before
start
ing
a new brood
const
nestingend
::
Int64
=
July
# last month of nesting
const
habitats
::
Function
=
skylarkhabitat
...
...
@@ -221,9 +221,12 @@ Do lots of foraging (not yet implemented).
# if all young have fledged, move to nonbreeding (if it's July) or breed again
if
isempty
(
self
.
clutch
)
self
.
nest
=
()
month
(
model
.
date
)
>=
self
.
nestingend
?
@setphase
(
nonbreeding
)
:
if
month
(
model
.
date
)
>=
self
.
nestingend
self
.
territory
=
[]
@setphase
(
nonbreeding
)
else
@setphase
(
nestbuilding
)
end
end
end
...
...
This diff is collapsed.
Click to expand it.
src/world/landscape.jl
+
6
−
6
View file @
a3ce5121
...
...
@@ -7,8 +7,8 @@
"The land cover classes encoded in the Mundialis Sentinel data."
@enum
LandCover
nodata
forest
grass
water
builtup
soil
agriculture
"The types of
l
an
dscape
event that can be simulated"
@enum
EventType
tillage
sowing
fertiliser
pesticide
harvesting
"The types of
m
an
agement
event that can be simulated"
@enum
Management
tillage
sowing
fertiliser
pesticide
harvesting
#XXX rename to Management or similar?
"""
...
...
@@ -21,7 +21,7 @@ in a single object. The model landscape consists of a matrix of pixels.
mutable struct
Pixel
landcover
::
LandCover
fieldid
::
Union
{
Missing
,
Int64
}
events
::
Vector
{
EventType
}
events
::
Vector
{
Management
}
animals
::
Vector
{
Int64
}
end
...
...
@@ -32,7 +32,7 @@ A data structure to define a landscape event, giving its type,
spatial extent, and duration.
"""
mutable struct
FarmEvent
etype
::
EventType
management
::
Management
pixels
::
Vector
{
Tuple
{
Int64
,
Int64
}}
duration
::
Int64
end
...
...
@@ -82,7 +82,7 @@ function updateevents!(model::SimulationModel)
if
event
.
duration
<=
0
push!
(
expiredevents
,
e
)
for
p
in
event
.
pixels
i
=
findnext
(
x
->
x
==
event
.
etype
,
model
.
landscape
[
p
...
]
.
events
,
1
)
i
=
findnext
(
x
->
x
==
event
.
management
,
model
.
landscape
[
p
...
]
.
events
,
1
)
deleteat!
(
model
.
landscape
[
p
...
]
.
events
,
i
)
end
end
...
...
@@ -96,7 +96,7 @@ end
Add a farm event to the specified pixels (a vector of position tuples) for a given duration.
"""
function
createevent!
(
model
::
SimulationModel
,
pixels
::
Vector
{
Tuple
{
Int64
,
Int64
}},
name
::
EventType
,
duration
::
Int64
=
1
)
name
::
Management
,
duration
::
Int64
=
1
)
push!
(
model
.
events
,
FarmEvent
(
name
,
pixels
,
duration
))
for
p
in
pixels
push!
(
model
.
landscape
[
p
...
]
.
events
,
name
)
...
...
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