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
04b3efec
Commit
04b3efec
authored
10 months ago
by
xo30xoqa
Browse files
Options
Downloads
Patches
Plain Diff
Added units to insectbiomass()
parent
b5189ba0
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Persefone.jl
+2
-1
2 additions, 1 deletion
src/Persefone.jl
src/nature/insects.jl
+3
-3
3 additions, 3 deletions
src/nature/insects.jl
with
5 additions
and
4 deletions
src/Persefone.jl
+
2
−
1
View file @
04b3efec
...
@@ -100,12 +100,13 @@ export
...
@@ -100,12 +100,13 @@ export
loadmodelobject
loadmodelobject
## Import and define units and dimensions
## Import and define units and dimensions
import
Unitful
:
cm
,
m
,
km
,
ha
,
Length
,
Area
import
Unitful
:
cm
,
m
,
km
,
ha
,
mg
,
g
,
kg
,
Length
,
Area
,
Mass
const
m²
=
m
^
2
const
m²
=
m
^
2
const
km²
=
km
^
2
const
km²
=
km
^
2
import
Base
./
# enable division with different length/area unit types
import
Base
./
# enable division with different length/area unit types
/
(
x
::
S
,
y
::
T
)
where
{
S
<:
Length
,
T
<:
Length
}
=
(
upreferred
(
x
)
/
m
)
/
(
upreferred
(
y
)
/
m
)
/
(
x
::
S
,
y
::
T
)
where
{
S
<:
Length
,
T
<:
Length
}
=
(
upreferred
(
x
)
/
m
)
/
(
upreferred
(
y
)
/
m
)
/
(
x
::
S
,
y
::
T
)
where
{
S
<:
Area
,
T
<:
Area
}
=
(
upreferred
(
x
)
/
m²
)
/
(
upreferred
(
y
)
/
m²
)
/
(
x
::
S
,
y
::
T
)
where
{
S
<:
Area
,
T
<:
Area
}
=
(
upreferred
(
x
)
/
m²
)
/
(
upreferred
(
y
)
/
m²
)
/
(
x
::
S
,
y
::
T
)
where
{
S
<:
Mass
,
T
<:
Mass
}
=
(
upreferred
(
x
)
/
g
)
/
(
upreferred
(
y
)
/
g
)
"""
"""
SimulationModel
SimulationModel
...
...
This diff is collapsed.
Click to expand it.
src/nature/insects.jl
+
3
−
3
View file @
04b3efec
...
@@ -28,8 +28,8 @@ function insectbiomass(pixel::Pixel, model::SimulationModel)::Float64
...
@@ -28,8 +28,8 @@ function insectbiomass(pixel::Pixel, model::SimulationModel)::Float64
## if no factors are configured, insect abundance defaults to 300 mg/m²,
## if no factors are configured, insect abundance defaults to 300 mg/m²,
## a value in the upper range of insect biomass density in agricultural landscapes
## a value in the upper range of insect biomass density in agricultural landscapes
baseline
=
300
baseline
=
300
mg
/
m²
seasonfactor
=
0.0
seasonfactor
=
0.0
mg
/
m²
habitatfactor
=
1.0
habitatfactor
=
1.0
weatherfactor
=
1.0
weatherfactor
=
1.0
pesticidefactor
=
1.0
pesticidefactor
=
1.0
...
@@ -73,5 +73,5 @@ function insectbiomass(pixel::Pixel, model::SimulationModel)::Float64
...
@@ -73,5 +73,5 @@ function insectbiomass(pixel::Pixel, model::SimulationModel)::Float64
## calculate biomass using a parabolic equation in the vertex form
## calculate biomass using a parabolic equation in the vertex form
biomass
=
seasonfactor
+
baseline
*
habitatfactor
*
pesticidefactor
*
weatherfactor
biomass
=
seasonfactor
+
baseline
*
habitatfactor
*
pesticidefactor
*
weatherfactor
biomass
>
0
?
biomass
/
1000
:
0.0
# convert mg to g
biomass
>
0
mg
/
m²
?
biomass
|>
g
/
m²
:
0.0
g
/
m²
# convert mg to g
end
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