Raster reclassify using python, gdal and numpy

المشرف العام

Administrator
طاقم الإدارة
I would like to reclassify a raster file from a raster with 10 classes to a raster with 8 classes using pyhton, gdal and/or numpy. The classes are represented as integers. I have tried following the steps from this post Reclassify rasters using GDAL and Python , the numpy.equal doc and also gdal_calc doc. However, to no avail.

The raster file to be reclassified has integer values ranging from 0 to 11 and also include values 100 and 255. The following show the reclass (from value : to value):

nodata : 4,0 : 4,1 : 1,2 : 2,3 : 3,4 : 3,5 : 4,6 : 5,7 : 5,8 : 6,9 : 7,10 : 8,100 : nodata,255 : nodata,

What I have been able to do is select the raster file to be reclassified using tkinter.FileDialog and get the raster info such as geotransform, and pixel size with reclass = gdal.Open(raster, GA_ReadOnly).

How do I go about solving the above.

It might be worth mentioning that the rasters to be reclassified can be fairly large in some cases (500mb to 5gb).



أكثر...
 
أعلى