I'm running QGIS 2.6.0 and trying to process a 3x3 SAGA Grid Rank filter over multiple rasters. I've not found a lot of documentation on it, but the filter seems to allow you to select a percentile (n, where 0 < n < 100) and assigns to the central pixel of each moving window the estimated nth percentile of values in that 3x3 grid.

My rasters include null pixels. With a little experimenting I've found the filter works ok except where a raster includes a 3x3 grid with a single non-null pixel with 8 null pixels, at which point the process fails. I understand you can't estimate percentiles based on a sample size of one, but I assumed the there would be a provision in the code for cases like this that would result in a null value for the pixel rather than crashing the whole process.

My question is whether I am missing something here so that there is a way to make this tool work, or do I need to look for an alternative solution?

If it helps, below is the log from a processing failure.


library path:   C:/PROGRA~1/QGISBR~1/apps\saga\modules
library name:   grid_filter
module name :   Rank Filter
author      :   O.Conrad (c) 2010

Load grid: C:\Users\beutelt\AppData\Local\Temp\processing\a026098f4a23479ab0aa9e79a3db0f26\Test30.sgrd...




Grid system: 30; 3x 3y; 2014860x -3046100y
Grid: Test30
Filtered Grid: Filtered Grid
Search Mode: Square
Radius: 1
Rank [Percent]: 20.000000

Module caused access violation!

Rank Filter: Module caused access violation!

error: executing module [Rank Filter]

C:\PROGRA~1\QGISBR~1\bin>saga_cmd io_gdal 1 -GRIDS "C:\Users\beutelt\AppData\Local\Temp\processing\54874f152788496eaa5298042ff3de9d\RESULT.tif.sgrd" -FORMAT 1 -TYPE 0 -FILE "C:\Users\beutelt\AppData\Local\Temp\processing\54874f152788496eaa5298042ff3de9d\RESULT.tif"
#####   ##   #####    #####     ###  ########   

library path:   C:/PROGRA~1/QGISBR~1/apps\saga\modules
library name:   io_gdal
module name :   GDAL: Export Raster
author      :   O.Conrad (c) 2007

Load grid: C:\Users\beutelt\AppData\Local\Temp\processing\54874f152788496eaa5298042ff3de9d\RESULT.tif.sgrd...


error: Grid file could not be opened.

error: input file [C:\Users\beutelt\AppData\Local\Temp\processing\54874f152788496eaa5298042ff3de9d\RESULT.tif.sgrd]

error: empty input list [GRIDS]
Usage: 1 -GRIDS <str> [-FILE <str>] [-FORMAT <str>] [-TYPE <str>]
-GRIDS:<str>    Grid(s)
Grid list (input)
-FILE:<str>     File
File path
-FORMAT:<str>   Format
Available Choices:
[0] Virtual Raster
[1] GeoTIFF
[2] National Imagery Transmission Format
[3] Erdas Imagine Images (.img)
[4] ELAS
[5] In Memory Raster
[6] MS Windows Device Independent Bitmap
[7] PCIDSK Database File
[8] ILWIS Raster Map
[9] SGI Image File Format 1.0
[10] Leveller heightfield
[11] Terragen heightfield
[12] ERMapper .ers Labelled
[13] Raster Matrix Format
[14] Idrisi Raster A.1
[15] Intergraph Raster
[16] Golden Software Binary Grid (.grd)
[17] Portable Pixmap Format (netpbm)
[18] ENVI .hdr Labelled
[19] ESRI .hdr Labelled
[20] PCI .aux Labelled
[21] Vexcel MFF Raster
[22] Vexcel MFF2 (HKV) Raster
[23] VTP .bt (Binary Terrain) 1.3 Format
[24] Image Data and Analysis
[25] NOAA Vertical Datum .GTX
[26] NTv2 Datum Grid Shift
[27] ARC Digitized Raster Graphics
[28] SAGA GIS Binary Grid (.sdat)
-TYPE:<str>     Data Type
Available Choices:
[0] match input data
[1] 8 bit unsigned integer
[2] 16 bit unsigned integer
[3] 16 bit signed integer
[4] 32 bit unsigned integer
[5] 32 bit signed integer
[6] 32 bit floating point
[7] 64 bit floating point

error: executing module [GDAL: Export Raster]


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.