Ticket #935 (closed task: fixed)
[raster] ST_Quantile and ST_ApproxQuantile
| Reported by: | dustymugs | Owned by: | dustymugs |
|---|---|---|---|
| Priority: | medium | Milestone: | PostGIS 2.0.0 |
| Component: | raster | Version: | trunk |
| Keywords: | history | Cc: |
Description
In addition to determining the histogram of a raster, providing the ability to compute quantiles permits a user to reference a value in the context of the sample or population. Thus, a value could be examined to be at the raster's 25%, 50%, 75% percentile.
http://en.wikipedia.org/wiki/Quantile
ST_Quantile variations:
1. ST_Quantile(rast raster, nband int, hasnodata boolean, quantiles double precision[]) -> set of records
nband: index of band to process on
hasnodata: if FALSE, any pixel who's value is nodata is ignored.
quantiles: array of percentages to compute values for
ST_Quantile(rast, 1, FALSE, ARRAY[0.1, 0.3, 0.7]) ST_Quantile(rast, 1, TRUE, ARRAY[0.2]) ST_Quantile(rast, 1, FALSE, ARRAY[0, 1])
2. ST_Quantile(rast raster, nband int, quantiles double precision[]) -> set of records
"hasnodata" is assumed to be FALSE
ST_Quantile(rast, 1, ARRAY[0.1, 0.3, 0.7])
3. ST_Quantile(rast raster, nband int, hasnodata boolean) -> set of records
"quantiles" assumed to be ARRAY[0, 0.25, 0.5, 0.75, 1]
4. ST_Quantile(rast raster, nband int) -> set of records
"hasnodata" is assumed to be FALSE and "quantiles" assumed to be ARRAY[0, 0.25, 0.5, 0.75, 1]
5. ST_Quantile(rast raster, quantiles double precision[]) -> set of records
"nband" is assumed to be 1 and "hasnodata" is FALSE
6. ST_Quantile(rast raster, nband int, quantile double precision) -> record
quantile: the single percentile to compute
7. ST_Quantile(rast raster, quantile double precision) -> record
"nband" is assumed to be 1
8. ST_Quantile(rast raster) -> set of records
"nband" is assumed to be 1 and "quantiles" assumed to be ARRAY[0, 0.25, 0.5, 0.75, 1]
ST_ApproxQuantile adds a "sample_percent" indicating the percentage of the raster to sample
1. ST_ApproxQuantile(rast raster, nband int, hasnodata boolean, sample_percent double precision, quantiles double precision[]) -> set of records
nband: index of band to process on
hasnodata: if FALSE, any pixel who's value is nodata is ignored
sample_percent: a value between 0 and 1 indicating the percentage of the raster band's pixels to consider when computing the quantiles
quantiles: array of percentages to compute values for
ST_ApproxQuantile(rast, 1, FALSE, 0.1, ARRAY[0.1, 0.3, 0.7]) ST_ApproxQuantile(rast, 1, TRUE, .2, ARRAY[0.2]) ST_ApproxQuantile(rast, 1, FALSE, 0.3, ARRAY[0, 1])
2. ST_ApproxQuantile(rast raster, nband int, sample_percent double precision, quantiles double precision[]) -> set of records
"hasnodata" is assumed to be FALSE
ST_ApproxQuantile(rast, 1, .05, ARRAY[0.1, 0.3, 0.7])
3. ST_ApproxQuantile(rast raster, nband int, sample_percent double precision) -> set of records
"hasnodata" is assumed to be FALSE and "quantiles" assumed to be ARRAY[0, 0.25, 0.5, 0.75, 1]
4. ST_ApproxQuantile(rast raster, sample_percent double precision, quantiles double precision[]) -> set of records
"nband" is assumed to be 1
5. ST_ApproxQuantile(rast raster, nband int, sample_percent double precision, quantile double precision) -> record
quantile: the single percentile to compute
6. ST_ApproxQuantile(rast raster, sample_percent double precision, quantile double precision) -> record
"nband" is assumed to be 2
7. ST_ApproxQuantile(rast raster, sample_percent double precision) -> set of records
"nband" is assumed to be 1 and "quantiles" assumed to be ARRAY[0, 0.25, 0.5, 0.75, 1]
8. ST_ApproxQuantile(rast raster, nband int, quantile double precision) -> record
"sample_percent" assumed to be 0.1
9. ST_ApproxQuantile(rast raster, quantiles double precision[]) -> set of records
"nband" is assumed to be 1 and "sample_percent" assumed to be 0.1
10. ST_ApproxQuantile(rast raster, quantile double precision) -> record
"nband" assumed to be 1 and "sample_percent" assumed to be 0.1
11. ST_ApproxQuantile(rast raster, nband int) -> set of records
"quantiles" assumed to be ARRAY[0, 0.25, 0.5, 0.75, 1] and "sample_percent" assumed to be 0.1
12. ST_ApproxQuantile(rast raster) -> set of records
"nband" is assumed to be 1, "quantiles" assumed to be ARRAY[0, 0.25, 0.5, 0.75, 1] and "sample_percent" assumed to be 0.1

