In QGIS I have a raster map showing land, snow and cloud zones, having resp. pixel values 1, 2, and 3. I extracted the mean altitude values (in m) of each zone on the basis of an underlying DEM and Zonal Statistics of the LecoS (Landscape Ecology Statistics) plugin. The results show in a table like:
On the basis of the mean values of zone 1 and 2, using r.rclass from the Processing Toolbox, I reclassified my zones using this reclass rules text file:
2588 thru 4497 = 1
4498 thru 5122 = 12
5123 thru 7533 = 2
(2588 is the minimum altitude of the DEM, 7533 the maximum altitude).
The result is a new raster map with zones land (1), snow (2) and mixed land-snow pixels (12). This works fine in separate steps and manually preparing the reclass rules text file.
However I have thousands of files to process!
How would it be possible to use the output of the table mean values to automatically populate a reclass rules text file, that can then be directly used in r.reclass?
r.reclass doesn't have an option to import values from an outside table file. I guess I need to write a script for this. I have no experience with scripts so far.