Hi grass-users,
Is there a convenient way to find the location of the minimum value in a raster, either as x,y coordinates or as a binary raster (1 = minimum, 0 = other)? I've looked, but haven't found anything obvious.
Regards,
Josh.
Hi grass-users,
Is there a convenient way to find the location of the minimum value in a raster, either as x,y coordinates or as a binary raster (1 = minimum, 0 = other)? I've looked, but haven't found anything obvious.
Regards,
Josh.
Joshua wrote:
Is there a convenient way to find the location of the
minimum value in a raster, either as x,y coordinates or as a
binary raster (1 = minimum, 0 = other)? I've looked, but
haven't found anything obvious.
two steps,
eval `r.info -r data_map` to get min=
r.mapcalc "binary_map = if(data_map == $min, 1, 0)"
or perhaps min from 'r.info -r' and coord(s) from grep'ing
output of 'r.stats -1g'.
perhaps you need to do "abs(data_map - $min) < 0.0000001" for
the equivalence test in r.mapcalc, or some similar awk test
from the printf() formatted output of r.stats.
perhaps you need to do r.buffer from the binary map to make the
single pixel(s) easier to locate.
d.rast with the cat or value list option might quickly do it too,
but a single cell might not visibly render.
Hamish
Hi,
2011/8/3 Hamish <hamish_b@yahoo.com>:
Joshua wrote:
[snip]
two steps,
eval `r.info -r data_map` to get min=
r.mapcalc "binary_map = if(data_map == $min, 1, 0)"or perhaps min from 'r.info -r' and coord(s) from grep'ing
output of 'r.stats -1g'.perhaps you need to do "abs(data_map - $min) < 0.0000001" for
the equivalence test in r.mapcalc, or some similar awk test
from the printf() formatted output of r.stats.perhaps you need to do r.buffer from the binary map to make the
single pixel(s) easier to locate.d.rast with the cat or value list option might quickly do it too,
but a single cell might not visibly render.
Maybe you can convert the resulting raster map into vector points for
visualization and further processing?
Soeren
First make a 2nd copy of your raster
r.info to get the value of minimum.
r.null to null out all the values more than "minValue + 0.01" (depends on
the decimal values in your raster) through to maxValue.
Cheers
Saber
Hi,
2011/8/3 Hamish <hamish_b@yahoo.com>:
Joshua wrote:
[snip]
two steps,
eval `r.info -r data_map` to get min=
r.mapcalc "binary_map = if(data_map == $min, 1, 0)"or perhaps min from 'r.info -r' and coord(s) from grep'ing
output of 'r.stats -1g'.perhaps you need to do "abs(data_map - $min) < 0.0000001" for
the equivalence test in r.mapcalc, or some similar awk test
from the printf() formatted output of r.stats.perhaps you need to do r.buffer from the binary map to make the
single pixel(s) easier to locate.d.rast with the cat or value list option might quickly do it too,
but a single cell might not visibly render.Maybe you can convert the resulting raster map into vector points for
visualization and further processing?Soeren
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
Thanks everyone for the quick responses. I've managed to get what I needed.
I've been trying to improve upon the stochastic modelling of watershed boundaries, as described in the r.stream.basins manual and Metz and Jasiewicz (2011, p. 1167). Instead of using an area as the catchment outlet, I wanted to use the closest point in the extracted streams to where I thought the outlet should be (a known point). Finding the minimum in a raster allowed me to do the distance calculation needed for this.
The finished product – lines are median and 95% confidence intervals for DEM-derived catchment boundary:
http://snorf.net/pub/middleburn/basins_sto.png
Reference:
Jasiewicz, J., Metz, M., (2011). A new GRASS GIS toolkit for Hortonian analysis of drainage networks. Computers & Geosciences. 37. 1162–1173.