hydro_io#
- openalea.hydroroot.hydro_io.export_mtg_to_aqua_file(g, filename='out.csv')[source]#
Export a MTG architecture in a csv file into format used by aquaporin team
- Parameters:
g – (MTG)
filename –
(string) - the name of the output file (Default value = “out.csv”)
- the format is 3 columns separated by tab:
1st col: “distance_from_base_(mm)” distance in mm from base on the parent root where starts the lateral root
2nd col: “lateral_root_length_(mm)” length in mm of the corresponding lateral root
3d col: “order” = 1 if parent root is the primary root, = 1-n if the parent root is a lateral root that starts at the node n on the parent root
It uses only the mtg properties ‘position’, ‘order’ and ‘edge_type’ because they are the only ones saved in simulated architecture At this stage (2019-12-20) only up to the 2d order
- openalea.hydroroot.hydro_io.export_mtg_to_rsml(g_discrete, filename=None, segment_length=0.0001)[source]#
Export a discrete MTG architecture into a rsml file or return a continuous MTG according to the parameters (see below) only the geometry is exported no other properties
- Parameters:
g_discrete – (MTG) - the discrete MTG to export
filename – (string) - the name of the output file (Default value = None) , if None return a continuous MTG
segment_length – (float) - length of the MTG segments in m (Default value = 1.0e-4)
- Returns:
g the continuous MTG if filename is None otherwise write it to the filename
Remark:
g_discrete from hydroroot has length and radius in (m)
Does not overwrite the MTG in input
Process:
- 1st: use a turtle to get position in 3D
use functions from hydroroot.display
in display.get_root_visitor_with_point() g property “position3d” is created
- 2d: insert scales
MTG from hydroroot has only segment scale, the finest
add the axes scale
add the plant scale
end up with: plant scale = 1, axes scale = 2, segments scale = 3
- 3d: convert the discrete MTG to continuous
MTG without the finest scale, and with polylines to discribe axes
4th: write to the file
- openalea.hydroroot.hydro_io.import_rsml_to_discrete_mtg(g_c, segment_length=0.0001, resolution=0.0001)[source]#
Convert MTG from continuous to discrete usable in HydroRoot
- Does the reverse of discrete_to_continuous:
Add a sequence of segments to all axes from their geometry attribute
- Based only on the coordinates of the polylines:
calculation of the euclidian distance between points of polylines then add the segment needed
to place a lateral on its parent axe, we calcul the distance between the 1st point of the lateral and the vertices of the parent axe and take the shortest distance to select the branshing vertex on the axe
- Params g_c:
(MTG) - the continuous MTG to convert
- Params segment_length:
(Float) - the segment length in meter (m)
- Params resolution:
(float) - the resolution of the polylines coordinates, in polylines unit per meter (unit/m)
- Returns:
g discrete MTG
Remark: At this stage (2022-08-22) only the root length and the branching position are used to simulate architecture in hydroponic solution. The exact position in 3D is not stored in the discrete MTG form.
- openalea.hydroroot.hydro_io.read_rsml(filename, segment_length=0.0001)[source]#
Read an RSML file to discretuous MTG. The RSML file must have resolution and unit properties. The MTG will have root segments of length segment_length in meter.
- Parameters:
filename – (string) relative path to name of the rsml file
segment_length – (Float) - the segment length in meter (m)
- Returns:
g (MTG)
Download the source file ../../src/openalea/hydroroot/hydro_io.py.