Opened 17 years ago
Closed 17 years ago
#19 closed enhancement (fixed)
Support for multiple 'percentile' arguments in r.univar
Reported by: | epatton | Owned by: | martinl |
---|---|---|---|
Priority: | minor | Milestone: | 6.4.0 |
Component: | Default | Version: | svn-trunk |
Keywords: | module, raster | Cc: | |
CPU: | Unspecified | Platform: | Unspecified |
Description
I'd like to submit a wish for having r.univar accept multiple percentile arguments as a part of its extended statistics, eg:
r.univar -e map=rast percentile=16,33,50,66,83
Thanks,
~ Eric.
Change History (10)
comment:1 by , 17 years ago
Milestone: | 6.3.0 → 6.4.0 |
---|
comment:2 by , 17 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 17 years ago
Owner: | changed from | to
---|---|
Status: | assigned → new |
comment:4 by , 17 years ago
Keywords: | module raster added |
---|---|
Owner: | changed from | to
Status: | new → assigned |
'Percentile' parameter can be now multiple (also for r3.univar).
http://trac.osgeo.org/grass/changeset/29848
E.g.
r.univar elevation.dem -e per=70,90 ... 1st quartile: 1200 median (odd number of cells): 1316 3rd quartile: 1488 70th percentile: 1447 90th percentile: 1621
Martin
follow-up: 8 comment:5 by , 17 years ago
bug in the last change? r3.univar, rows*cols*depths, not rows*cols:
@@ -111,6 +113,12 @@ map_type = G3d_tileTypeMap(map); - stats = create_univar_stat_struct(map_type, cols * rows * depths); - sscanf(param.percentile->answer, "%i", &stats->perc); + + i = 0; + while(param.percentile->answers[i]) + i++; + stats = create_univar_stat_struct(map_type, cols * rows, i); + for(i = 0; i < stats->n_perc; i++) { + sscanf(param.percentile->answers[i], "%i", &stats->perc[i]); + }
?? Hamish
comment:6 by , 17 years ago
and I'm not sure about this- if the user asks for 25,50,75 then give it to them, even if it is redundant info. It could be used as a verification test of sorts for those....?
stats.c 222 if (stats->perc[i] == 25 || 223 stats->perc[i] == 50 || 224 stats->perc[i] == 75) { 225 /* skip 1st quartile, median, 3rd quartile */ 226 continue; 227 }
Hamish
comment:7 by , 17 years ago
if the user asks for 25,50,75 then give it to them
(my earlier post was meaning you might be able to re-use those values to save calculation time. the danger of adding complexity probably negates that savings though)
Also, any ideas about how to do FP percentiles? see http://article.gmane.org/gmane.comp.gis.grass.user/20744
In particular I am not sure how to solve problem 2.
thanks, Hamish
comment:8 by , 17 years ago
Replying to hamish:
bug in the last change? r3.univar, rows*cols*depths, not rows*cols:
@@ -111,6 +113,12 @@ map_type = G3d_tileTypeMap(map); - stats = create_univar_stat_struct(map_type, cols * rows * depths); - sscanf(param.percentile->answer, "%i", &stats->perc); + + i = 0; + while(param.percentile->answers[i]) + i++; + stats = create_univar_stat_struct(map_type, cols * rows, i); + for(i = 0; i < stats->n_perc; i++) { + sscanf(param.percentile->answers[i], "%i", &stats->perc[i]); + }
sure, sorry, I fixed in trunk now.
Martin
comment:10 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
yes, it would be nice to have that.
note 1st quartile, median, 3rd quartile give 25,50,75% already.
Hamish