Feature request #10443

Updated by Jürgen Fischer over 7 years ago

*new description:*



see #10443-3

https://issues.qgis.org/issues/10443#note-3

<pre>

Description

The Grid Calculator calculates a new grid based on existing grids and a mathematical formula. The grid variables are single characters which correspond in alphabetical order to the grid list order ('a' = first grid, 'b' = second grid, ...)

Alternatively you can address with letter 'g' followed by position index (g1, g2, g3, ...). Grids from other systems are addressed similarly, just using letter 'h' (h1, h2, h3, ...)

</pre>



*old description:*

I found a problem in Raster calculator, when using the g1, g2, gx format in the Formula. Using a, b​​, ..., it works.



I attach sample data and log info.



- FORMULA "ifelse(eq(g2,1),1,g1)":

<pre>

SAGA execution commands

io_gdal 0 -TRANSFORM -INTERPOL 0 -GRIDS "/tmp/processing/5b521b3c40614cf0a236986402767fde/probabilidade3.sgrd" -FILES "/home/pedro/EUQGIS2014/workshop_processing/resultados/probabilidade_3.tif"

io_gdal 0 -TRANSFORM -INTERPOL 0 -GRIDS "/tmp/processing/8a1b5f9633af4617b183fc5ca54fb64c/somatorio.sgrd" -FILES "/home/pedro/EUQGIS2014/workshop_processing/resultados/somatorio.tif"

grid_calculus "Grid Calculator" -GRIDS "/tmp/processing/5b521b3c40614cf0a236986402767fde/probabilidade3.sgrd" -XGRIDS "/tmp/processing/8a1b5f9633af4617b183fc5ca54fb64c/somatorio.sgrd" -FORMULA "ifelse(eq(g2,1),1,g1)" -RESULT "/home/pedro/EUQGIS2014/workshop_processing/resultados/probabilidade_4_teste.tif.sgrd"

io_gdal 1 -GRIDS "/home/pedro/EUQGIS2014/workshop_processing/resultados/probabilidade_4_teste.tif.sgrd" -FORMAT 1 -TYPE 0 -FILE "/home/pedro/EUQGIS2014/workshop_processing/resultados/probabilidade_4_teste.tif"



SAGA execution console output

_____________________________________________



##### ## ##### ##

### ### ## ###

### # ## ## #### # ##

### ##### ## # #####

##### # ## ##### # ##

_____________________________________________



_____________________________________________

library path: /usr/lib/saga/libio_gdal.so

library name: Import/Export - GDAL/OGR

module name : GDAL: Import Raster

author : O.Conrad (c) 2007 (A.Ringeler)

_____________________________________________



Parameters



Grids: No objects

Files: "/home/pedro/EUQGIS2014/workshop_processing/resultados/probabilidade_3.tif"

Transformation: yes

Interpolation: Nearest Neighbor



loading: /home/pedro/EUQGIS2014/workshop_processing/resultados/probabilidade_3.tif

Driver: /home/pedro/EUQGIS2014/workshop_processing/resultados/probabilidade_3.tif/

Cells: x 351, y 558

Bands: 1

Transformation x' = 72601.347778 + x * 80.012074 + y * 0.000000

Transformation y' = 146231.038994 + x * 0.000000 + y * -80.012074

loading band [1/1]



Inconsistency detected by ld.so: dl-close.c: 762: _dl_close: Assertion `map->l_init_called' failed!

_____________________________________________



##### ## ##### ##

### ### ## ###

### # ## ## #### # ##

### ##### ## # #####

##### # ## ##### # ##

_____________________________________________



_____________________________________________

library path: /usr/lib/saga/libio_gdal.so

library name: Import/Export - GDAL/OGR

module name : GDAL: Import Raster

author : O.Conrad (c) 2007 (A.Ringeler)

_____________________________________________



Parameters



Grids: No objects

Files: "/home/pedro/EUQGIS2014/workshop_processing/resultados/somatorio.tif"

Transformation: yes

Interpolation: Nearest Neighbor



loading: /home/pedro/EUQGIS2014/workshop_processing/resultados/somatorio.tif

Driver: /home/pedro/EUQGIS2014/workshop_processing/resultados/somatorio.tif/

Cells: x 351, y 558

Bands: 1

Transformation x' = 72601.347778 + x * 80.012074 + y * 0.000000

Transformation y' = 146231.038994 + x * 0.000000 + y * -80.012074

loading band [1/1]



Inconsistency detected by ld.so: dl-close.c: 762: _dl_close: Assertion `map->l_init_called' failed!

Error: error in formula: ifelse(eq(g2,1),1,a)

Error: executing module [Grid Calculator]

_____________________________________________



##### ## ##### ##

### ### ## ###

### # ## ## #### # ##

### ##### ## # #####

##### # ## ##### # ##

_____________________________________________



_____________________________________________

library path: /usr/lib/saga/libgrid_calculus.so

library name: Grid - Calculus

module name : Grid Calculator

author : Copyrights (c) 2003 by Andre Ringeler

_____________________________________________



Load grid: /tmp/processing/5b521b3c40614cf0a236986402767fde/probabilidade3.sgrd...



Load grid: /tmp/processing/8a1b5f9633af4617b183fc5ca54fb64c/somatorio.sgrd...



Parameters



Grid system: 80.012074; 351x 558y; 72641.353815x 101624.307639y

Grids: 1 object (probabilidade3)

Grids from different Systems: 1 object (somatorio)

Result: Result

Formula: ifelse(eq(g2,1),1,g1)

Name: Calculation

Take Formula: no

Use NoData: no

Data Type: 4 byte floating point number



Inconsistency detected by ld.so: dl-close.c: 762: _dl_close: Assertion `map->l_init_called' failed!

Error: Grid file could not be opened.

Error: executing module [GDAL: Export Raster]

_____________________________________________



##### ## ##### ##

### ### ## ###

### # ## ## #### # ##

### ##### ## # #####

##### # ## ##### # ##

_____________________________________________



_____________________________________________

library path: /usr/lib/saga/libio_gdal.so

library name: Import/Export - GDAL/OGR

module name : GDAL: Export Raster

author : O.Conrad (c) 2007

_____________________________________________



Load grid: /home/pedro/EUQGIS2014/workshop_processing/resultados/probabilidade_4_teste.tif.sgrd...

failed

GDAL: Export Raster: could not initialize data objects

Inconsistency detected by ld.so: dl-close.c: 762: _dl_close: Assertion `map->l_init_called' failed!

</pre>



- FORMULA "ifelse(eq(b,1),1,a)"

<pre>

SAGA execution commands

grid_calculus "Grid Calculator" -GRIDS "/tmp/processing/5b521b3c40614cf0a236986402767fde/probabilidade3.sgrd" -XGRIDS "/tmp/processing/8a1b5f9633af4617b183fc5ca54fb64c/somatorio.sgrd" -FORMULA "ifelse(eq(b,1),1,a)" -RESULT "/home/pedro/EUQGIS2014/workshop_processing/resultados/probabilidade_4_teste.tif.sgrd"

io_gdal 1 -GRIDS "/home/pedro/EUQGIS2014/workshop_processing/resultados/probabilidade_4_teste.tif.sgrd" -FORMAT 1 -TYPE 0 -FILE "/home/pedro/EUQGIS2014/workshop_processing/resultados/probabilidade_4_teste.tif"



SAGA execution console output

_____________________________________________



##### ## ##### ##

### ### ## ###

### # ## ## #### # ##

### ##### ## # #####

##### # ## ##### # ##

_____________________________________________



_____________________________________________

library path: /usr/lib/saga/libgrid_calculus.so

library name: Grid - Calculus

module name : Grid Calculator

author : Copyrights (c) 2003 by Andre Ringeler

_____________________________________________



Load grid: /tmp/processing/5b521b3c40614cf0a236986402767fde/probabilidade3.sgrd...



Load grid: /tmp/processing/8a1b5f9633af4617b183fc5ca54fb64c/somatorio.sgrd...



Parameters



Grid system: 80.012074; 351x 558y; 72641.353815x 101624.307639y

Grids: 1 object (probabilidade3)

Grids from different Systems: 1 object (somatorio)

Result: Result

Formula: ifelse(eq(b,1),1,a)

Name: Calculation

Take Formula: no

Use NoData: no

Data Type: 4 byte floating point number



Inconsistency detected by ld.so: dl-close.c: 762: _dl_close: Assertion `map->l_init_called' failed!

_____________________________________________



##### ## ##### ##

### ### ## ###

### # ## ## #### # ##

### ##### ## # #####

##### # ## ##### # ##

_____________________________________________



_____________________________________________

library path: /usr/lib/saga/libio_gdal.so

library name: Import/Export - GDAL/OGR

module name : GDAL: Export Raster

author : O.Conrad (c) 2007

_____________________________________________



Load grid: /home/pedro/EUQGIS2014/workshop_processing/resultados/probabilidade_4_teste.tif.sgrd...



Parameters



Grid system: 80.012074; 351x 558y; 72641.353815x 101624.307639y

Grid(s): 1 object (probabilidade_4_teste.tif)

File: /home/pedro/EUQGIS2014/workshop_processing/resultados/probabilidade_4_teste.tif

Format: GeoTIFF

Data Type: match input data

Set Custom NoData: no

NoData Value: 0.000000

Creation Options:



Band 1

</pre>



This only happens when you use more than one raster in the formula.



And it is a regression, as it only happens in the master version. With 2.2.0-2 which is in plugins, it works ok.



As it is a regression, I put it as blocker.

Back