[GRASS-user] Alternative to r.median for GRASS 7.x?
Nikos Alexandris
nik at nikosalexandris.net
Fri Jan 26 12:52:23 PST 2018
* Rich Shepard <rshepard at appl-ecosys.com> [2018-01-26 11:12:14 -0800]:
>On Fri, 26 Jan 2018, Nikos Alexandris wrote:
>
>>how can we compute the median of a floating point cover raster map, over a
>>base map (using the conventional terminology as in r.stats.zonal)?
>
>Nikos,
>
> By definition the median value has as many observations/measurements less
>than this value as greater than this value. Because floating point numbers
>are not represented exactly in computers (unless you extend them out to
>several dozen digits to the right of the decimal point), I suggest you
>create a map with integer values that will work for your application.
Something like multiply by * 1000, find the median, then divide by 1000
(as suggested in the past for other modules that don't treat fp
numbers).
> You can find cells with values greater than some number, and less than
>some number but you'll have a difficult time finding that number and getting
>grass (or any application) to recognize it.
>HTH,
Yes it helps.
As for the last comment: do you mean it's going to be computationally
"difficult", as in running time? There are algorithms that handle
this as I read on the net. If floating point numbers of the cover map
that fall inside an area (as per the base map), are treated as a vector,
then sorting the figures will give an answer. Even in case of even
number of numbers, the median can be, practically, the average of the
two middle-placed figures, or select the highest number of the lower
part.
Thank you, Nikos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20180126/8e8a9edb/attachment.sig>
More information about the grass-user
mailing list