Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test astk_interface.py not running with initialize_stand #29

Open
mlabadie opened this issue Jan 20, 2022 · 7 comments · May be fixed by #33
Open

Test astk_interface.py not running with initialize_stand #29

mlabadie opened this issue Jan 20, 2022 · 7 comments · May be fixed by #33
Assignees
Labels

Comments

@mlabadie
Copy link
Contributor

Error:

~\Documents\GitHub\adel\src\alinea\adel\newmtg.py in mtg_factory(parameters, metamer_factory, leaf_sectors, leaves, stand, axis_dynamics, add_elongation, topology, split, aborting_tiller_reduction, leaf_db)
    530             args.update({'split': split})
    531
--> 532             if args.get('HS_final') < args.get('nff'):
    533                 for what in (
    534                 'Ll', 'Lv', 'Lr', 'Lsen', 'L_shape', 'Lw_shape', 'Gl', 'Gv',

TypeError: '>' not supported between instances of 'numpy.ndarray' and 'numpy.str_'
@pradal
Copy link
Collaborator

pradal commented May 12, 2022

Can you provide a test?
Thanks

@pradal
Copy link
Collaborator

pradal commented May 14, 2022

Here is a test (thks @HowcanoeWang): see issue #27

>>> from alinea.adel.astk_interface import AdelWheat
>>> from alinea.astk.Weather import sample_weather

>>> adel = AdelWheat(nsect=2)
>>> g = adel.setup_canopy(100)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/hwang/miniconda3/envs/adel/lib/python3.9/site-packages/alinea.adel-1.9.0-py3.9.egg/alinea/adel/astk_interface.py", line 154, in setup_canopy
    g = self.build_mtg(canopy, stand,
  File "/home/hwang/miniconda3/envs/adel/lib/python3.9/site-packages/alinea.adel-1.9.0-py3.9.egg/alinea/adel/adel.py", line 226, in build_mtg
    g = mtg_factory(parameters, stand=stand, leaf_sectors=self.nsect,
  File "/home/hwang/miniconda3/envs/adel/lib/python3.9/site-packages/alinea.adel-1.9.0-py3.9.egg/alinea/adel/newmtg.py", line 532, in mtg_factory
    if args.get('HS_final') < args.get('nff'):
TypeError: '>' not supported between instances of 'numpy.ndarray' and 'numpy.str_'

@pradal
Copy link
Collaborator

pradal commented May 18, 2022

@mlabadie : This works on my computer (Mac).
Can you test it on yours?

@HowcanoeWang: What is your operating system? Win, Mac, Linux?

@mlabadie
Copy link
Contributor Author

@mlabadie : This works on my computer (Mac). Can you test it on yours?

@HowcanoeWang: What is your operating system? Win, Mac, Linux?

@pradal @HowcanoeWang
On my computer (Win) it works.

I tested using my pre-existing Conda environment and creating a new environment with the installation of alinea.adel from the Conda Openalea3 channel.

In [6]: from alinea.astk.Weather import sample_weather
In [7]: from alinea.adel.astk_interface import AdelWheat
In [8]: adel = AdelWheat(nsect=2)
In [9]: g = adel.setup_canopy(age=100)
In [10]: g.display()
MTG : nb_vertices=23, nb_scales=6
/plant1                 (id=1)
^/MS                    (id=2)
^/metamer1                      (id=3)
^/internode                     (id=4)
^/HiddenElement                 (id=5)
^<StemElement                   (id=6)
        +sheath                 (id=7)
        ^/HiddenElement                 (id=8)
        ^<StemElement                   (id=9)
        ^<blade                 (id=10)
        ^/HiddenElement                 (id=11)
        ^<LeafElement1                  (id=12)
        ^<LeafElement2                  (id=13)
^<metamer2                      (id=14)
^/internode                     (id=15)
^/HiddenElement                 (id=16)
^<StemElement                   (id=17)
        +sheath                 (id=18)
        ^/HiddenElement                 (id=19)
        ^<StemElement                   (id=20)
        ^<blade                 (id=21)
        ^/HiddenElement                 (id=22)

@pradal
Copy link
Collaborator

pradal commented May 18, 2022

Yes. But it fails with

g = adel.setup_canopy(age=1000)

@pradal
Copy link
Collaborator

pradal commented May 18, 2022

@christian34 Some warnings are introduce from rpy2

(Sorry in french)

R[write to console]: Messages d'avis :

R[write to console]: 1: NAs introduits lors de la conversion automatique 

R[write to console]: 2: NAs introduits lors de la conversion automatique 

R[write to console]: 3: 
R[write to console]: Dans regularize.values(x, y, ties, missing(ties), na.rm = na.rm) :
R[write to console]: 
 
R[write to console]:  collapsing to unique 'x' values

R[write to console]: 4: 
R[write to console]: Dans regularize.values(x, y, ties, missing(ties), na.rm = na.rm) :
R[write to console]: 
 
R[write to console]:  collapsing to unique 'x' values

R[write to console]: 5: 
R[write to console]: Dans regularize.values(x, y, ties, missing(ties), na.rm = na.rm) :
R[write to console]: 
 
R[write to console]:  collapsing to unique 'x' values

R[write to console]: 6: 
R[write to console]: Dans regularize.values(x, y, ties, missing(ties), na.rm = na.rm) :
R[write to console]: 
 
R[write to console]:  collapsing to unique 'x' values

pradal added a commit to pradal/adel that referenced this issue May 18, 2022
@pradal pradal linked a pull request May 18, 2022 that will close this issue
@HowcanoeWang
Copy link

HowcanoeWang commented May 18, 2022

@mlabadie : This works on my computer (Mac). Can you test it on yours?

@HowcanoeWang: What is your operating system? Win, Mac, Linux?

Ubuntu in Windows Linux Subsystem.

=====

Emm, strange. It works today. And I could not reproduce the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants