Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#935 closed task (fixed)

[raster] ST_Quantile and ST_ApproxQuantile

Reported by: Bborie Park Owned by: Bborie Park
Priority: medium Milestone: PostGIS 2.0.0
Component: raster Version: master
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])
  1. 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])
  1. ST_Quantile(rast raster, nband int, hasnodata boolean) -> set of records

"quantiles" assumed to be ARRAY[0, 0.25, 0.5, 0.75, 1]

  1. 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]

  1. ST_Quantile(rast raster, quantiles double precision[]) -> set of records

"nband" is assumed to be 1 and "hasnodata" is FALSE

  1. ST_Quantile(rast raster, nband int, quantile double precision) -> record

quantile: the single percentile to compute

  1. ST_Quantile(rast raster, quantile double precision) -> record

"nband" is assumed to be 1

  1. 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])
  1. 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])
  1. 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]

  1. ST_ApproxQuantile(rast raster, sample_percent double precision, quantiles double precision[]) -> set of records

"nband" is assumed to be 1

  1. ST_ApproxQuantile(rast raster, nband int, sample_percent double precision, quantile double precision) -> record

quantile: the single percentile to compute

  1. ST_ApproxQuantile(rast raster, sample_percent double precision, quantile double precision) -> record

"nband" is assumed to be 2

  1. 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]

  1. ST_ApproxQuantile(rast raster, nband int, quantile double precision) -> record

"sample_percent" assumed to be 0.1

  1. ST_ApproxQuantile(rast raster, quantiles double precision[]) -> set of records

"nband" is assumed to be 1 and "sample_percent" assumed to be 0.1

  1. ST_ApproxQuantile(rast raster, quantile double precision) -> record

"nband" assumed to be 1 and "sample_percent" assumed to be 0.1

  1. 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

  1. 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 (1)

st_quantile.patch (25.9 KB ) - added by Bborie Park 13 years ago.
Add ST_Quantile function.

Download all attachments as: .zip

Change History (4)

by Bborie Park, 13 years ago

Attachment: st_quantile.patch added

Add ST_Quantile function.

comment:1 by Bborie Park, 13 years ago

Owner: changed from pracine to Bborie Park
Status: newassigned

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
  1. ST_SummaryStats
  1. ST_Mean
  1. ST_StdDev
  1. ST_MinMax
  1. ST_Histogram

comment:2 by Bborie Park, 13 years ago

Keywords: history added
Resolution: fixed
Status: assignedclosed

Added in r7153

comment:3 by Bborie Park, 13 years ago

Milestone: PostGIS Raster FuturePostGIS 2.0.0
Note: See TracTickets for help on using tickets.