Ticket #935 (closed task: fixed)

Opened 2 years ago

Last modified 2 years ago

[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

Attachments

st_quantile.patch Download (25.9 KB) - added by dustymugs 2 years ago.
Add ST_Quantile function.

Change History

Changed 2 years ago by dustymugs

Add ST_Quantile function.

Changed 2 years ago by dustymugs

  • owner changed from pracine to dustymugs
  • status changed from new to assigned

Adds ST_Quantile function, which requires ST_SummaryStats. Merges cleanly against r7145.

The following patches must be merged first for this patch to merge cleanly:

1. ST_Band

2. ST_SummaryStats

3. ST_Mean

4. ST_StdDev

5. ST_MinMax

6. ST_Histogram

Changed 2 years ago by dustymugs

  • keywords history added
  • status changed from assigned to closed
  • resolution set to fixed

Added in r7153

Changed 2 years ago by dustymugs

  • milestone changed from PostGIS Raster Future to PostGIS 2.0.0
Note: See TracTickets for help on using tickets.