[GIS] Insufficient memory for QGIS Raster Calculator

memoryqgisraster-calculator

I read related posts, but could not find an answer.

I'm trying to perform an operation on two "light" rasters (80mg and 15mg), but get this error over and over.

Any suggestion? This operation worked a month ago.
I tried to use gdal calc, but had some trouble transforming my operation. Before giving it a real try, I wanted to see if I could keep using the raster calculator…

I tried using other tools like r.mapcalc and SAGA Raster Calculator, which both lead to failure too. Can post a log if needed.

I'm using QGIS 2.18.9,
Windows 7, 64bits,
12 gig RAM


I succeeded to perform the task by moving the rasters from our internal server to my desktop, and doing the calculations in a project containing only the rasters (instead of in my previous project with a bunch of other layers).
I'm not sure if QGIS was clugged by the other layers, or if our server could have limited the amount of memory QGIS could use to do the task. While my problem is solved, I would be interrested in your thoughts on the matter, so I can avoid it in the futur?


Here is the GDALINFO output for each layer:

Driver: GTiff/GeoTIFF  
(I removed the path)  
Size is 3000, 3000  
Coordinate System is:  
PROJCS["NAD83_CSRS_MTM_zone_8",  
    GEOGCS["GCS_NAD83(CSRS)",  
        DATUM["NAD83_Canadian_Spatial_Reference_System",  
            SPHEROID["GRS_1980",6378137,298.257222101,  
                AUTHORITY["EPSG","7019"]],  
            AUTHORITY["EPSG","6140"]],  
        PRIMEM["Greenwich",0],  
        UNIT["degree",0.0174532925199433]],  
    PROJECTION["Transverse_Mercator"],  
    PARAMETER["latitude_of_origin",0],  
    PARAMETER["central_meridian",-73.5],  
    PARAMETER["scale_factor",0.9999],  
    PARAMETER["false_easting",304800],  
    PARAMETER["false_northing",0],  
    UNIT["metre",1,  
        AUTHORITY["EPSG","9001"]]]  
Origin = (364568.732900000177324,5037330.085799999535084)  
Pixel Size = (8.228620166666495,-6.177385666666552)  
Metadata:  
  AREA_OR_POINT=Area  
Image Structure Metadata:  
  INTERLEAVE=BAND  
Corner Coordinates:  
Upper Left  (  364568.733, 5037330.086) ( 72d44' 8.04"W, 45d28'24.02"N)  
Lower Left  (  364568.733, 5018797.929) ( 72d44'16.12"W, 45d18'23.72"N)  
Upper Right (  389254.593, 5037330.086) ( 72d25'11.60"W, 45d28'14.84"N)  
Lower Right (  389254.593, 5018797.929) ( 72d25'23.01"W, 45d18'14.60"N)  
Center      (  376911.663, 5028064.007) ( 72d34'44.69"W, 45d23'19.69"N)  
Band 1 Block=3000x1 Type=Float64, ColorInterp=Gray  
  Min=0.000 Max=0.049   
  Minimum=0.000, Maximum=0.049, Mean=0.019, StdDev=0.016  
  Metadata:  
    STATISTICS_MAXIMUM=0.0488345  
    STATISTICS_MEAN=0.018811714654941  
    STATISTICS_MINIMUM=0  
    STATISTICS_STDDEV=0.015860443805575  

And the second one:

Driver: GTiff/GeoTIFF  
Size is 2269, 1653  
Coordinate System is:  
PROJCS["NAD83_CSRS_MTM_zone_8",  
    GEOGCS["GCS_NAD83(CSRS)",  
        DATUM["NAD83_Canadian_Spatial_Reference_System",  
            SPHEROID["GRS_1980",6378137,298.257222101,  
                AUTHORITY["EPSG","7019"]],  
            TOWGS84[0,0,0,0,0,0,0],  
            AUTHORITY["EPSG","6140"]],  
        PRIMEM["Greenwich",0],  
            AUTHORITY["EPSG","8901"]],  
        UNIT["degree",0.0174532925199433]],  
            AUTHORITY["EPSG","9122"]],  
        AUTHORITY["EPSG","4617"]],  
    PROJECTION["Transverse_Mercator"],  
    PARAMETER["latitude_of_origin",0],  
    PARAMETER["central_meridian",-73.5],  
    PARAMETER["scale_factor",0.9999],  
    PARAMETER["false_easting",304800],  
    PARAMETER["false_northing",0],  
    UNIT["metre",1,  
        AUTHORITY["EPSG","9001"]]]  
    AXIS["E(X)",EAST],  
    AXIS["N(Y)",NORTH],  
    AUTHORITY["EPSG","2950"]]  
Origin = (365568.732934501371346,5036330.085800826549530)  
Pixel Size = (10.000297359099999,-10.000301976399999)  
Metadata:  
  AREA_OR_POINT=Area  
Image Structure Metadata:  
  INTERLEAVE=BAND  
Corner Coordinates:  
Upper Left  (  365568.733, 5036330.086) ( 72d43'22.45"W, 45d27'51.32"N)  
Lower Left  (  365568.733, 5019799.587) ( 72d43'29.78"W, 45d18'55.86"N)  
Upper Right (  388259.408, 5036330.086) ( 72d25'58.02"W, 45d27'42.89"N)  
Lower Right (  388259.408, 5019799.587) ( 72d26' 8.08"W, 45d18'47.47"N)  
Center      (  376914.070, 5028064.836) ( 72d34'44.57"W, 45d23'19.72"N)  
Band 1 Block=2269x1 Type=Float32, ColorInterp=Gray  
    NoData Value=-3.40282306073709653e+38  

Best Answer

I believe the memory failure error occurs because of the first raster format that is float64: "Band 1 Block = 3000x1 Type = Float64, ColorInterp = Gray".

The difference between different types of numbers: https://docs.scipy.org/doc/numpy-1.13.0/user/basics.types.html

float32 Single precision float: sign bit, 8 bits exponent, 23 bits mantissa

float64 Double precision float: sign bit, 11 bits exponent, 52 bits mantissa

There are many possibilities to be calculated, so there is insufficient memory. In most cases 8 (0-255) or 16 bits (0-65656) are sufficient.

Related Question