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
f4c80402
Commit
f4c80402
authored
10 months ago
by
Marco Matthies
Browse files
Options
Downloads
Patches
Plain Diff
Add crop state init for AquaCrop
Currently errors with an error from inside AquaCrop.jl
parent
dbfad2f7
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
Project.toml
+1
-0
1 addition, 0 deletions
Project.toml
src/crop/aquacrop.jl
+13
-1
13 additions, 1 deletion
src/crop/aquacrop.jl
src/crop/cropmodels.jl
+1
-1
1 addition, 1 deletion
src/crop/cropmodels.jl
test/crop_tests.jl
+1
-1
1 addition, 1 deletion
test/crop_tests.jl
with
16 additions
and
3 deletions
Project.toml
+
1
−
0
View file @
f4c80402
...
@@ -4,6 +4,7 @@ authors = ["Daniel Vedder <daniel.vedder@idiv.de>"]
...
@@ -4,6 +4,7 @@ authors = ["Daniel Vedder <daniel.vedder@idiv.de>"]
version
=
"0.5.5"
version
=
"0.5.5"
[deps]
[deps]
AquaCrop
=
"8f16cebd-c0b4-44a3-857f-c101f083256c"
ArgParse
=
"c7e460c6-2fb9-53a9-8c5b-16f535851c63"
ArgParse
=
"c7e460c6-2fb9-53a9-8c5b-16f535851c63"
CSV
=
"336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
CSV
=
"336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
CairoMakie
=
"13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
CairoMakie
=
"13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
...
...
This diff is collapsed.
Click to expand it.
src/crop/aquacrop.jl
+
13
−
1
View file @
f4c80402
import
AquaCrop
struct
AquaCropType
struct
AquaCropType
name
::
String
name
::
String
group
::
String
group
::
String
...
@@ -9,7 +11,17 @@ cropname(ct::AquaCropType) = ct.name
...
@@ -9,7 +11,17 @@ cropname(ct::AquaCropType) = ct.name
mutable struct
AquaCropState
mutable struct
AquaCropState
croptype
::
AquaCropType
croptype
::
AquaCropType
height
::
Length
{
Float64
}
height
::
Length
{
Float64
}
# TODO: remove height field, supply from cropstate
cropstate
::
AquaCrop
.
AquaCropField
function
AquaCropState
(
croptype
::
AquaCropType
,
height
::
Length
{
Float64
}
=
0.0
cm
)
ac_parentdir
=
"./tmp-aquacrop-param"
# TODO
# TODO: runtype can be :Fortran, :Julia or :Persefone in the
# future, so then use :Persefone
ac_runtype
=
:
Julia
cropstate
=
AquaCrop
.
AquaCropField
(
ac_parentdir
,
ac_runtype
)
return
new
(
croptype
,
height
,
cropstate
)
end
end
end
croptype
(
cs
::
AquaCropState
)
=
cs
.
croptype
croptype
(
cs
::
AquaCropState
)
=
cs
.
croptype
...
...
This diff is collapsed.
Click to expand it.
src/crop/cropmodels.jl
+
1
−
1
View file @
f4c80402
...
@@ -82,7 +82,7 @@ function makecropstate(model::SimulationModel)
...
@@ -82,7 +82,7 @@ function makecropstate(model::SimulationModel)
0.0
m
0.0
m
)
)
elseif
@param
(
crop
.
cropmodel
)
==
"aquacrop"
elseif
@param
(
crop
.
cropmodel
)
==
"aquacrop"
cs
=
AquaCropState
(
model
.
crops
[
"natural grass"
],
0.0
m
)
cs
=
AquaCropState
(
model
.
crops
[
"natural grass"
],
0.0
c
m
)
else
else
Base
.
error
(
"Unhandled crop model '
$
(@param(crop.cropmodel))' in makecropstate()."
)
Base
.
error
(
"Unhandled crop model '
$
(@param(crop.cropmodel))' in makecropstate()."
)
end
end
...
...
This diff is collapsed.
Click to expand it.
test/crop_tests.jl
+
1
−
1
View file @
f4c80402
...
@@ -58,7 +58,7 @@ end
...
@@ -58,7 +58,7 @@ end
id
=
0
id
=
0
pixels
=
[(
0
,
0
)]
pixels
=
[(
0
,
0
)]
farmer
=
0
farmer
=
0
fp
=
FarmPlot
(
id
,
pixels
,
farmer
,
Ps
.
AquaCropState
(
ct
,
0.0
cm
))
fp
=
FarmPlot
(
id
,
pixels
,
farmer
,
Ps
.
AquaCropState
(
ct
))
@test
fp
isa
FarmPlot
@test
fp
isa
FarmPlot
@test
fp
isa
FarmPlot
{
Ps
.
AquaCropState
}
@test
fp
isa
FarmPlot
{
Ps
.
AquaCropState
}
@test
croptype
(
fp
)
isa
Ps
.
AquaCropType
@test
croptype
(
fp
)
isa
Ps
.
AquaCropType
...
...
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