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
2ee7e39f
Commit
2ee7e39f
authored
3 months ago
by
Marco Matthies
Browse files
Options
Downloads
Patches
Plain Diff
Remove old height var
parent
2ccb7dc5
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/aquacrop.jl
+4
-10
4 additions, 10 deletions
src/crop/aquacrop.jl
with
4 additions
and
10 deletions
src/crop/aquacrop.jl
+
4
−
10
View file @
2ee7e39f
...
@@ -35,9 +35,6 @@ import Persefone:
...
@@ -35,9 +35,6 @@ import Persefone:
using
Unitful
:
@u_str
using
Unitful
:
@u_str
# We can't use Length{Float64} as that is a Union type
const
Tlength
=
typeof
(
1.0
cm
)
# TODO: read crop names directly from AquaCrop.jl
# TODO: read crop names directly from AquaCrop.jl
# names extracted by running this command in the AquaCrop.jl src dir:
# names extracted by running this command in the AquaCrop.jl src dir:
# grep -nir 'crop_type ==' src/ | cut -d '=' -f 3 | sed 's/$/,/' | sort | uniq
# grep -nir 'crop_type ==' src/ | cut -d '=' -f 3 | sed 's/$/,/' | sort | uniq
...
@@ -172,20 +169,18 @@ end
...
@@ -172,20 +169,18 @@ end
mutable struct
CropState
<:
AbstractCropState
mutable struct
CropState
<:
AbstractCropState
croptype
::
CropType
croptype
::
CropType
height
::
Tlength
# TODO: remove height field, supply from cropstate
soiltype
::
SoilType
soiltype
::
SoilType
cropstate
::
AquaCrop
.
AquaCropField
cropstate
::
AquaCrop
.
AquaCropField
function
CropState
(
croptype
::
CropType
,
model
::
SimulationModel
,
CropState
(
croptype
::
CropType
,
model
::
SimulationModel
,
soiltype
::
SoilType
)
=
soiltype
::
SoilType
,
height
::
Tlength
=
0.0
cm
)
new
(
croptype
,
soiltype
,
make_aquacrop_cropfield
(
croptype
,
model
,
soiltype
))
aquacrop_cropfield
=
make_aquacrop_cropfield
(
croptype
,
model
,
soiltype
)
return
new
(
croptype
,
height
,
soiltype
,
aquacrop_cropfield
)
end
end
end
croptype
(
cs
::
CropState
)
=
cs
.
croptype
croptype
(
cs
::
CropState
)
=
cs
.
croptype
cropname
(
cs
::
CropState
)
=
cropname
(
croptype
(
cs
))
cropname
(
cs
::
CropState
)
=
cropname
(
croptype
(
cs
))
function
cropheight
(
cs
::
CropState
)
function
cropheight
(
cs
::
CropState
)
# AquaCrop does not explicitly model crop height, so we have to
# estimate crop height from biomass
biomass
=
get_aquacrop_biomass
(
cs
)
biomass
=
get_aquacrop_biomass
(
cs
)
# TODO: linear model, fixed params
# TODO: linear model, fixed params
a
=
2
cm
a
=
2
cm
...
@@ -241,7 +236,6 @@ function sow!(cs::CropState, model::SimulationModel, cropname::String)
...
@@ -241,7 +236,6 @@ function sow!(cs::CropState, model::SimulationModel, cropname::String)
end
end
cs
.
croptype
=
new_croptype
cs
.
croptype
=
new_croptype
cs
.
height
=
0.0
cm
# cs.soiltype stays the way it is
# cs.soiltype stays the way it is
cs
.
cropstate
=
make_aquacrop_cropfield
(
cs
.
croptype
,
model
,
soiltype
)
cs
.
cropstate
=
make_aquacrop_cropfield
(
cs
.
croptype
,
model
,
soiltype
)
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