Skip to content

Erreur Python lors du calcul des ombres (step 3) #42

@Olivier-Descout

Description

@Olivier-Descout

Bonjour,
Ayant migré vers la version 3.44.8-1 de QGIS, je rencontre une erreur Python à l'étape 3 (calcul des ombres).

L'erreur Python est la suivante :

ValueError: setting an array element with a sequence. 
TypeError: only 0-dimensional arrays can be converted to Python scalars

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users/desco/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ICEtool\Scripts\ShadowGenerator\shadow_generator.py", line 419, in start_progress
    shadowresult = dsh.dailyshading(dsm, vegdsm, vegdsm2, scale, lon, lat, sizex, sizey, tv, UTC, usevegdem,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users/desco/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ICEtool\Scripts\ShadowGenerator\dailyshading.py", line 92, in dailyshading
    alt[i] = 90. - sun['zenith']
    ~~~^^^
ValueError: setting an array element with a sequence.

Il semble que le problème vienne du fait que sun['zenith'] (et sun['azimuth']) soient désormais des tableaux de longueur 1, plutôt que des scalaires.

En modifiant les lignes 92 et 93 du fichier ShadowGenerator/dailyshading.py comme suit, l'erreur Python disparaît (en espérant que ce soit la bonne correction à apporter) :

        alt[i] = 90. - sun['zenith'][0]
        azi[i] = sun['azimuth'][0]

Merci par avance de votre aide.
Cdt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions