FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
CRootBox/python/example3b.py at master · Plant-Root-Soil-Interactions-Modelling/CRootBox · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
Plant-Root-Soil-Interactions-Modelling
/
CRootBox
Public
Notifications
You must be signed in to change notification settings
Fork
12
Star
20
Code
Issues
3
Pull requests
3
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
CRootBox
/
python
/
example3b.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
62 lines (52 loc) · 1.75 KB
Breadcrumbs
CRootBox
/
python
/
example3b.py
Copy path
File metadata and controls
62 lines (52 loc) · 1.75 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"""analysis of results using signed distance functions"""
import
py_rootbox
as
rb
import
numpy
as
np
import
matplotlib
.
pyplot
as
plt
rs
=
rb
.
RootSystem
()
name
=
"Brassica_oleracea_Vansteenkiste_2014"
rs
.
readParameters
(
"modelparameter/"
+
name
+
".xml"
)
rs
.
initialize
()
rs
.
simulate
(
120
)
# Soil core analysis
r
,
depth
,
layers
=
10
,
100.
,
100
soilcolumn
=
rb
.
SDF_PlantContainer
(
r
,
r
,
depth
,
False
)
# in the center of the root
soilcolumn2
=
rb
.
SDF_RotateTranslate
(
soilcolumn
,
0
,
0
,
rb
.
Vector3d
(
10
,
0
,
0
))
# shift 10 cm
# pick one geometry for further analysis
geom
=
soilcolumn
z_
=
np
.
linspace
(
0
,
-
1
*
depth
,
layers
)
fig
,
axes
=
plt
.
subplots
(
nrows
=
1
,
ncols
=
4
,
figsize
=
(
16
,
8
))
for
a
in
axes
:
a
.
set_xlabel
(
'RLD (cm/cm)'
)
a
.
set_ylabel
(
'Depth (cm)'
)
# Make a root length distribution
ana
=
rb
.
SegmentAnalyser
(
rs
)
rl_
=
ana
.
distribution
(
"length"
,
0.
,
depth
,
layers
,
True
)
axes
[
0
].
set_title
(
'All roots (120 days)'
)
axes
[
0
].
plot
(
rl_
,
z_
)
# Make a root length distribution along the soil core
ana
=
rb
.
SegmentAnalyser
(
rs
)
# ana.crop(geom)
ana
.
pack
()
rl_
=
ana
.
distribution
(
"length"
,
0.
,
depth
,
layers
,
True
)
axes
[
1
].
set_title
(
'Soil core (120 days)'
)
axes
[
1
].
plot
(
rl_
,
z_
)
# How it looked after 30 days?
ana
=
rb
.
SegmentAnalyser
(
rs
)
ana
.
filter
(
"creationTime"
,
0
,
30
)
# ana.crop(geom)
ana
.
pack
()
rl_
=
ana
.
distribution
(
"length"
,
0.
,
depth
,
layers
,
True
)
axes
[
2
].
set_title
(
'Soil core (30 days)'
)
axes
[
2
].
plot
(
rl_
,
z_
)
# Only laterals?
ana
=
rb
.
SegmentAnalyser
(
rs
)
ana
.
filter
(
"subType"
,
2
)
# assuming laterals are of type 2
ana
.
crop
(
geom
)
ana
.
pack
()
rl_
=
ana
.
distribution
(
"length"
,
0.
,
depth
,
layers
,
True
)
axes
[
3
].
set_title
(
'Soil core, lateral roots (120 days)'
)
axes
[
3
].
plot
(
rl_
,
z_
)
fig
.
subplots_adjust
()
plt
.
savefig
(
"../results/example_3b.png"
)
plt
.
show
()
print
(
"done."
)
Back
|
FazBrowse Home
|
New Git URL