qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.6k stars 3.01k forks source link

Modeler and Raster Calculator fail to calc #32753

Open leolami opened 5 years ago

leolami commented 5 years ago

Hi all,

context: Raster Calculator added in a Processing model + 1 rasters as input Using the Raster Calculator module inside a Model I have an output always as float raster with [-1.7: 1.7]

This only happens if the interface is in Italian or Spanish. Everything works correctly with the interface in English. I have not verified with other languages

Maybe there's a related issue at https://github.com/qgis/QGIS/issues/27130

Thanks

elpaso commented 5 years ago

Can you please share a test project plus data?

leolami commented 5 years ago

In the zip we can find datas, project and model created using italian language interface Thank you

leolami commented 5 years ago

https://drive.google.com/open?id=1FCmZjgTLYlci8GtXuZBp7JavT_IqZ04G

elpaso commented 4 years ago

I'm sorry: I missed the notification of the attachment, I'll check it out ASAP.

luipir commented 4 years ago

@leolami @mudomau may you try apply this commit: https://github.com/luipir/QGIS/commit/a78dbb7d2cfe01914491ba786e9f8ddef19e7584 (you can just cut&paste in the python code) and check if it fix in your locale conditions? i checked and it works, but I'm not completely sure when alg variable are translated or not... in some of my tests I had variable translations, and in some others no :/... so please check!

mudomau commented 4 years ago

Nope.

Cut&Pasted, saved.

Opened QGIS, changed the Language to Spanish, closed the program.

Opened it again, tried to run the model and got the same error as before - "pointer cannot be cast to float".

Then I changed the language to English, closed and re-opened the program, ran the same model and no error (well - a different error did happen, but the Raster Calculator worked).

luipir commented 4 years ago

@mudomau checking

luipir commented 4 years ago

@mudomau can you share model and data set? I successfylly executed @leolami model and yours in https://github.com/qgis/QGIS/issues/33338#issuecomment-564910701

luipir commented 4 years ago

@mudomau @leolami ???

mudomau commented 4 years ago

@luipir Sorry for the delay in the reply, been rather busy these past few days. Model and data set I'm using is the same one provided in #33338 .

I just ran the model on a different DEM (You can find the model and DEM here - https://viridire-my.sharepoint.com/:f:/g/personal/m_dikdan_ralos-newenergy_de/Ephw9BnW72xGrXJu45kw8ekBsrl5xIxjQF60_ykRaEMGWw?e=LyCNYc) with the program in English. It worked as expected.

I then changed the interface language to "español de España" and the Regional configuration to "Spanish Spain (es_ES)", and restarted the program.

Ran the model again on the linked DEM, and it failed. Specifically, from the model register I'm seeing:

"Step 3 (QGIS raster calculator) completed with no errors" -> This should generate a temporary .tif that becomes the input for Step 4.

"Step 4: Could not load layer for INPUT_A: temp file not found."

imagen

When I look at the program message log however, the error seems to come from Step 3 (as the formula that is labled as "CRITICAL - pointer cannot be cast to type 'float'" is part of this step)

imagen

I just double-checked that the changes from https://github.com/luipir/QGIS/commit/a78dbb7d2cfe01914491ba786e9f8ddef19e7584 were saved in the RasterCalculator.py, and they were.

I added the message logs to the linked folder, in case they might be of help.

elpaso commented 4 years ago

@luipir I think the right solution here is to NOT translate the strings that create the temporary raster name (such as "'Aspect' from algorithm 'Aspect'")

See: https://github.com/qgis/QGIS/issues/33317#issuecomment-564113171

luipir commented 4 years ago

@mudomau strange! I used your model (but different dem) and the same steps and I wasn't able to reproduce the error with my fix... I'll check on Win environment (but I can't today sorry)

leolami commented 4 years ago

Hi everyone, I modified RasterCalculator.py as in the commit luipir@a78dbb7 and I can confirm that now the model works also with the italian language interface

luipir commented 4 years ago

done PR... strictly to fix this issue that seems solved. Tnx @leolami and @mudomau to test them, and sorry to be late.

leolami commented 4 years ago

Tnx to you

alexbruy commented 4 years ago

Probably related to #32310.

katxeus commented 4 years ago

Echoing @ghtmtt 's concerns, It seems to be a similar case with me.

gioman commented 3 years ago

This should have been closed by https://github.com/qgis/QGIS/pull/33601

agiudiceandrea commented 1 year ago

It seems to me this issue was never fixed (#33601 was never merged) and it occurs with current QGIS versions.