0

I have below rasters:

  1. One with dimension (13646, 7510) where INTEGER pixel values ranges from 0-14.

  2. One with dimension (13646, 7510) where DOUBLE (upto 10 decimal places) pixel values ranges from 0-181257.

I can easily read 1 with RasterToNumPyArray but when I try to read second raster exception raised as below:

return _RasterToNumPyArray(*args, **kwargs)

MemoryError:

I tried with scipy.misc it also gives me error for 2 but reads well 1. I have some problem with GDAL since, I think, I have installed OSGEO64 while I am using Python 2.7 32 bit. So I want to avoid GDAL.

Now what is the way to read 2 in arcpy. I am using rasterio in virtual environment now and I want to get rid of the mess of using virtual environment.

My machine details:

details

4
  • 2
    To do so you need over 1 GB of memory , obviously you don't have it or cannot access
    – FelixIP
    Commented Nov 18, 2016 at 4:33
  • Ahh! but I think I have that resources in my machine?
    – Learner
    Commented Nov 18, 2016 at 4:43
  • 3
    Raster pixel size is generally described in bits; "INTEGER" could refer to anything from 1-, 4-, 8- 13-, 16-, 32-, to 64-bit, which makes it difficult to gauge how much RAM the working raster requires. You state you're using a 32-bit Python, which is your issue -- It generally only has 1.2Gb of heap available to reference all objects.
    – Vince
    Commented Nov 18, 2016 at 11:41
  • @Vince I think you should copy/paste that comment as an answer.
    – PolyGeo
    Commented Jan 23, 2017 at 4:17

1 Answer 1

2

Raster pixel size is generally described in bits; "INTEGER" could refer to anything from 1-, 4-, 8- 13-, 16-, 32-, to 64-bit, which makes it difficult to gauge how much RAM the working raster requires. You state you're using a 32-bit Python, which is your issue -- It generally only has 1.2Gb of heap available to reference all objects (including the Python language itself).

An image with dimensions 13646 x 7510 has 102,481,460 pixels. With 64-bit depth (IEEE "double" size), the contiguous memory required is 819,851,680 bytes (~782 Mb). While this is a trivial amount of addressable space in a 64-bit application, it represents 2/3 of the heap in a 32-bit application, so even if you were able to allocate it, it's unlikely you'd be able to manipulate it without generating a memory error.

As a rule, memory errors are encountered due to 32-bit application use (the problem confounds solution in the addressable space). The solution is to use a 64-bit application framework. If you run out of memory with a 64-bit application, then it's a coding issue (somebody hasn't thought through the task well enough).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.