Hi,

I'm trying to use the calculator tools both from SAGA and GRASS in SEXTANTE, 
and both are giving me errors.

For example, making the difference between two rasters in SAGA, with Grid 
Difference module, all runs ok.

Calculating the difference between the same rasters, but with Grid Calculator 
module, gives me an error. Looking at the log files, I noticed that the only 
difference is in the name of the input files, that in the case of Grid 
Difference uses the .sgrd temporary files, and in the case of Grid Calculator 
uses the name of the input files, which I put in the formula:

Grid Calculator:
SAGA execution commands
libio_gdal 0 -GRIDS "/home/pedro/sextante/tempdata/1335987049.2352.sgrd" -FILES 
"/home/pedro/SIG/ASTER_GDEM/mdt_aster_pt_D73_GeoTIFF/mdt_aster_pt_D73_GeoTIFF_clip2_fillnulls.tif"
libgrid_tools "Resampling" -INPUT 
"/home/pedro/sextante/tempdata/1335987049.2352.sgrd" -TARGET 0 -SCALE_UP_METHOD 
4 -SCALE_DOWN_METHOD 4 -USER_XMIN 67004.8257193 -USER_XMAX 113984.825719 
-USER_YMIN 93577.2639045 -USER_YMAX 146317.263904 -USER_SIZE 30.0 -USER_GRID 
"/home/pedro/sextante/tempdata/1335987049.2353.sgrd"
libio_gdal 0 -GRIDS "/home/pedro/sextante/tempdata/1335987049.2354.sgrd" -FILES 
"/home/pedro/SIG/ASTER_GDEM/mdt_aster_pt_D73_GeoTIFF/mdt_aster_pt_D73_GeoTIFF_clip2.tif"
libgrid_tools "Resampling" -INPUT 
"/home/pedro/sextante/tempdata/1335987049.2354.sgrd" -TARGET 0 -SCALE_UP_METHOD 
4 -SCALE_DOWN_METHOD 4 -USER_XMIN 67004.8257193 -USER_XMAX 113984.825719 
-USER_YMIN 93577.2639045 -USER_YMAX 146317.263904 -USER_SIZE 30.0 -USER_GRID 
"/home/pedro/sextante/tempdata/1335987049.2355.sgrd"
libgrid_calculus "Grid Calculator" -GRIDS 
"/home/pedro/sextante/tempdata/1335987049.2353.sgrd;/home/pedro/sextante/tempdata/1335987049.2355.sgrd"
 -FORMULA 
"mdt_aster_pt_D73_GeoTIFF_clip2_fillnulls.tif-mdt_aster_pt_D73_GeoTIFF_clip2" 
-RESULT "/home/pedro/sextante/tempdata/1335987049.250.tif.sgrd"
libio_gdal 1 -GRIDS "/home/pedro/sextante/tempdata/1335987049.250.tif.sgrd" 
-FORMAT 1 -TYPE 0 -FILE "/home/pedro/sextante/tempdata/1335987049.250.tif"


Grid Difference:
SAGA execution commands
libio_gdal 0 -GRIDS "/home/pedro/sextante/tempdata/1335987103.7557.sgrd" -FILES 
"/home/pedro/SIG/ASTER_GDEM/mdt_aster_pt_D73_GeoTIFF/mdt_aster_pt_D73_GeoTIFF_clip2_fillnulls.tif"
libgrid_tools "Resampling" -INPUT 
"/home/pedro/sextante/tempdata/1335987103.7557.sgrd" -TARGET 0 -SCALE_UP_METHOD 
4 -SCALE_DOWN_METHOD 4 -USER_XMIN 67004.8257193 -USER_XMAX 113984.825719 
-USER_YMIN 93577.2639045 -USER_YMAX 146317.263904 -USER_SIZE 30.0 -USER_GRID 
"/home/pedro/sextante/tempdata/1335987103.7558.sgrd"
libio_gdal 0 -GRIDS "/home/pedro/sextante/tempdata/1335987103.7559.sgrd" -FILES 
"/home/pedro/SIG/ASTER_GDEM/mdt_aster_pt_D73_GeoTIFF/mdt_aster_pt_D73_GeoTIFF_clip2.tif"
libgrid_tools "Resampling" -INPUT 
"/home/pedro/sextante/tempdata/1335987103.7559.sgrd" -TARGET 0 -SCALE_UP_METHOD 
4 -SCALE_DOWN_METHOD 4 -USER_XMIN 67004.8257193 -USER_XMAX 113984.825719 
-USER_YMIN 93577.2639045 -USER_YMAX 146317.263904 -USER_SIZE 30.0 -USER_GRID 
"/home/pedro/sextante/tempdata/1335987103.7560.sgrd"
libgrid_calculus "Grid Difference" -A 
"/home/pedro/sextante/tempdata/1335987103.7558.sgrd" -B 
"/home/pedro/sextante/tempdata/1335987103.7560.sgrd" -C 
"/home/pedro/sextante/tempdata/1335987103.7555.tif.sgrd"
libio_gdal 1 -GRIDS "/home/pedro/sextante/tempdata/1335987103.7555.tif.sgrd" 
-FORMAT 1 -TYPE 0 -FILE "/home/pedro/sextante/tempdata/1335987103.7555.tif"


Grid Calculator error:
SAGA execution console output
_____________________________________________
  #####   ##   #####    ##
 ###     ###  ##       ###
  ###   # ## ##  #### # ##
   ### ##### ##    # #####
##### #   ##  ##### #   ##
_____________________________________________

library path:/usr/lib/saga
library name:libio_gdal
module name :GDAL: Import Raster
author      :(c) 2007 by O.Conrad (A.Ringeler)
_____________________________________________
go...

Parameters

Grids: No objects
Files: 
"/home/pedro/SIG/ASTER_GDEM/mdt_aster_pt_D73_GeoTIFF/mdt_aster_pt_D73_GeoTIFF_clip2_fillnulls.tif"

loading: 
/home/pedro/SIG/ASTER_GDEM/mdt_aster_pt_D73_GeoTIFF/mdt_aster_pt_D73_GeoTIFF_clip2_fillnulls.tif

Driver: 
/home/pedro/SIG/ASTER_GDEM/mdt_aster_pt_D73_GeoTIFF/mdt_aster_pt_D73_GeoTIFF_clip2_fillnulls.tif/

Cells: x 1566, y 1758
Bands: 1
Transformation x' = 67004.825719 + x * 30.000000 + y * 0.000000
Transformation y' = 146317.263904 + x * 0.000000 + y * -30.000000

/   
Save grid: /home/pedro/sextante/tempdata/1335987049.2352.sgrd...

ready

okay
_____________________________________________
  #####   ##   #####    ##
 ###     ###  ##       ###
  ###   # ## ##  #### # ##
   ### ##### ##    # #####
##### #   ##  ##### #   ##
_____________________________________________

library path:/usr/lib/saga
library name:libgrid_tools
module name :Resampling
author      :O.Conrad (c) 2003
_____________________________________________
go...

Load grid: /home/pedro/sextante/tempdata/1335987049.2352.sgrd...

ready

okay

Parameters

Grid system: 30.000000; 1566x 1758y; 67019.825719x 93592.263904y
Grid: 1335987049.2352
Additional Grids: No objects
Additional Grids: No objects
Preserve Data Type: no
Target Grid: user defined

ready

Save grid: /home/pedro/sextante/tempdata/1335987049.2353.sgrd...

ready

okay
_____________________________________________
  #####   ##   #####    ##
 ###     ###  ##       ###
  ###   # ## ##  #### # ##
   ### ##### ##    # #####
##### #   ##  ##### #   ##
_____________________________________________

library path:/usr/lib/saga
library name:libio_gdal
module name :GDAL: Import Raster
author      :(c) 2007 by O.Conrad (A.Ringeler)
_____________________________________________
go...

Parameters

Grids: No objects
Files: 
"/home/pedro/SIG/ASTER_GDEM/mdt_aster_pt_D73_GeoTIFF/mdt_aster_pt_D73_GeoTIFF_clip2.tif"

loading: 
/home/pedro/SIG/ASTER_GDEM/mdt_aster_pt_D73_GeoTIFF/mdt_aster_pt_D73_GeoTIFF_clip2.tif

Driver: 
/home/pedro/SIG/ASTER_GDEM/mdt_aster_pt_D73_GeoTIFF/mdt_aster_pt_D73_GeoTIFF_clip2.tif/

Cells: x 1566, y 1758
Bands: 1
Transformation x' = 67004.825719 + x * 30.000000 + y * 0.000000
Transformation y' = 146317.263904 + x * 0.000000 + y * -30.000000

/   
Save grid: /home/pedro/sextante/tempdata/1335987049.2354.sgrd...

ready

okay
_____________________________________________
  #####   ##   #####    ##
 ###     ###  ##       ###
  ###   # ## ##  #### # ##
   ### ##### ##    # #####
##### #   ##  ##### #   ##
_____________________________________________

library path:/usr/lib/saga
library name:libgrid_tools
module name :Resampling
author      :O.Conrad (c) 2003
_____________________________________________
go...

Load grid: /home/pedro/sextante/tempdata/1335987049.2354.sgrd...

ready

okay

Parameters

Grid system: 30; 1566x 1758y; 67019.825719x 93592.263904y
Grid: 1335987049.2354
Additional Grids: No objects
Additional Grids: No objects
Preserve Data Type: no
Target Grid: user defined

ready

Save grid: /home/pedro/sextante/tempdata/1335987049.2355.sgrd...

ready

okay

error: Error in formula at position 0
 [m] dt_aster_pt_D73_GeoTIFF_clip2_fillnulls.tif-mdt_aster_pt_D73_GeoTIFF_clip2
function not found

error: executing module [Grid Calculator]
_____________________________________________
  #####   ##   #####    ##
 ###     ###  ##       ###
  ###   # ## ##  #### # ##
   ### ##### ##    # #####
##### #   ##  ##### #   ##
_____________________________________________

library path:/usr/lib/saga
library name:libgrid_calculus
module name :Grid Calculator
author      :Copyrights (c) 2003 by Andre Ringeler
_____________________________________________
go...

Load grid: /home/pedro/sextante/tempdata/1335987049.2353.sgrd...

ready

okay

Load grid: /home/pedro/sextante/tempdata/1335987049.2355.sgrd...

ready

okay

Parameters

Grid system: 30; 1567x 1759y; 67004.825719x 93577.263904y
Grids: 2 objects (1335987049.2353, 1335987049.2355))
Grids from different Systems: No objects
Result: Result
Formula: 
mdt_aster_pt_D73_GeoTIFF_clip2_fillnulls.tif-mdt_aster_pt_D73_GeoTIFF_clip2
Name: Calculation
Take Formula: no
Use NoData: no

/   
-   
error: Grid file could not be opened.

error: input file [/home/pedro/sextante/tempdata/1335987049.250.tif.sgrd]

error: empty input list [GRIDS]

error: executing module [GDAL: Export Raster]
_____________________________________________
  #####   ##   #####    ##
 ###     ###  ##       ###
  ###   # ## ##  #### # ##
   ### ##### ##    # #####
##### #   ##  ##### #   ##
_____________________________________________

library path:/usr/lib/saga
library name:libio_gdal
module name :GDAL: Export Raster
author      :O.Conrad (c) 2007
_____________________________________________
go...

Load grid: /home/pedro/sextante/tempdata/1335987049.250.tif.sgrd...

failed




So, what's the syntax I should use in Formula?







The GRASS r.mapcalculator module

GRASS execution commands
g.region n=146317.263904 s=93577.2639045 e=113984.825719 w=67004.8257193 
res=30.0
r.in.gdal 
input="/home/pedro/SIG/ASTER_GDEM/mdt_aster_pt_D73_GeoTIFF/mdt_aster_pt_D73_GeoTIFF_clip2.tif"
 band=1 out=tmp13359846747445 --overwrite -o
r.in.gdal 
input="/home/pedro/SIG/ASTER_GDEM/mdt_aster_pt_D73_GeoTIFF/mdt_aster_pt_D73_GeoTIFF_clip2_fillnulls.tif"
 band=1 out=tmp13359846747446 --overwrite -o
r.in.gdal 
input="/home/pedro/SIG/ASTER_GDEM/mdt_aster_pt_D73_GeoTIFF/mdt_aster_pt_D73_GeoTIFF_clip2_fillnulls.tif"
 band=1 out=tmp13359846747447 --overwrite -o
r.in.gdal 
input="/home/pedro/SIG/ASTER_GDEM/mdt_aster_pt_D73_GeoTIFF/mdt_aster_pt_D73_GeoTIFF_clip2_fillnulls.tif"
 band=1 out=tmp13359846747448 --overwrite -o
r.in.gdal 
input="/home/pedro/SIG/ASTER_GDEM/mdt_aster_pt_D73_GeoTIFF/mdt_aster_pt_D73_GeoTIFF_clip2_fillnulls.tif"
 band=1 out=tmp13359846747449 --overwrite -o
r.in.gdal 
input="/home/pedro/SIG/ASTER_GDEM/mdt_aster_pt_D73_GeoTIFF/mdt_aster_pt_D73_GeoTIFF_clip2_fillnulls.tif"
 band=1 out=tmp13359846747450 --overwrite -o
r.mapcalculator amap=tmp13359846747445 bmap=tmp13359846747450 
cmap=tmp13359846747450 dmap=tmp13359846747450 emap=tmp13359846747450 
fmap=tmp13359846747450 formula=amap-bmap outfile=outfile --overwrite
g.region rast=outfile
r.out.gdal -c createopt="TFW=YES,COMPRESS=LZW" input=outfile 
output="/home/pedro/sextante/tempdata/1335984674.7343.tif"


gives me this error:

GRASS execution console output
Cleaning up temporary files ...
Starting GRASS ...
Executing '/home/pedro/sextante/grass_batch_job.sh' ...
Welcome to GRASS 6.4.1 (2011) 
ATENÃÃO: Over-riding projection check
   2%   5%   8%  11%  14%  17%  20%  23%  26%  29%  32%  35%  38%  41%  44%  
47%  50%  53%  56%  59%  62%  65%  68%  71%  74%  77%  80%  83%  86%  89%  92%  
95%  98% 100%
r.in.gdal completo. Raster map <tmp13359846747445> created.
ATENÃÃO: Over-riding projection check
   2%   5%   8%  11%  14%  17%  20%  23%  26%  29%  32%  35%  38%  41%  44%  
47%  50%  53%  56%  59%  62%  65%  68%  71%  74%  77%  80%  83%  86%  89%  92%  
95%  98% 100%
r.in.gdal completo. Raster map <tmp13359846747446> created.
ATENÃÃO: Over-riding projection check
   2%   5%   8%  11%  14%  17%  20%  23%  26%  29%  32%  35%  38%  41%  44%  
47%  50%  53%  56%  59%  62%  65%  68%  71%  74%  77%  80%  83%  86%  89%  92%  
95%  98% 100%
r.in.gdal completo. Raster map <tmp13359846747447> created.
ATENÃÃO: Over-riding projection check
   2%   5%   8%  11%  14%  17%  20%  23%  26%  29%  32%  35%  38%  41%  44%  
47%  50%  53%  56%  59%  62%  65%  68%  71%  74%  77%  80%  83%  86%  89%  92%  
95%  98% 100%
r.in.gdal completo. Raster map <tmp13359846747448> created.
ATENÃÃO: Over-riding projection check
   2%   5%   8%  11%  14%  17%  20%  23%  26%  29%  32%  35%  38%  41%  44%  
47%  50%  53%  56%  59%  62%  65%  68%  71%  74%  77%  80%  83%  86%  89%  92%  
95%  98% 100%
r.in.gdal completo. Raster map <tmp13359846747449> created.
ATENÃÃO: Over-riding projection check
   2%   5%   8%  11%  14%  17%  20%  23%  26%  29%  32%  35%  38%  41%  44%  
47%  50%  53%  56%  59%  62%  65%  68%  71%  74%  77%  80%  83%  86%  89%  92%  
95%  98% 100%
r.in.gdal completo. Raster map <tmp13359846747450> created.
r.mapcalc "outfile" = "(amap-bmap)"
Invalid map <amap>
Invalid map <bmap>
Parse error
ERRO:Calculating outfile. Try expert mode.
ERRO:Raster map <outfile> not found
ERRO:Raster map or group <outfile> not found
Closing monitors ...
Cleaning up temporary files ...
Batch job '/home/pedro/sextante/grass_batch_job.sh' (defined in GRASS_BATCH_JOB 
variable) was executed.
Goodbye from GRASS GIS


In the module interface it's necessary to choose files for all fields (amap, 
bmap, cmap, dmap, emap, fmap), but in this case I just need the first and the 
second, because this calculation only involve two raster files. Could this be 
the source of the error?

Thank you very much!

Pedro Venâncio
_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to