TransWikia.com

GRASS Tool r.stats.zonal for QGIS 3.14 Pi is not working in batch mode

Geographic Information Systems Asked by Daniel Gomes on July 24, 2020

I am trying to calculate the averages and standard deviations of the pixels of a group of 31 vegetation index rasters calculated from Landsat images, but only where these rasters intersect the polygons of a given shapefile.

I used the r.stats.zonal, and it worked perfectly in the single-mode. Especially after I realize that I needed to convert the shapefile to an integer raster and that I had to activate the "-c" parameter (Cover values extracted from the category labels of the cover map).

But when I try to use the batch mode, all the processings get an error in the log file and the raster outputs for all images that I processed get the same average and standard deviation value, which are not correct — each Landsat image was taken in different years and the vegetation index values are very different from image to image…

For each image processed in batch mode there is an error message in red characters that is not in the Logfile of the single-mode run:

Traceback (most recent call last):
File "C:/OSGEO4~1/apps/qgis/./python/pluginsprocessingalgsgrass7Grass7Algorithm.py", line 434, in 
processAlgorithm
Grass7Utils.executeGrass(self.commands, feedback, self.outputCommands)
File "C:/OSGEO4~1/apps/qgis/./python/pluginsprocessingalgsgrass7Grass7Utils.py", line 401, in 
executeGrass
feedback.reportError(line.strip())
TypeError: reportError() missing 1 required positional argument: 'fatalError'

Algorithm r.stats.zonal failed…
Execution failed after 12.81 seconds

I am running QGIS 3.14.0 Pi and GRASS GIS 7.8.3-1 and the OS is a Windows 7 Professional SP1 64Bit with an Intel Core i3-2370M CPU @ 2.4 GHz and 4 GB RAM

This is the log file of the single-mode run that worked correctly:

QGIS version: 3.14.0-Pi
QGIS code revision: 9f7028fd23
Qt version: 5.11.2
GDAL version: 3.0.4
GEOS version: 3.8.1-CAPI-1.13.3
PROJ version: Rel. 6.3.2, May 1st, 2020
Processing algorithm…
Algorithm 'r.stats.zonal' starting…
Input parameters:
{ '-c' : True, '-r' : False, 'GRASS_RASTER_FORMAT_META' : '', 'GRASS_RASTER_FORMAT_OPT' : '', 'GRASS_REGION_CELLSIZE_PARAMETER' : 0, 'GRASS_REGION_PARAMETER' : None, 'base' : 'E:/danielgomes/2020_paragominasEVIufrj/42_rasterizeForestSamples/42_rasterizeForestSamples.tif', 'cover' : 'E:/danielgomes/2020_paragominasEVIufrj/12_rOutput05absDenAgbi/LC08_L1TP_223062_20170706_biomassEVI_absDen.tif', 'method' : 5, 'output' : 'E:/danielgomes/2020_paragominasEVIufrj/44_ForestStats/testingFlag-c.tif' }

g.proj -c proj4="+proj=longlat +datum=WGS84 +no_defs"
r.in.gdal input="E:danielgomes2020_paragominasEVIufrj42_rasterizeForestSamples42_rasterizeForestSamples.tif" band=1 output="rast_5f18554fccc542" --overwrite -o
r.in.gdal input="E:danielgomes2020_paragominasEVIufrj12_rOutput05absDenAgbiLC08_L1TP_223062_20170706_biomassEVI_absDen.tif" band=1 output="rast_5f18554fccc543" --overwrite -o
g.region n=-3.1 s=-3.3999535 e=-47.500062 w=-47.9 res=0.0002694999999999992
r.stats.zonal base=rast_5f18554fccc542 cover=rast_5f18554fccc543 method="average" -c output=outputdee9e546defb42b28db4cba654d8604c --overwrite
g.region raster=outputdee9e546defb42b28db4cba654d8604c
r.out.gdal -t -m input="outputdee9e546defb42b28db4cba654d8604c" output="E:danielgomes2020_paragominasEVIufrj44_ForestStatstestingFlag-c.tif" format="GTiff" createopt="TFW=YES,COMPRESS=LZW" --overwrite
Starting GRASS GIS...
ATENÇÃO: Concurrent mapset locking is not supported on Windows
Cleaning up temporary files...
Executing <C:UsersabcAppDataLocalTempprocessing_ldFClygrassdatagrass_batch_job.cmd> ...
C:WindowsSystem32>chcp 1252 1>NUL
C:WindowsSystem32>g.proj -c proj4="+proj=longlat +datum=WGS84 +no_defs"
Default region was updated to the new projection, but if you have multiple mapsets `g.region -d` should be run in each to update the region from the default
Projection information updated
C:WindowsSystem32>r.in.gdal input="E:danielgomes2020_paragominasEVIufrj42_rasterizeForestSamples42_rasterizeForestSamples.tif" band=1 output="rast_5f18554fccc542" --overwrite -o
Se sobrepondo à verificação da projeção
Importing raster map <rast_5f18554fccc542>...
0..3..6..9..12..15..18..21..24..27..30..33..36..39..42..45..48..51..54..57..60..63..66..69..72..75..78..81..84..87..90..93..96..99..100
C:WindowsSystem32>r.in.gdal input="E:danielgomes2020_paragominasEVIufrj12_rOutput05absDenAgbiLC08_L1TP_223062_20170706_biomassEVI_absDen.tif" band=1 output="rast_5f18554fccc543" --overwrite -o
Se sobrepondo à verificação da projeção
Importing raster map <rast_5f18554fccc543>...
0..3..6..9..12..15..18..21..24..27..30..33..36..39..42..45..48..51..54..57..60..63..66..69..72..75..78..81..84..87..90..93..96..99..100
C:WindowsSystem32>g.region n=-3.1 s=-3.3999535 e=-47.500062 w=-47.9 res=0.0002694999999999992
C:WindowsSystem32>r.stats.zonal base=rast_5f18554fccc542 cover=rast_5f18554fccc543 method="average" -c output=outputdee9e546defb42b28db4cba654d8604c --overwrite
First pass
0..3..6..9..12..15..18..21..24..27..30..33..36..39..42..45..48..51..54..57..60..63..66..69..72..75..78..81..84..87..90..93..96..99..100
Writing output map
0..3..6..9..12..15..18..21..24..27..30..33..36..39..42..45..48..51..54..57..60..63..66..69..72..75..78..81..84..87..90..93..96..99..100
C:WindowsSystem32>g.region raster=outputdee9e546defb42b28db4cba654d8604c
C:WindowsSystem32>r.out.gdal -t -m input="outputdee9e546defb42b28db4cba654d8604c" output="E:danielgomes2020_paragominasEVIufrj44_ForestStatstestingFlag-c.tif" format="GTiff" createopt="TFW=YES,COMPRESS=LZW" --overwrite
ERROR 6: SetColorTable() only supported for Byte or UInt16 bands in TIFF format.
Checking GDAL data type and nodata value...
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
Using GDAL data type <Float32>
Input raster map contains cells with NULL-value (no-data). The value -1.#IND will be used to represent no-data values in the input map. You can specify a nodata value with the nodata option.
Exporting raster data to GTiff format...
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.out.gdal completo. File <E:danielgomes2020_paragominasEVIufrj44_ForestStatstestingFlag-c.tif> created.
C:WindowsSystem32>exit
Execution of <C:UsersabcAppDataLocalTempprocessing_ldFClygrassdatagrass_batch_job.cmd> finished.
Cleaning up temporary files...
Execution completed in 7.50 seconds
Results:
{'output': 'E:danielgomes2020_paragominasEVIufrj44_ForestStatstestingFlag-c.tif'}

Loading resulting layers
Algorithm 'r.stats.zonal' finished

And this is the log file of one of the 31 images concatenated in the batch mode… all the 31 images had very similar log scripts:

Processing algorithm 1/31…
Algorithm r.stats.zonal starting…
Input parameters:
{'-c': True,
'-r': False,
'GRASS_RASTER_FORMAT_META': '',
'GRASS_RASTER_FORMAT_OPT': '',
'GRASS_REGION_CELLSIZE_PARAMETER': 0.0,
'GRASS_REGION_PARAMETER': None,
'base': '42_rasterizeForestSamples_d4a91097_c6cf_4366_8f56_a5649c1418c5',
'cover': 'E:/danielgomes/2020_paragominasEVIufrj/43_finalImagesBiomassEVI_absDen/LC08_L1TP_223062_20130727_biomassEVIabsDen_mk.tif',
'method': 5,
'output': <QgsProcessingOutputLayerDefinition {'sink':E:/danielgomes/2020_paragominasEVIufrj/44_ForestStats/44a_forestAvrgAgbi/ForestAvrg_20130727_biomassEVI.tif, 'createOptions': {}}>}

g.proj -c proj4="+proj=longlat +datum=WGS84 +no_defs"
r.in.gdal input="E:danielgomes2020_paragominasEVIufrj42_rasterizeForestSamples42_rasterizeForestSamples.tif" band=1 output="rast_5f187dc0f3dad6" --overwrite -o
r.in.gdal input="E:danielgomes2020_paragominasEVIufrj43_finalImagesBiomassEVI_absDenLC08_L1TP_223062_20130727_biomassEVIabsDen_mk.tif" band=1 output="rast_5f187dc10515e7" --overwrite -o
g.region n=-3.1 s=-3.3999535 e=-47.500062 w=-47.9 res=0.0002694999999999992
r.stats.zonal base=rast_5f187dc0f3dad6 cover=rast_5f187dc10515e7 method="average" -c output=output8ee1a5d2a7dd4ce293f381abb742c165 --overwrite
g.region raster=output8ee1a5d2a7dd4ce293f381abb742c165
r.out.gdal -t -m input="output8ee1a5d2a7dd4ce293f381abb742c165" output="E:danielgomes2020_paragominasEVIufrj44_ForestStats44a_forestAvrgAgbiForestAvrg_20130727_biomassEVI.tif" format="GTiff" createopt="TFW=YES,COMPRESS=LZW" --overwrite
Starting GRASS GIS...
ATENÇÃO: Concurrent mapset locking is not supported on Windows
Cleaning up temporary files...
Executing <C:UsersabcAppDataLocalTempprocessing_ldFClygrassdatagrass_batch_job.cmd> ...
C:WindowsSystem32>chcp 1252 1>NUL
C:WindowsSystem32>g.proj -c proj4="+proj=longlat +datum=WGS84 +no_defs"
Default region was updated to the new projection, but if you have multiple mapsets `g.region -d` should be run in each to update the region from the default
Projection information updated
C:WindowsSystem32>r.in.gdal input="E:danielgomes2020_paragominasEVIufrj42_rasterizeForestSamples42_rasterizeForestSamples.tif" band=1 output="rast_5f187dc0f3dad6" --overwrite -o
Se sobrepondo à verificação da projeção
Importing raster map <rast_5f187dc0f3dad6>...
0..3..6..9..12..15..18..21..24..27..30..33..36..39..42..45..48..51..54..57..60..63..66..69..72..75..78..81..84..87..90..93..96..99..100
C:WindowsSystem32>r.in.gdal input="E:danielgomes2020_paragominasEVIufrj43_finalImagesBiomassEVI_absDenLC08_L1TP_223062_20130727_biomassEVIabsDen_mk.tif" band=1 output="rast_5f187dc10515e7" --overwrite -o
Se sobrepondo à verificação da projeção
Importing raster map <rast_5f187dc10515e7>...
0..3..6..9..12..15..18..21..24..27..30..33..36..39..42..45..48..51..54..57..60..63..66..69..72..75..78..81..84..87..90..93..96..99..100
C:WindowsSystem32>g.region n=-3.1 s=-3.3999535 e=-47.500062 w=-47.9 res=0.0002694999999999992
C:WindowsSystem32>r.stats.zonal base=rast_5f187dc0f3dad6 cover=rast_5f187dc10515e7 method="average" -c output=output8ee1a5d2a7dd4ce293f381abb742c165 --overwrite
First pass
0..3..6..9..12..15..18..21..24..27..30..33..36..39..42..45..48..51..54..57..60..63..66..69..72..75..78..81..84..87..90..93..96..99..100
Writing output map
0..3..6..9..12..15..18..21..24..27..30..33..36..39..42..45..48..51..54..57..60..63..66..69..72..75..78..81..84..87..90..93..96..99..100
C:WindowsSystem32>g.region raster=output8ee1a5d2a7dd4ce293f381abb742c165
C:WindowsSystem32>r.out.gdal -t -m input="output8ee1a5d2a7dd4ce293f381abb742c165" output="E:danielgomes2020_paragominasEVIufrj44_ForestStats44a_forestAvrgAgbiForestAvrg_20130727_biomassEVI.tif" format="GTiff" createopt="TFW=YES,COMPRESS=LZW" --overwrite
Traceback (most recent call last):
File "C:/OSGEO4~1/apps/qgis/./python/pluginsprocessingalgsgrass7Grass7Algorithm.py", line 434, in processAlgorithm
Grass7Utils.executeGrass(self.commands, feedback, self.outputCommands)
File "C:/OSGEO4~1/apps/qgis/./python/pluginsprocessingalgsgrass7Grass7Utils.py", line 401, in executeGrass
feedback.reportError(line.strip())
TypeError: reportError() missing 1 required positional argument: 'fatalError'

Algorithm r.stats.zonal failed…
Execution failed after 12.81 seconds

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP