Hi Glynn, Thank you very much for your answer!
My question lies precisely in the need to know if a quantile value which falls as the upper limit for one range and the lower limit of the next, should belong to the class anterior or posterior. For example, assuming that r.quantile (with -r flag) gives this result: 2:6:1 6:8:2 8:12:3 12:20:4 20:873:5 the value 6 should belong to the first class or second? Thank you very much Glynn! Best regards, Pedro ----- Original Message ----- From: Glynn Clements Pedro Venâncio wrote: > I have a doubt about using the r.quantile output with r.recode. > > r.quantile returns the upper limit value corresponding to each > class, right? r.quantile calculates quantile values. If you use the -r flag, each value is used as the upper limit for one range and the lower limit of the next. The map's total range sets the lower limit of the first range and the upper limit of the last range. If the number of values is an exact multiple of the number of divisions (e.g. 4 for quantiles, 10 for deciles, etc), the quantile will be one of the input values, otherwise it will be linearly interpolated between two adjacent values. It's possible that there should be a -1 in the calculation; currently, if you calculate the deciles of the 100 distinct values 0-99 inclusive, the results will be 10,20,...,90, so the ranges will be 0-10,10-20,...,90-99. > But r.recode uses r.quantile result as closed interval in the lower > value and open interval in the upper value. r.recode does whatever the Rast_fpreclass_* functions do. Which is to scan the rules from highest to lowest and stop on the first match. So for a value which is on the boundary between ranges, the upper range will be chosen. > But this is not correct. According to quantiles method, the reclassification > should be as follows: > > ]2.000000:6.000000] -> 1 > ]6.000000:8.000000] -> 2 > ]8.000000:12.000000] -> 3 > ]12.000000:20.000000] -> 4 > ]20.000000:872.727295] -> 5 > > or am I wrong? I think that if the number of values is an exact multiple of the number of divisions, r.quantile+r.recode should result in each range having exactly the same number of values. But I'm not sure whether it's r.quantile, r.recode[1] or both which need to be fixed. [1] More precisely, the Rast_fpreclass_* functions. -- Glynn Clements <gl...@gclements.plus.com> _______________________________________________ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user