Ticket #932 (closed task: fixed)

Opened 2 years ago

Last modified 2 years ago

[raster] ST_StdDev

Reported by: dustymugs Owned by: dustymugs
Priority: medium Milestone: PostGIS 2.0.0
Component: raster Version: trunk
Keywords: history Cc:

Description

A function to get the standard deviation (or sample deviation if approximating) of a raster's band.

1. ST_StdDev(rast raster, nband int, ignore_nodata boolean) -> double

returns the standard deviation

nband: index of band to process on

ignore_nodata: if TRUE, any pixel who's value is nodata is ignored.

ST_StdDev(rast, 2, TRUE)

2. ST_StdDev(rast raster, nband int) -> double

assumes ignore_nodata = TRUE

ST_StdDev(rast, 2)

3. ST_StdDev(rast raster, ignore_nodata boolean) -> double

assumes band index = 1

ST_StdDev(rast, FALSE)

4. ST_StdDev(rast raster) -> double

assumes band index = 1 and ignore_nodata = TRUE

ST_StdDev(rast)

Four approximation functions are also proposed sacrificing some accuracy for speed, especially on large rasters (10000 x 10000).

1. ST_ApproxStdDev(rast raster, nband int, ignore_nodata boolean, sample_percent double precision) -> double

sample_percent: a value between 0 and 1 indicating the percentage of the raster band's pixels to consider in computing the summary stats.

ST_ApproxStdDev(rast, 3, FALSE, 0.1)

ST_ApproxStdDev(rast, 1, TRUE, 0.5)

2. ST_ApproxStdDev(rast raster, ignore_nodata boolean, sample_percent double precision) -> double

assumes that nband = 1

ST_ApproxStdDev(rast, FALSE, 0.01)

ST_ApproxStdDev(rast, TRUE, 0.025)

3. ST_ApproxStdDev(rast raster, sample_percent double precision) -> double

assumes that nband = 1 and ignore_nodata = TRUE

ST_ApproxStdDev(rast, 0.25)

4. ST_ApproxStdDev(rast raster) -> double

assumes that nband = 1, ignore_nodata = TRUE and sample_percent = 0.1

ST_ApproxStdDev(rast)

Attachments

st_stddev.patch Download (8.0 KB) - added by dustymugs 2 years ago.
Adds ST_StdDev function. ST_SummaryStats is required for this patch.

Change History

Changed 2 years ago by dustymugs

  • status changed from new to assigned

A set of ST_StdDev and ST_ApproxStdDev variations for processing coverages:

1. ST_StdDev(rastertable text, rastercolumn text, nband int, hasnodata boolean) -> double precision

ST_StdDev('tmax_2010', 'rast', 1, FALSE)

ST_StdDev('precip_2011', 'rast', 1, TRUE)

2. ST_StdDev(rastertable text, rastercolumn text, nband int) -> double precision

hasnodata is set to FALSE

ST_StdDev('tmax_2010', 'rast', 1)

3. ST_StdDev(rastertable text, rastercolumn text, hasnodata boolean) -> double precision

nband is set to 1

ST_StdDev('precip_2011', 'rast', TRUE)

4. ST_StdDev(rastertable text, rastercolumn text) -> double precision

nband is set to 1 and hasnodata is set to FALSE

ST_StdDev('tmin_2009', 'rast')

Variations for ST_ApproxStdDev are:

1. ST_ApproxStdDev(rastertable text, rastercolumn text, nband int, hasnodata boolean, sample_percent double precision) -> double precision

ST_ApproxStdDev('tmax_2010', 'rast', 1, FALSE, 0.5)

ST_ApproxStdDev('precip_2011', 'rast', 1, TRUE, 0.2)

2. ST_ApproxStdDev(rastertable text, rastercolumn text, nband int, sample_percent double precision) -> double precision

hasnodata is set to FALSE

ST_ApproxStdDev('tmax_2010', 'rast', 1, 0.5)

ST_ApproxStdDev('precip_2011', 'rast', 1, 0.2)

3. ST_ApproxStdDev(rastertable text, rastercolumn text, hasnodata boolean, sample_percent double precision) -> double precision

nband is set to 1

ST_ApproxStdDev('tmax_2010', 'rast', FALSE, 0.5)

ST_ApproxStdDev('precip_2011', 'rast', TRUE, 0.2)

4. ST_ApproxStdDev(rastertable text, rastercolumn text, sample_percent double precision) -> double precision

nband is set to 1 and hasnodata is set to FALSE

ST_ApproxStdDev('tmax_2010', 'rast', 0.5)

ST_ApproxStdDev('precip_2011', 'rast', 0.2)

5. ST_ApproxStdDev(rastertable text, rastercolumn text) -> double precision

nband is set to 1, hasnodata is set to FALSE and sample_percent is set to 0.1

ST_ApproxStdDev('tmax_2010', 'rast')

ST_ApproxStdDev('precip_2011', 'rast')

The standard deviation returned is the cumulative standard deviation of all raster tiles.

Changed 2 years ago by dustymugs

Adds ST_StdDev function. ST_SummaryStats is required for this patch.

Changed 2 years ago by dustymugs

Adds ST_StdDev function, which builds upon 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

Changed 2 years ago by dustymugs

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

Added in r7150

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.