Re: Alternative to r.median for GRASS 7.x?
Nikos Alexandris <[email protected]>
| Newsgroups | gmane.comp.gis.grass.user |
|---|---|
| Message-ID | <[email protected]> |
* Rich Shepard <[email protected]> [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 _______________________________________________ grass-user mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/grass-user
signature.asc
(application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE----- iHUEAREKAB0WIQRvnUUG88ooOAl00xqQU1NLaTxPswUCWmuVBgAKCRCQU1NLaTxP swQdAQC0bAUc9Jj1pdOKxsKeWS5iTKb/U3MIOZp1h9a5MzALkgD9Gkmrent0OqLI mqnI+2Zrlp78rF/JUfnu8frTGVVy+/M= =djzk -----END PGP SIGNATURE-----