openalea-incubator/adel

Issue when using AdelDress and dim_T

Opened this issue · 1 comments

Hi,
I'm having an issue when using AdelDress and dim_T in order to get a MTG with predefined blade dimensions. This may be due to an index error because of the metamer 0.
Here are two examples to illustrate the problem.

  • The example below generates a MTG with only 3 metamers instead of 4 and with wrong dimensions for the blade of metamer 1.
from alinea.adel.dresser import blade_dimension, dimension_table, AdelDress

blades = blade_dimension(length=[0.0814, 0.0924, 0.0935, 0.001],
                         area=[9.73318E-4, 2.33465E-4, 8.2562E-4, 1E-6],
                         ntop=[4, 3, 2, 1])
dimT = dimension_table(blades)
adel = AdelDress(dimT=dimT, dim_unit='m', scene_unit='m', seed=1234)
g = adel.canopy()
g.display()
  • The second example results in a KeyError in blade_dimension:
from alinea.adel.dresser import blade_dimension, dimension_table, AdelDress

blades = blade_dimension(length=[0.0814, 0.0924, 0.0935, 0.001],
                         area=[9.73318E-4, 2.33465E-4, 8.2562E-4, 1E-6],
                         ntop=[11, 10, 9, 8])

dimT = dimension_table(blades)
adel = AdelDress(dimT=dimT, dim_unit='m', scene_unit='m', seed=1234)
g = adel.canopy()
g.display()

Update: the bug reported in the example 1 is fixed if the stem dimensions are specified (using stem_dimension). Not tested for example 2.