From: Bborie Park Date: Mon, 30 May 2011 14:53:11 +0000 (+0000) Subject: renamed all instances of "hasnodata" function argument to "exclude_nodata_value"... X-Git-Tag: 2.0.0alpha1~1520 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=87502fbee80fac3f46b50b3595e5addaf8e4932a;p=postgis renamed all instances of "hasnodata" function argument to "exclude_nodata_value" in SQL functions (and underlying code where appropriate) ST_SummaryStats, ST_Count, ST_Sum, ST_Mean, ST_StdDev, ST_MinMax, ST_Quantile, ST_Histogram, ST_ValueCount and ST_ValuePercent git-svn-id: http://svn.osgeo.org/postgis/trunk@7294 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/raster/rt_core/rt_api.c b/raster/rt_core/rt_api.c index 3a0df7e3c..09d5d3eab 100644 --- a/raster/rt_core/rt_api.c +++ b/raster/rt_core/rt_api.c @@ -1501,14 +1501,14 @@ struct rt_bandstats_t { * Compute summary statistics for a band * * @param band: the band to query for summary stats - * @param hasnodata: if non-zero, ignore nodata values + * @param exclude_nodata_value: if non-zero, ignore nodata values * @param sample: percentage of pixels to sample * @param inc_vals: flag to include values in return struct * * @return the summary statistics for a band */ rt_bandstats -rt_band_get_summary_stats(rt_band band, int hasnodata, double sample, +rt_band_get_summary_stats(rt_band band, int exclude_nodata_value, double sample, int inc_vals) { uint8_t *data = NULL; uint32_t x = 0; @@ -1517,7 +1517,7 @@ rt_band_get_summary_stats(rt_band band, int hasnodata, double sample, uint32_t offset = 0; uint32_t diff = 0; int rtn; - int hasnodata_flag = FALSE; + int hasnodata = FALSE; double nodata = 0; double *values = NULL; double value; @@ -1556,19 +1556,19 @@ rt_band_get_summary_stats(rt_band band, int hasnodata, double sample, data = rt_band_get_data(band); - hasnodata_flag = rt_band_get_hasnodata_flag(band); - if (hasnodata_flag != FALSE) + hasnodata = rt_band_get_hasnodata_flag(band); + if (hasnodata != FALSE) nodata = rt_band_get_nodata(band); else - hasnodata = 0; + exclude_nodata_value = 0; RASTER_DEBUGF(3, "nodata = %f", nodata); - RASTER_DEBUGF(3, "hasnodata_flag = %d", hasnodata_flag); - RASTER_DEBUGF(3, "user hasnodata = %d", hasnodata); + RASTER_DEBUGF(3, "hasnodata = %d", hasnodata); + RASTER_DEBUGF(3, "exclude_nodata_value = %d", exclude_nodata_value); /* entire band is nodata */ if (rt_band_get_isnodata_flag(band) != FALSE) { - if (hasnodata) { + if (exclude_nodata_value) { rtwarn("All pixels of band have the NODATA value"); return NULL; } @@ -1666,9 +1666,9 @@ rt_band_get_summary_stats(rt_band band, int hasnodata, double sample, j++; if (rtn != -1) { if ( - !hasnodata || ( - hasnodata && - (hasnodata_flag != FALSE) && + !exclude_nodata_value || ( + exclude_nodata_value && + (hasnodata != FALSE) && (fabs(value - nodata) > FLT_EPSILON) ) ) { @@ -2153,7 +2153,7 @@ struct rt_valuecount_t { * the band * * @param band: the band to query for minimum and maximum pixel values - * @param hasnodata: if non-zero, ignore nodata values + * @param exclude_nodata_value: if non-zero, ignore nodata values * @param search_values: array of values to count * @param search_values_count: the number of search values * @param roundto: the decimal place to round the values to @@ -2162,13 +2162,13 @@ struct rt_valuecount_t { * @return the default set of or requested quantiles for a band */ rt_valuecount -rt_band_get_value_count(rt_band band, int hasnodata, +rt_band_get_value_count(rt_band band, int exclude_nodata_value, double *search_values, uint32_t search_values_count, double roundto, int *rtn_count) { rt_valuecount vcnts = NULL; rt_pixtype pixtype = PT_END; uint8_t *data = NULL; - int hasnodata_flag = FALSE; + int hasnodata = FALSE; double nodata = 0; int scale = 0; @@ -2205,15 +2205,15 @@ rt_band_get_value_count(rt_band band, int hasnodata, data = rt_band_get_data(band); pixtype = band->pixtype; - hasnodata_flag = rt_band_get_hasnodata_flag(band); - if (hasnodata_flag != FALSE) + hasnodata = rt_band_get_hasnodata_flag(band); + if (hasnodata != FALSE) nodata = rt_band_get_nodata(band); else - hasnodata = 0; + exclude_nodata_value = 0; RASTER_DEBUGF(3, "nodata = %f", nodata); - RASTER_DEBUGF(3, "hasnodata_flag = %d", hasnodata_flag); - RASTER_DEBUGF(3, "user hasnodata = %d", hasnodata); + RASTER_DEBUGF(3, "hasnodata = %d", hasnodata); + RASTER_DEBUGF(3, "exclude_nodata_value = %d", exclude_nodata_value); /* process roundto */ if (roundto < 0 || (fabs(roundto - 0.0) < FLT_EPSILON)) { @@ -2290,7 +2290,7 @@ rt_band_get_value_count(rt_band band, int hasnodata, /* entire band is nodata */ if (rt_band_get_isnodata_flag(band) != FALSE) { - if (hasnodata) { + if (exclude_nodata_value) { rtwarn("All pixels of band have the NODATA value"); return NULL; } @@ -2340,9 +2340,9 @@ rt_band_get_value_count(rt_band band, int hasnodata, if (rtn == -1) continue; if ( - !hasnodata || ( - hasnodata && - (hasnodata_flag != FALSE) && + !exclude_nodata_value || ( + exclude_nodata_value && + (hasnodata != FALSE) && (fabs(pxlval - nodata) > FLT_EPSILON) ) ) { diff --git a/raster/rt_core/rt_api.h b/raster/rt_core/rt_api.h index b07926281..9036a2364 100644 --- a/raster/rt_core/rt_api.h +++ b/raster/rt_core/rt_api.h @@ -451,14 +451,14 @@ int rt_band_check_is_nodata(rt_band band); * Compute summary statistics for a band * * @param band: the band to query for summary stats - * @param hasnodata: if non-zero, ignore nodata values + * @param exclude_nodata_value: if non-zero, ignore nodata values * @param sample: percentage of pixels to sample * @param inc_vals: flag to include values in return struct * * @return the summary statistics for a band */ typedef struct rt_bandstats_t* rt_bandstats; -rt_bandstats rt_band_get_summary_stats(rt_band band, int hasnodata, +rt_bandstats rt_band_get_summary_stats(rt_band band, int exclude_nodata_value, double sample, int inc_vals); /** @@ -498,7 +498,7 @@ rt_quantile rt_band_get_quantiles(rt_bandstats stats, * the band * * @param band: the band to query for minimum and maximum pixel values - * @param hasnodata: if non-zero, ignore nodata values + * @param exclude_nodata_value: if non-zero, ignore nodata values * @param search_values: array of values to count * @param search_values_count: the number of search values * @param roundto: the decimal place to round the values to @@ -507,7 +507,7 @@ rt_quantile rt_band_get_quantiles(rt_bandstats stats, * @return the default set of or requested quantiles for a band */ typedef struct rt_valuecount_t* rt_valuecount; -rt_valuecount rt_band_get_value_count(rt_band band, int hasnodata, +rt_valuecount rt_band_get_value_count(rt_band band, int exclude_nodata_value, double *search_values, uint32_t search_values_count, double roundto, int *rtn_count); diff --git a/raster/rt_pg/rt_pg.c b/raster/rt_pg/rt_pg.c index 830eaee4b..693697e78 100644 --- a/raster/rt_pg/rt_pg.c +++ b/raster/rt_pg/rt_pg.c @@ -2939,7 +2939,7 @@ Datum RASTER_summaryStats(PG_FUNCTION_ARGS) rt_raster raster = NULL; rt_band band = NULL; int32_t bandindex = 0; - bool hasnodata = TRUE; + bool exclude_nodata_value = TRUE; int num_bands = 0; double sample = 0; rt_bandstats stats = NULL; @@ -2971,9 +2971,9 @@ Datum RASTER_summaryStats(PG_FUNCTION_ARGS) } assert(0 <= (bandindex - 1)); - /* hasnodata flag */ + /* exclude_nodata_value flag */ if (!PG_ARGISNULL(2)) - hasnodata = PG_GETARG_BOOL(2); + exclude_nodata_value = PG_GETARG_BOOL(2); /* sample % */ if (!PG_ARGISNULL(3)) { @@ -2998,7 +2998,7 @@ Datum RASTER_summaryStats(PG_FUNCTION_ARGS) } /* we don't need the raw values, hence the zero parameter */ - stats = rt_band_get_summary_stats(band, (int) hasnodata, sample, 0); + stats = rt_band_get_summary_stats(band, (int) exclude_nodata_value, sample, 0); rt_band_destroy(band); rt_raster_destroy(raster); if (NULL == stats) { @@ -3130,7 +3130,7 @@ Datum RASTER_histogram(PG_FUNCTION_ARGS) rt_band band = NULL; int32_t bandindex = 0; int num_bands = 0; - bool hasnodata = TRUE; + bool exclude_nodata_value = TRUE; double sample = 0; int bin_count = 0; double *bin_width = NULL; @@ -3180,9 +3180,9 @@ Datum RASTER_histogram(PG_FUNCTION_ARGS) } assert(0 <= (bandindex - 1)); - /* hasnodata flag */ + /* exclude_nodata_value flag */ if (!PG_ARGISNULL(2)) - hasnodata = PG_GETARG_BOOL(2); + exclude_nodata_value = PG_GETARG_BOOL(2); /* sample % */ if (!PG_ARGISNULL(3)) { @@ -3273,7 +3273,7 @@ Datum RASTER_histogram(PG_FUNCTION_ARGS) } /* get stats */ - stats = rt_band_get_summary_stats(band, (int) hasnodata, sample, 1); + stats = rt_band_get_summary_stats(band, (int) exclude_nodata_value, sample, 1); rt_band_destroy(band); rt_raster_destroy(raster); if (NULL == stats || NULL == stats->values) { @@ -3424,7 +3424,7 @@ Datum RASTER_quantile(PG_FUNCTION_ARGS) rt_band band = NULL; int32_t bandindex = 0; int num_bands = 0; - bool hasnodata = TRUE; + bool exclude_nodata_value = TRUE; double sample = 0; double *quantiles = NULL; int quantiles_count = 0; @@ -3472,9 +3472,9 @@ Datum RASTER_quantile(PG_FUNCTION_ARGS) } assert(0 <= (bandindex - 1)); - /* hasnodata flag */ + /* exclude_nodata_value flag */ if (!PG_ARGISNULL(2)) - hasnodata = PG_GETARG_BOOL(2); + exclude_nodata_value = PG_GETARG_BOOL(2); /* sample % */ if (!PG_ARGISNULL(3)) { @@ -3555,7 +3555,7 @@ Datum RASTER_quantile(PG_FUNCTION_ARGS) } /* get stats */ - stats = rt_band_get_summary_stats(band, (int) hasnodata, sample, 1); + stats = rt_band_get_summary_stats(band, (int) exclude_nodata_value, sample, 1); rt_band_destroy(band); rt_raster_destroy(raster); if (NULL == stats || NULL == stats->values) { @@ -3687,7 +3687,7 @@ Datum RASTER_valueCount(PG_FUNCTION_ARGS) { rt_band band = NULL; int32_t bandindex = 0; int num_bands = 0; - bool hasnodata = TRUE; + bool exclude_nodata_value = TRUE; double *search_values = NULL; int search_values_count = 0; double roundto = 0; @@ -3733,9 +3733,9 @@ Datum RASTER_valueCount(PG_FUNCTION_ARGS) { } assert(0 <= (bandindex - 1)); - /* hasnodata flag */ + /* exclude_nodata_value flag */ if (!PG_ARGISNULL(2)) - hasnodata = PG_GETARG_BOOL(2); + exclude_nodata_value = PG_GETARG_BOOL(2); /* search values */ if (!PG_ARGISNULL(3)) { @@ -3800,7 +3800,7 @@ Datum RASTER_valueCount(PG_FUNCTION_ARGS) { } /* get counts of values */ - vcnts = rt_band_get_value_count(band, (int) hasnodata, search_values, search_values_count, roundto, &count); + vcnts = rt_band_get_value_count(band, (int) exclude_nodata_value, search_values, search_values_count, roundto, &count); rt_band_destroy(band); rt_raster_destroy(raster); if (NULL == vcnts || !count) { diff --git a/raster/rt_pg/rtpostgis.sql.in.c b/raster/rt_pg/rtpostgis.sql.in.c index 3ed8fd819..16d4683de 100644 --- a/raster/rt_pg/rtpostgis.sql.in.c +++ b/raster/rt_pg/rtpostgis.sql.in.c @@ -260,17 +260,17 @@ CREATE TYPE summarystats AS ( max double precision ); -CREATE OR REPLACE FUNCTION st_summarystats(rast raster, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE, sample_percent double precision DEFAULT 1) +CREATE OR REPLACE FUNCTION st_summarystats(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 1) RETURNS summarystats AS 'MODULE_PATHNAME','RASTER_summaryStats' LANGUAGE 'C' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_summarystats(rast raster, hasnodata boolean) +CREATE OR REPLACE FUNCTION st_summarystats(rast raster, exclude_nodata_value boolean) RETURNS summarystats AS $$ SELECT count, sum, mean, stddev, min, max FROM st_summarystats($1, 1, $2, 1) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxsummarystats(rast raster, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) +CREATE OR REPLACE FUNCTION st_approxsummarystats(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) RETURNS summarystats AS $$ SELECT count, sum, mean, stddev, min, max FROM st_summarystats($1, $2, $3, $4) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; @@ -280,7 +280,7 @@ CREATE OR REPLACE FUNCTION st_approxsummarystats(rast raster, nband int, sample_ AS $$ SELECT count, sum, mean, stddev, min, max FROM st_summarystats($1, $2, TRUE, $3) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxsummarystats(rast raster, hasnodata boolean, sample_percent double precision DEFAULT 0.1) +CREATE OR REPLACE FUNCTION st_approxsummarystats(rast raster, exclude_nodata_value boolean, sample_percent double precision DEFAULT 0.1) RETURNS summarystats AS $$ SELECT count, sum, mean, stddev, min, max FROM st_summarystats($1, 1, $2, $3) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; @@ -290,7 +290,7 @@ CREATE OR REPLACE FUNCTION st_approxsummarystats(rast raster, sample_percent dou AS $$ SELECT count, sum, mean, stddev, min, max FROM st_summarystats($1, 1, TRUE, $2) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_summarystats(rastertable text, rastercolumn text, nband integer DEFAULT 1, hasnodata boolean DEFAULT TRUE, sample_percent double precision DEFAULT 1) +CREATE OR REPLACE FUNCTION st_summarystats(rastertable text, rastercolumn text, nband integer DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 1) RETURNS summarystats AS $$ DECLARE @@ -343,7 +343,7 @@ CREATE OR REPLACE FUNCTION st_summarystats(rastertable text, rastercolumn text, FETCH curs INTO rast; EXIT WHEN NOT FOUND; - SELECT count, sum, mean, stddev, min, max FROM st_summarystats(rast, nband, hasnodata, sample_percent) INTO stats; + SELECT count, sum, mean, stddev, min, max FROM st_summarystats(rast, nband, exclude_nodata_value, sample_percent) INTO stats; IF stats IS NULL OR stats.count < 1 THEN CONTINUE; END IF; @@ -388,12 +388,12 @@ CREATE OR REPLACE FUNCTION st_summarystats(rastertable text, rastercolumn text, END; $$ LANGUAGE 'plpgsql' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_summarystats(rastertable text, rastercolumn text, hasnodata boolean) +CREATE OR REPLACE FUNCTION st_summarystats(rastertable text, rastercolumn text, exclude_nodata_value boolean) RETURNS summarystats AS $$ SELECT count, sum, mean, stddev, min, max FROM st_summarystats($1, $2, 1, $3, 1) $$ LANGUAGE 'SQL' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxsummarystats(rastertable text, rastercolumn text, nband integer DEFAULT 1, hasnodata boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) +CREATE OR REPLACE FUNCTION st_approxsummarystats(rastertable text, rastercolumn text, nband integer DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) RETURNS summarystats AS $$ SELECT count, sum, mean, stddev, min, max FROM st_summarystats($1, $2, $3, $4, $5) $$ LANGUAGE 'SQL' STABLE STRICT; @@ -403,7 +403,7 @@ CREATE OR REPLACE FUNCTION st_approxsummarystats(rastertable text, rastercolumn AS $$ SELECT count, sum, mean, stddev, min, max FROM st_summarystats($1, $2, $3, TRUE, $4) $$ LANGUAGE 'SQL' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxsummarystats(rastertable text, rastercolumn text, hasnodata boolean) +CREATE OR REPLACE FUNCTION st_approxsummarystats(rastertable text, rastercolumn text, exclude_nodata_value boolean) RETURNS summarystats AS $$ SELECT count, sum, mean, stddev, min, max FROM st_summarystats($1, $2, 1, $3, 0.1) $$ LANGUAGE 'SQL' STABLE STRICT; @@ -416,17 +416,17 @@ CREATE OR REPLACE FUNCTION st_approxsummarystats(rastertable text, rastercolumn ----------------------------------------------------------------------- -- ST_Count and ST_ApproxCount ----------------------------------------------------------------------- -CREATE OR REPLACE FUNCTION st_count(rast raster, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE) +CREATE OR REPLACE FUNCTION st_count(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE) RETURNS bigint AS $$ SELECT count FROM st_summarystats($1, $2, $3, 1) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_count(rast raster, hasnodata boolean) +CREATE OR REPLACE FUNCTION st_count(rast raster, exclude_nodata_value boolean) RETURNS bigint AS $$ SELECT count FROM st_summarystats($1, 1, $2, 1) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxcount(rast raster, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) +CREATE OR REPLACE FUNCTION st_approxcount(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) RETURNS bigint AS $$ SELECT count FROM st_summarystats($1, $2, $3, $4) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; @@ -436,7 +436,7 @@ CREATE OR REPLACE FUNCTION st_approxcount(rast raster, nband int, sample_percent AS $$ SELECT count FROM st_summarystats($1, $2, TRUE, $3) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxcount(rast raster, hasnodata boolean, sample_percent double precision DEFAULT 0.1) +CREATE OR REPLACE FUNCTION st_approxcount(rast raster, exclude_nodata_value boolean, sample_percent double precision DEFAULT 0.1) RETURNS bigint AS $$ SELECT count FROM st_summarystats($1, 1, $2, $3) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; @@ -446,17 +446,17 @@ CREATE OR REPLACE FUNCTION st_approxcount(rast raster, sample_percent double pre AS $$ SELECT count FROM st_summarystats($1, 1, TRUE, $2) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_count(rastertable text, rastercolumn text, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE) +CREATE OR REPLACE FUNCTION st_count(rastertable text, rastercolumn text, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE) RETURNS bigint AS $$ SELECT count FROM st_summarystats($1, $2, $3, $4, 1) $$ LANGUAGE 'SQL' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_count(rastertable text, rastercolumn text, hasnodata boolean) +CREATE OR REPLACE FUNCTION st_count(rastertable text, rastercolumn text, exclude_nodata_value boolean) RETURNS bigint AS $$ SELECT count FROM st_summarystats($1, $2, 1, $3, 1) $$ LANGUAGE 'SQL' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxcount(rastertable text, rastercolumn text, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) +CREATE OR REPLACE FUNCTION st_approxcount(rastertable text, rastercolumn text, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) RETURNS bigint AS $$ SELECT count FROM st_summarystats($1, $2, $3, $4, $5) $$ LANGUAGE 'SQL' STABLE STRICT; @@ -466,7 +466,7 @@ CREATE OR REPLACE FUNCTION st_approxcount(rastertable text, rastercolumn text, n AS $$ SELECT count FROM st_summarystats($1, $2, $3, TRUE, $4) $$ LANGUAGE 'SQL' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxcount(rastertable text, rastercolumn text, hasnodata boolean, sample_percent double precision DEFAULT 0.1) +CREATE OR REPLACE FUNCTION st_approxcount(rastertable text, rastercolumn text, exclude_nodata_value boolean, sample_percent double precision DEFAULT 0.1) RETURNS bigint AS $$ SELECT count FROM st_summarystats($1, $2, 1, $3, $4) $$ LANGUAGE 'SQL' STABLE STRICT; @@ -479,17 +479,17 @@ CREATE OR REPLACE FUNCTION st_approxcount(rastertable text, rastercolumn text, s ----------------------------------------------------------------------- -- ST_Sum and ST_ApproxSum ----------------------------------------------------------------------- -CREATE OR REPLACE FUNCTION st_sum(rast raster, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE) +CREATE OR REPLACE FUNCTION st_sum(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE) RETURNS double precision AS $$ SELECT sum FROM st_summarystats($1, $2, $3, 1) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_sum(rast raster, hasnodata boolean) +CREATE OR REPLACE FUNCTION st_sum(rast raster, exclude_nodata_value boolean) RETURNS double precision AS $$ SELECT sum FROM st_summarystats($1, 1, $2, 1) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxsum(rast raster, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) +CREATE OR REPLACE FUNCTION st_approxsum(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) RETURNS double precision AS $$ SELECT sum FROM st_summarystats($1, $2, $3, $4) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; @@ -499,7 +499,7 @@ CREATE OR REPLACE FUNCTION st_approxsum(rast raster, nband int, sample_percent d AS $$ SELECT sum FROM st_summarystats($1, $2, TRUE, $3) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxsum(rast raster, hasnodata boolean, sample_percent double precision DEFAULT 0.1) +CREATE OR REPLACE FUNCTION st_approxsum(rast raster, exclude_nodata_value boolean, sample_percent double precision DEFAULT 0.1) RETURNS double precision AS $$ SELECT sum FROM st_summarystats($1, 1, $2, $3) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; @@ -509,17 +509,17 @@ CREATE OR REPLACE FUNCTION st_approxsum(rast raster, sample_percent double preci AS $$ SELECT sum FROM st_summarystats($1, 1, TRUE, $2) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_sum(rastertable text, rastercolumn text, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE) +CREATE OR REPLACE FUNCTION st_sum(rastertable text, rastercolumn text, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE) RETURNS double precision AS $$ SELECT sum FROM st_summarystats($1, $2, $3, $4, 1) $$ LANGUAGE 'SQL' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_sum(rastertable text, rastercolumn text, hasnodata boolean) +CREATE OR REPLACE FUNCTION st_sum(rastertable text, rastercolumn text, exclude_nodata_value boolean) RETURNS double precision AS $$ SELECT sum FROM st_summarystats($1, $2, 1, $3, 1) $$ LANGUAGE 'SQL' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxsum(rastertable text, rastercolumn text, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) +CREATE OR REPLACE FUNCTION st_approxsum(rastertable text, rastercolumn text, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) RETURNS double precision AS $$ SELECT sum FROM st_summarystats($1, $2, $3, $4, $5) $$ LANGUAGE 'SQL' STABLE STRICT; @@ -529,7 +529,7 @@ CREATE OR REPLACE FUNCTION st_approxsum(rastertable text, rastercolumn text, nba AS $$ SELECT sum FROM st_summarystats($1, $2, $3, TRUE, $4) $$ LANGUAGE 'SQL' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxsum(rastertable text, rastercolumn text, hasnodata boolean, sample_percent double precision DEFAULT 0.1) +CREATE OR REPLACE FUNCTION st_approxsum(rastertable text, rastercolumn text, exclude_nodata_value boolean, sample_percent double precision DEFAULT 0.1) RETURNS double precision AS $$ SELECT sum FROM st_summarystats($1, $2, 1, $3, $4) $$ LANGUAGE 'SQL' STABLE STRICT; @@ -542,17 +542,17 @@ CREATE OR REPLACE FUNCTION st_approxsum(rastertable text, rastercolumn text, sam ----------------------------------------------------------------------- -- ST_Mean and ST_ApproxMean ----------------------------------------------------------------------- -CREATE OR REPLACE FUNCTION st_mean(rast raster, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE) +CREATE OR REPLACE FUNCTION st_mean(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE) RETURNS double precision AS $$ SELECT mean FROM st_summarystats($1, $2, $3, 1) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_mean(rast raster, hasnodata boolean) +CREATE OR REPLACE FUNCTION st_mean(rast raster, exclude_nodata_value boolean) RETURNS double precision AS $$ SELECT mean FROM st_summarystats($1, 1, $2, 1) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxmean(rast raster, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) +CREATE OR REPLACE FUNCTION st_approxmean(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) RETURNS double precision AS $$ SELECT mean FROM st_summarystats($1, $2, $3, $4) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; @@ -562,7 +562,7 @@ CREATE OR REPLACE FUNCTION st_approxmean(rast raster, nband int, sample_percent AS $$ SELECT mean FROM st_summarystats($1, $2, TRUE, $3) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxmean(rast raster, hasnodata boolean, sample_percent double precision DEFAULT 0.1) +CREATE OR REPLACE FUNCTION st_approxmean(rast raster, exclude_nodata_value boolean, sample_percent double precision DEFAULT 0.1) RETURNS double precision AS $$ SELECT mean FROM st_summarystats($1, 1, $2, $3) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; @@ -572,17 +572,17 @@ CREATE OR REPLACE FUNCTION st_approxmean(rast raster, sample_percent double prec AS $$ SELECT mean FROM st_summarystats($1, 1, TRUE, $2) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_mean(rastertable text, rastercolumn text, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE) +CREATE OR REPLACE FUNCTION st_mean(rastertable text, rastercolumn text, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE) RETURNS double precision AS $$ SELECT mean FROM st_summarystats($1, $2, $3, $4, 1) $$ LANGUAGE 'SQL' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_mean(rastertable text, rastercolumn text, hasnodata boolean) +CREATE OR REPLACE FUNCTION st_mean(rastertable text, rastercolumn text, exclude_nodata_value boolean) RETURNS double precision AS $$ SELECT mean FROM st_summarystats($1, $2, 1, $3, 1) $$ LANGUAGE 'SQL' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxmean(rastertable text, rastercolumn text, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) +CREATE OR REPLACE FUNCTION st_approxmean(rastertable text, rastercolumn text, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) RETURNS double precision AS $$ SELECT mean FROM st_summarystats($1, $2, $3, $4, $5) $$ LANGUAGE 'SQL' STABLE STRICT; @@ -592,7 +592,7 @@ CREATE OR REPLACE FUNCTION st_approxmean(rastertable text, rastercolumn text, nb AS $$ SELECT mean FROM st_summarystats($1, $2, $3, TRUE, $4) $$ LANGUAGE 'SQL' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxmean(rastertable text, rastercolumn text, hasnodata boolean, sample_percent double precision DEFAULT 0.1) +CREATE OR REPLACE FUNCTION st_approxmean(rastertable text, rastercolumn text, exclude_nodata_value boolean, sample_percent double precision DEFAULT 0.1) RETURNS double precision AS $$ SELECT mean FROM st_summarystats($1, $2, 1, $3, $4) $$ LANGUAGE 'SQL' STABLE STRICT; @@ -605,17 +605,17 @@ CREATE OR REPLACE FUNCTION st_approxmean(rastertable text, rastercolumn text, sa ----------------------------------------------------------------------- -- ST_StdDev and ST_ApproxStdDev ----------------------------------------------------------------------- -CREATE OR REPLACE FUNCTION st_stddev(rast raster, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE) +CREATE OR REPLACE FUNCTION st_stddev(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE) RETURNS double precision AS $$ SELECT stddev FROM st_summarystats($1, $2, $3, 1) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_stddev(rast raster, hasnodata boolean) +CREATE OR REPLACE FUNCTION st_stddev(rast raster, exclude_nodata_value boolean) RETURNS double precision AS $$ SELECT stddev FROM st_summarystats($1, 1, $2, 1) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxstddev(rast raster, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) +CREATE OR REPLACE FUNCTION st_approxstddev(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) RETURNS double precision AS $$ SELECT stddev FROM st_summarystats($1, $2, $3, $4) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; @@ -625,7 +625,7 @@ CREATE OR REPLACE FUNCTION st_approxstddev(rast raster, nband int, sample_percen AS $$ SELECT stddev FROM st_summarystats($1, $2, TRUE, $3) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxstddev(rast raster, hasnodata boolean, sample_percent double precision DEFAULT 0.1) +CREATE OR REPLACE FUNCTION st_approxstddev(rast raster, exclude_nodata_value boolean, sample_percent double precision DEFAULT 0.1) RETURNS double precision AS $$ SELECT stddev FROM st_summarystats($1, 1, $2, $3) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; @@ -635,17 +635,17 @@ CREATE OR REPLACE FUNCTION st_approxstddev(rast raster, sample_percent double pr AS $$ SELECT stddev FROM st_summarystats($1, 1, TRUE, $2) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_stddev(rastertable text, rastercolumn text, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE) +CREATE OR REPLACE FUNCTION st_stddev(rastertable text, rastercolumn text, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE) RETURNS double precision AS $$ SELECT stddev FROM st_summarystats($1, $2, $3, $4, 1) $$ LANGUAGE 'SQL' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_stddev(rastertable text, rastercolumn text, hasnodata boolean) +CREATE OR REPLACE FUNCTION st_stddev(rastertable text, rastercolumn text, exclude_nodata_value boolean) RETURNS double precision AS $$ SELECT stddev FROM st_summarystats($1, $2, 1, $3, 1) $$ LANGUAGE 'SQL' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxstddev(rastertable text, rastercolumn text, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) +CREATE OR REPLACE FUNCTION st_approxstddev(rastertable text, rastercolumn text, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) RETURNS double precision AS $$ SELECT stddev FROM st_summarystats($1, $2, $3, $4, $5) $$ LANGUAGE 'SQL' STABLE STRICT; @@ -655,7 +655,7 @@ CREATE OR REPLACE FUNCTION st_approxstddev(rastertable text, rastercolumn text, AS $$ SELECT stddev FROM st_summarystats($1, $2, $3, TRUE, $4) $$ LANGUAGE 'SQL' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxstddev(rastertable text, rastercolumn text, hasnodata boolean, sample_percent double precision DEFAULT 0.1) +CREATE OR REPLACE FUNCTION st_approxstddev(rastertable text, rastercolumn text, exclude_nodata_value boolean, sample_percent double precision DEFAULT 0.1) RETURNS double precision AS $$ SELECT stddev FROM st_summarystats($1, $2, 1, $3, $4) $$ LANGUAGE 'SQL' STABLE STRICT; @@ -668,17 +668,17 @@ CREATE OR REPLACE FUNCTION st_approxstddev(rastertable text, rastercolumn text, ----------------------------------------------------------------------- -- ST_MinMax and ST_ApproxMinMax ----------------------------------------------------------------------- -CREATE OR REPLACE FUNCTION st_minmax(rast raster, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE, OUT min double precision, OUT max double precision) +CREATE OR REPLACE FUNCTION st_minmax(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, OUT min double precision, OUT max double precision) RETURNS record AS $$ SELECT min, max FROM st_summarystats($1, $2, $3, 1) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_minmax(rast raster, hasnodata boolean, OUT min double precision, OUT max double precision) +CREATE OR REPLACE FUNCTION st_minmax(rast raster, exclude_nodata_value boolean, OUT min double precision, OUT max double precision) RETURNS record AS $$ SELECT min, max FROM st_summarystats($1, 1, $2, 1) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxminmax(rast raster, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1, OUT min double precision, OUT max double precision) +CREATE OR REPLACE FUNCTION st_approxminmax(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1, OUT min double precision, OUT max double precision) RETURNS record AS $$ SELECT min, max FROM st_summarystats($1, $2, $3, $4) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; @@ -688,7 +688,7 @@ CREATE OR REPLACE FUNCTION st_approxminmax(rast raster, nband int, sample_percen AS $$ SELECT min, max FROM st_summarystats($1, $2, TRUE, $3) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxminmax(rast raster, hasnodata boolean, sample_percent double precision DEFAULT 0.1, OUT min double precision, OUT max double precision) +CREATE OR REPLACE FUNCTION st_approxminmax(rast raster, exclude_nodata_value boolean, sample_percent double precision DEFAULT 0.1, OUT min double precision, OUT max double precision) RETURNS record AS $$ SELECT min, max FROM st_summarystats($1, 1, $2, $3) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; @@ -698,17 +698,17 @@ CREATE OR REPLACE FUNCTION st_approxminmax(rast raster, sample_percent double pr AS $$ SELECT min, max FROM st_summarystats($1, 1, TRUE, $2) $$ LANGUAGE 'SQL' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_minmax(rastertable text, rastercolumn text, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE, OUT min double precision, OUT max double precision) +CREATE OR REPLACE FUNCTION st_minmax(rastertable text, rastercolumn text, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, OUT min double precision, OUT max double precision) RETURNS record AS $$ SELECT min, max FROM st_summarystats($1, $2, $3, $4, 1) $$ LANGUAGE 'SQL' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_minmax(rastertable text, rastercolumn text, hasnodata boolean, OUT min double precision, OUT max double precision) +CREATE OR REPLACE FUNCTION st_minmax(rastertable text, rastercolumn text, exclude_nodata_value boolean, OUT min double precision, OUT max double precision) RETURNS record AS $$ SELECT min, max FROM st_summarystats($1, $2, 1, $3, 1) $$ LANGUAGE 'SQL' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxminmax(rastertable text, rastercolumn text, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1, OUT min double precision, OUT max double precision) +CREATE OR REPLACE FUNCTION st_approxminmax(rastertable text, rastercolumn text, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1, OUT min double precision, OUT max double precision) RETURNS record AS $$ SELECT min, max FROM st_summarystats($1, $2, $3, $4, $5) $$ LANGUAGE 'SQL' STABLE STRICT; @@ -718,7 +718,7 @@ CREATE OR REPLACE FUNCTION st_approxminmax(rastertable text, rastercolumn text, AS $$ SELECT min, max FROM st_summarystats($1, $2, $3, TRUE, $4) $$ LANGUAGE 'SQL' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxminmax(rastertable text, rastercolumn text, hasnodata boolean, sample_percent double precision DEFAULT 0.1, OUT min double precision, OUT max double precision) +CREATE OR REPLACE FUNCTION st_approxminmax(rastertable text, rastercolumn text, exclude_nodata_value boolean, sample_percent double precision DEFAULT 0.1, OUT min double precision, OUT max double precision) RETURNS record AS $$ SELECT min, max FROM st_summarystats($1, $2, 1, $3, $4) $$ LANGUAGE 'SQL' STABLE STRICT; @@ -739,18 +739,18 @@ CREATE TYPE histogram AS ( ); -- Cannot be strict as "width" can be NULL -CREATE OR REPLACE FUNCTION _st_histogram(rast raster, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE, sample_percent double precision DEFAULT 1, bins int DEFAULT 0, width double precision[] DEFAULT NULL, right boolean DEFAULT FALSE) +CREATE OR REPLACE FUNCTION _st_histogram(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 1, bins int DEFAULT 0, width double precision[] DEFAULT NULL, right boolean DEFAULT FALSE) RETURNS SETOF histogram AS 'MODULE_PATHNAME','RASTER_histogram' LANGUAGE 'C' IMMUTABLE; -- Cannot be strict as "width" can be NULL -CREATE OR REPLACE FUNCTION st_histogram(rast raster, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE, bins int DEFAULT 0, width double precision[] DEFAULT NULL, right boolean DEFAULT FALSE) +CREATE OR REPLACE FUNCTION st_histogram(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, bins int DEFAULT 0, width double precision[] DEFAULT NULL, right boolean DEFAULT FALSE) RETURNS SETOF histogram AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, $3, 1, $4, $5, $6) $$ LANGUAGE 'sql' IMMUTABLE; -CREATE OR REPLACE FUNCTION st_histogram(rast raster, nband int, hasnodata boolean, bins int, right boolean) +CREATE OR REPLACE FUNCTION st_histogram(rast raster, nband int, exclude_nodata_value boolean, bins int, right boolean) RETURNS SETOF histogram AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, $3, 1, $4, NULL, $5) $$ LANGUAGE 'sql' IMMUTABLE STRICT; @@ -767,12 +767,12 @@ CREATE OR REPLACE FUNCTION st_histogram(rast raster, nband int, bins int, right LANGUAGE 'sql' IMMUTABLE STRICT; -- Cannot be strict as "width" can be NULL -CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1, bins int DEFAULT 0, width double precision[] DEFAULT NULL, right boolean DEFAULT FALSE) +CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1, bins int DEFAULT 0, width double precision[] DEFAULT NULL, right boolean DEFAULT FALSE) RETURNS SETOF histogram AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, $3, $4, $5, $6, $7) $$ LANGUAGE 'sql' IMMUTABLE; -CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster, nband int, hasnodata boolean, sample_percent double precision, bins int, right boolean) +CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster, nband int, exclude_nodata_value boolean, sample_percent double precision, bins int, right boolean) RETURNS SETOF histogram AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, $3, $4, $5, NULL, $6) $$ LANGUAGE 'sql' IMMUTABLE STRICT; @@ -807,13 +807,13 @@ CREATE TYPE quantile AS ( ); -- Cannot be strict as "quantiles" can be NULL -CREATE OR REPLACE FUNCTION _st_quantile(rast raster, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE, sample_percent double precision DEFAULT 1, quantiles double precision[] DEFAULT NULL) +CREATE OR REPLACE FUNCTION _st_quantile(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 1, quantiles double precision[] DEFAULT NULL) RETURNS SETOF quantile AS 'MODULE_PATHNAME','RASTER_quantile' LANGUAGE 'C' IMMUTABLE; -- Cannot be strict as "quantiles" can be NULL -CREATE OR REPLACE FUNCTION st_quantile(rast raster, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE, quantiles double precision[] DEFAULT NULL) +CREATE OR REPLACE FUNCTION st_quantile(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, quantiles double precision[] DEFAULT NULL) RETURNS SETOF quantile AS $$ SELECT quantile, value FROM _st_quantile($1, $2, $3, 1, $4) $$ LANGUAGE 'sql' IMMUTABLE; @@ -828,7 +828,7 @@ CREATE OR REPLACE FUNCTION st_quantile(rast raster, quantiles double precision[] AS $$ SELECT quantile, value FROM _st_quantile($1, 1, TRUE, 1, $2) $$ LANGUAGE 'sql' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_quantile(rast raster, nband int, hasnodata boolean, quantile double precision) +CREATE OR REPLACE FUNCTION st_quantile(rast raster, nband int, exclude_nodata_value boolean, quantile double precision) RETURNS double precision AS $$ SELECT value FROM _st_quantile($1, $2, $3, 1, ARRAY[$4]::double precision[]) $$ LANGUAGE 'sql' IMMUTABLE STRICT; @@ -839,7 +839,7 @@ CREATE OR REPLACE FUNCTION st_quantile(rast raster, nband int, quantile double p LANGUAGE 'sql' IMMUTABLE STRICT; -- Cannot be strict as "quantile" can be NULL -CREATE OR REPLACE FUNCTION st_quantile(rast raster, hasnodata boolean, quantile double precision DEFAULT NULL) +CREATE OR REPLACE FUNCTION st_quantile(rast raster, exclude_nodata_value boolean, quantile double precision DEFAULT NULL) RETURNS double precision AS $$ SELECT value FROM _st_quantile($1, 1, $2, 1, ARRAY[$3]::double precision[]) $$ LANGUAGE 'sql' IMMUTABLE; @@ -850,7 +850,7 @@ CREATE OR REPLACE FUNCTION st_quantile(rast raster, quantile double precision) LANGUAGE 'sql' IMMUTABLE STRICT; -- Cannot be strict as "quantiles" can be NULL -CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, nband int DEFAULT 1, hasnodata boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1, quantiles double precision[] DEFAULT NULL) +CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1, quantiles double precision[] DEFAULT NULL) RETURNS SETOF quantile AS $$ SELECT quantile, value FROM _st_quantile($1, $2, $3, $4, $5) $$ LANGUAGE 'sql' IMMUTABLE; @@ -872,7 +872,7 @@ CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, quantiles double preci AS $$ SELECT quantile, value FROM _st_quantile($1, 1, TRUE, 0.1, $2) $$ LANGUAGE 'sql' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, nband int, hasnodata boolean, sample_percent double precision, quantile double precision) +CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, nband int, exclude_nodata_value boolean, sample_percent double precision, quantile double precision) RETURNS double precision AS $$ SELECT value FROM _st_quantile($1, $2, $3, $4, ARRAY[$5]::double precision[]) $$ LANGUAGE 'sql' IMMUTABLE STRICT; @@ -888,7 +888,7 @@ CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, sample_percent double LANGUAGE 'sql' IMMUTABLE STRICT; -- Cannot be strict as "quantile" can be NULL -CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, hasnodata boolean, quantile double precision DEFAULT NULL) +CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, exclude_nodata_value boolean, quantile double precision DEFAULT NULL) RETURNS double precision AS $$ SELECT value FROM _st_quantile($1, 1, $2, 1, ARRAY[$3]::double precision[]) $$ LANGUAGE 'sql' IMMUTABLE; @@ -910,12 +910,12 @@ CREATE TYPE valuecount AS ( -- None of the "searchvaleus" functions can be strict as "searchvalues" and "roundto" can be NULL -- Allowing "searchvalues" to be NULL instructs the function to count all values -CREATE OR REPLACE FUNCTION _st_valuecount(rast raster, nband integer DEFAULT 1, hasnodata boolean DEFAULT TRUE, searchvalues double precision[] DEFAULT NULL, roundto double precision DEFAULT 0) +CREATE OR REPLACE FUNCTION _st_valuecount(rast raster, nband integer DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, searchvalues double precision[] DEFAULT NULL, roundto double precision DEFAULT 0) RETURNS SETOF valuecount AS 'MODULE_PATHNAME', 'RASTER_valueCount' LANGUAGE 'C' IMMUTABLE; -CREATE OR REPLACE FUNCTION st_valuecount(rast raster, nband integer DEFAULT 1, hasnodata boolean DEFAULT TRUE, searchvalues double precision[] DEFAULT NULL, roundto double precision DEFAULT 0, OUT value double precision, OUT count integer) +CREATE OR REPLACE FUNCTION st_valuecount(rast raster, nband integer DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, searchvalues double precision[] DEFAULT NULL, roundto double precision DEFAULT 0, OUT value double precision, OUT count integer) RETURNS SETOF record AS $$ SELECT value, count FROM _st_valuecount($1, $2, $3, $4, $5) $$ LANGUAGE 'sql' IMMUTABLE; @@ -930,7 +930,7 @@ CREATE OR REPLACE FUNCTION st_valuecount(rast raster, searchvalues double precis AS $$ SELECT value, count FROM _st_valuecount($1, 1, TRUE, $2, $3) $$ LANGUAGE 'sql' IMMUTABLE; -CREATE OR REPLACE FUNCTION st_valuecount(rast raster, nband integer, hasnodata boolean, searchvalue double precision, roundto double precision DEFAULT 0) +CREATE OR REPLACE FUNCTION st_valuecount(rast raster, nband integer, exclude_nodata_value boolean, searchvalue double precision, roundto double precision DEFAULT 0) RETURNS integer AS $$ SELECT count FROM _st_valuecount($1, $2, $3, ARRAY[$4]::double precision[], $5) $$ LANGUAGE 'sql' IMMUTABLE STRICT; @@ -945,7 +945,7 @@ CREATE OR REPLACE FUNCTION st_valuecount(rast raster, searchvalue double precisi AS $$ SELECT count FROM _st_valuecount($1, 1, TRUE, ARRAY[$2]::double precision[], $3) $$ LANGUAGE 'sql' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION _st_valuecount(rastertable text, rastercolumn text, nband integer DEFAULT 1, hasnodata boolean DEFAULT TRUE, searchvalues double precision[] DEFAULT NULL, roundto double precision DEFAULT 0) +CREATE OR REPLACE FUNCTION _st_valuecount(rastertable text, rastercolumn text, nband integer DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, searchvalues double precision[] DEFAULT NULL, roundto double precision DEFAULT 0) RETURNS SETOF valuecount AS $$ DECLARE @@ -994,7 +994,7 @@ CREATE OR REPLACE FUNCTION _st_valuecount(rastertable text, rastercolumn text, n FETCH curs INTO rast; EXIT WHEN NOT FOUND; - FOR vcnts IN SELECT * FROM _st_valuecount(rast, nband, hasnodata, searchvalues, roundto) LOOP + FOR vcnts IN SELECT * FROM _st_valuecount(rast, nband, exclude_nodata_value, searchvalues, roundto) LOOP IF vcnts IS NULL THEN CONTINUE; END IF; @@ -1011,7 +1011,7 @@ CREATE OR REPLACE FUNCTION _st_valuecount(rastertable text, rastercolumn text, n END; $$ LANGUAGE 'plpgsql' STABLE; -CREATE OR REPLACE FUNCTION st_valuecount(rastertable text, rastercolumn text, nband integer DEFAULT 1, hasnodata boolean DEFAULT TRUE, searchvalues double precision[] DEFAULT NULL, roundto double precision DEFAULT 0, OUT value double precision, OUT count bigint) +CREATE OR REPLACE FUNCTION st_valuecount(rastertable text, rastercolumn text, nband integer DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, searchvalues double precision[] DEFAULT NULL, roundto double precision DEFAULT 0, OUT value double precision, OUT count bigint) RETURNS SETOF record AS $$ SELECT value, sum(count) AS count FROM _st_valuecount($1, $2, $3, $4, $5, $6) GROUP BY 1 ORDER BY 1 $$ LANGUAGE 'sql' STABLE; @@ -1026,7 +1026,7 @@ CREATE OR REPLACE FUNCTION st_valuecount(rastertable text, rastercolumn text, se AS $$ SELECT value, count FROM st_valuecount($1, $2, 1, TRUE, $3, $4) $$ LANGUAGE 'sql' STABLE; -CREATE OR REPLACE FUNCTION st_valuecount(rastertable text, rastercolumn text, nband integer, hasnodata boolean, searchvalue double precision, roundto double precision DEFAULT 0) +CREATE OR REPLACE FUNCTION st_valuecount(rastertable text, rastercolumn text, nband integer, exclude_nodata_value boolean, searchvalue double precision, roundto double precision DEFAULT 0) RETURNS bigint AS $$ SELECT count FROM st_valuecount($1, $2, $3, $4, ARRAY[$5]::double precision[], $6) $$ LANGUAGE 'sql' STABLE STRICT; @@ -1041,7 +1041,7 @@ CREATE OR REPLACE FUNCTION st_valuecount(rastertable text, rastercolumn text, se AS $$ SELECT count FROM st_valuecount($1, $2, 1, TRUE, ARRAY[$3]::double precision[], $4) $$ LANGUAGE 'sql' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_valuepercent(rast raster, nband integer DEFAULT 1, hasnodata boolean DEFAULT TRUE, searchvalues double precision[] DEFAULT NULL, roundto double precision DEFAULT 0, OUT value double precision, OUT percent double precision) +CREATE OR REPLACE FUNCTION st_valuepercent(rast raster, nband integer DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, searchvalues double precision[] DEFAULT NULL, roundto double precision DEFAULT 0, OUT value double precision, OUT percent double precision) RETURNS SETOF record AS $$ SELECT value, percent FROM _st_valuecount($1, $2, $3, $4, $5) $$ LANGUAGE 'sql' IMMUTABLE; @@ -1056,7 +1056,7 @@ CREATE OR REPLACE FUNCTION st_valuepercent(rast raster, searchvalues double prec AS $$ SELECT value, percent FROM _st_valuecount($1, 1, TRUE, $2, $3) $$ LANGUAGE 'sql' IMMUTABLE; -CREATE OR REPLACE FUNCTION st_valuepercent(rast raster, nband integer, hasnodata boolean, searchvalue double precision, roundto double precision DEFAULT 0) +CREATE OR REPLACE FUNCTION st_valuepercent(rast raster, nband integer, exclude_nodata_value boolean, searchvalue double precision, roundto double precision DEFAULT 0) RETURNS double precision AS $$ SELECT percent FROM _st_valuecount($1, $2, $3, ARRAY[$4]::double precision[], $5) $$ LANGUAGE 'sql' IMMUTABLE STRICT; @@ -1071,7 +1071,7 @@ CREATE OR REPLACE FUNCTION st_valuepercent(rast raster, searchvalue double preci AS $$ SELECT percent FROM _st_valuecount($1, 1, TRUE, ARRAY[$2]::double precision[], $3) $$ LANGUAGE 'sql' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_valuepercent(rastertable text, rastercolumn text, nband integer DEFAULT 1, hasnodata boolean DEFAULT TRUE, searchvalues double precision[] DEFAULT NULL, roundto double precision DEFAULT 0, OUT value double precision, OUT percent double precision) +CREATE OR REPLACE FUNCTION st_valuepercent(rastertable text, rastercolumn text, nband integer DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, searchvalues double precision[] DEFAULT NULL, roundto double precision DEFAULT 0, OUT value double precision, OUT percent double precision) RETURNS SETOF record AS $$ SELECT @@ -1102,7 +1102,7 @@ CREATE OR REPLACE FUNCTION st_valuepercent(rastertable text, rastercolumn text, AS $$ SELECT value, percent FROM st_valuepercent($1, $2, 1, TRUE, $3, $4) $$ LANGUAGE 'sql' STABLE; -CREATE OR REPLACE FUNCTION st_valuepercent(rastertable text, rastercolumn text, nband integer, hasnodata boolean, searchvalue double precision, roundto double precision DEFAULT 0) +CREATE OR REPLACE FUNCTION st_valuepercent(rastertable text, rastercolumn text, nband integer, exclude_nodata_value boolean, searchvalue double precision, roundto double precision DEFAULT 0) RETURNS double precision AS $$ SELECT percent FROM st_valuepercent($1, $2, $3, $4, ARRAY[$5]::double precision[], $6) $$ LANGUAGE 'sql' STABLE STRICT;