From: Bborie Park Date: Thu, 26 May 2011 20:09:50 +0000 (+0000) Subject: changed name "proportion" to "percent" for ST_Histogram to stay consistent with ST_Va... X-Git-Tag: 2.0.0alpha1~1557 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=be8b1278c3e46a576a8d28b0d3233f64946fa3c9;p=postgis changed name "proportion" to "percent" for ST_Histogram to stay consistent with ST_ValuePercent git-svn-id: http://svn.osgeo.org/postgis/trunk@7257 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/raster/rt_core/rt_api.c b/raster/rt_core/rt_api.c index 13887436d..3a0df7e3c 100644 --- a/raster/rt_core/rt_api.c +++ b/raster/rt_core/rt_api.c @@ -1774,7 +1774,7 @@ rt_band_get_summary_stats(rt_band band, int hasnodata, double sample, struct rt_histogram_t { uint32_t count; - double proportion; + double percent; double min; double max; @@ -1883,7 +1883,7 @@ rt_band_get_histogram(rt_bandstats stats, } bins->count = stats->count; - bins->proportion = -1; + bins->percent = -1; bins->min = stats->min; bins->max = stats->max; bins->inc_min = bins->inc_max = 1; @@ -1923,7 +1923,7 @@ rt_band_get_histogram(rt_bandstats stats, for (i = 0; i < bin_count;) { for (j = 0; j < bin_width_count; j++) { bins[i].count = 0; - bins->proportion = -1; + bins->percent = -1; if (!right) { bins[i].min = tmp; @@ -1999,11 +1999,11 @@ rt_band_get_histogram(rt_bandstats stats, } } - /* proportions */ + /* percents */ for (i = 0; i < bin_count; i++) { - bins[i].proportion = ((double) bins[i].count) / sum; + bins[i].percent = ((double) bins[i].count) / sum; if (bin_width_count > 1) - bins[i].proportion /= (bins[i].max - bins[i].min); + bins[i].percent /= (bins[i].max - bins[i].min); } #if POSTGIS_DEBUG_LEVEL > 0 @@ -2012,8 +2012,8 @@ rt_band_get_histogram(rt_bandstats stats, RASTER_DEBUGF(3, "elapsed time = %0.4f", elapsed); for (j = 0; j < bin_count; j++) { - RASTER_DEBUGF(5, "(min, max, inc_min, inc_max, count, sum, proportion) = (%f, %f, %d, %d, %d, %d, %f)", - bins[j].min, bins[j].max, bins[j].inc_min, bins[j].inc_max, bins[j].count, sum, bins[j].proportion); + RASTER_DEBUGF(5, "(min, max, inc_min, inc_max, count, sum, percent) = (%f, %f, %d, %d, %d, %d, %f)", + bins[j].min, bins[j].max, bins[j].inc_min, bins[j].inc_max, bins[j].count, sum, bins[j].percent); } #endif diff --git a/raster/rt_pg/rt_pg.c b/raster/rt_pg/rt_pg.c index a3229e6cd..830eaee4b 100644 --- a/raster/rt_pg/rt_pg.c +++ b/raster/rt_pg/rt_pg.c @@ -3096,7 +3096,7 @@ Datum RASTER_summaryStats(PG_FUNCTION_ARGS) /* get histogram */ struct rt_histogram_t { uint32_t count; - double proportion; + double percent; double min; double max; @@ -3368,7 +3368,7 @@ Datum RASTER_histogram(PG_FUNCTION_ARGS) values[3], sizeof(char) * (MAX_DBL_CHARLEN + 1), "%f", - hist2[call_cntr].proportion + hist2[call_cntr].percent ); /* build a tuple */ diff --git a/raster/rt_pg/rtpostgis.sql.in.c b/raster/rt_pg/rtpostgis.sql.in.c index 60a5de8be..eb1a216fa 100644 --- a/raster/rt_pg/rtpostgis.sql.in.c +++ b/raster/rt_pg/rtpostgis.sql.in.c @@ -930,7 +930,7 @@ CREATE TYPE histogram AS ( min double precision, max double precision, count integer, - proportion double precision + percent double precision ); -- Cannot be strict as "width" can be NULL @@ -941,102 +941,102 @@ CREATE OR REPLACE FUNCTION _st_histogram(rast raster, nband int, hasnodata boole CREATE OR REPLACE FUNCTION st_histogram(rast raster, nband int, hasnodata boolean, bins int, width double precision[], right boolean) RETURNS SETOF histogram - AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, $2, $3, 1, $4, $5, $6) $$ + AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, $3, 1, $4, $5, $6) $$ LANGUAGE 'sql' IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION st_histogram(rast raster, nband int, hasnodata boolean, bins int, right boolean) RETURNS SETOF histogram - AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, $2, $3, 1, $4, NULL, $5) $$ + AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, $3, 1, $4, NULL, $5) $$ LANGUAGE 'sql' IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION st_histogram(rast raster, nband int, hasnodata boolean, bins int) RETURNS SETOF histogram - AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, $2, $3, 1, $4, NULL, FALSE) $$ + AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, $3, 1, $4, NULL, FALSE) $$ LANGUAGE 'sql' IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION st_histogram(rast raster, nband int, hasnodata boolean) RETURNS SETOF histogram - AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, $2, $3, 1, 0, NULL, FALSE) $$ + AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, $3, 1, 0, NULL, FALSE) $$ LANGUAGE 'sql' IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION st_histogram(rast raster, nband int) RETURNS SETOF histogram - AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, $2, TRUE, 1, 0, NULL, FALSE) $$ + AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, TRUE, 1, 0, NULL, FALSE) $$ LANGUAGE 'sql' IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION st_histogram(rast raster) RETURNS SETOF histogram - AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, 1, TRUE, 1, 0, NULL, FALSE) $$ + AS $$ SELECT min, max, count, percent FROM _st_histogram($1, 1, TRUE, 1, 0, NULL, FALSE) $$ LANGUAGE 'sql' IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION st_histogram(rast raster, nband int, bins int, width double precision[], right boolean) RETURNS SETOF histogram - AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, $2, TRUE, 1, $3, $4, $5) $$ + AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, TRUE, 1, $3, $4, $5) $$ LANGUAGE 'sql' IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION st_histogram(rast raster, nband int, bins int, right boolean) RETURNS SETOF histogram - AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, $2, TRUE, 1, $3, NULL, $4) $$ + AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, TRUE, 1, $3, NULL, $4) $$ LANGUAGE 'sql' IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION st_histogram(rast raster, nband int, bins int) RETURNS SETOF histogram - AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, $2, TRUE, 1, $3, NULL, FALSE) $$ + AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, TRUE, 1, $3, NULL, FALSE) $$ LANGUAGE 'sql' IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster, nband int, hasnodata boolean, sample_percent double precision, bins int, width double precision[], right boolean) RETURNS SETOF histogram - AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, $2, $3, $4, $5, $6, $7) $$ + AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, $3, $4, $5, $6, $7) $$ LANGUAGE 'sql' IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster, nband int, hasnodata boolean, sample_percent double precision, bins int, right boolean) RETURNS SETOF histogram - AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, $2, $3, $4, $5, NULL, $6) $$ + AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, $3, $4, $5, NULL, $6) $$ LANGUAGE 'sql' IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster, nband int, hasnodata boolean, sample_percent double precision, bins int) RETURNS SETOF histogram - AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, $2, $3, $4, $5, NULL, FALSE) $$ + AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, $3, $4, $5, NULL, FALSE) $$ LANGUAGE 'sql' IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster, nband int, hasnodata boolean, sample_percent double precision) RETURNS SETOF histogram - AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, $2, $3, $4, 0, NULL, FALSE) $$ + AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, $3, $4, 0, NULL, FALSE) $$ LANGUAGE 'sql' IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster, nband int, sample_percent double precision) RETURNS SETOF histogram - AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, $2, TRUE, $3, 0, NULL, FALSE) $$ + AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, TRUE, $3, 0, NULL, FALSE) $$ LANGUAGE 'sql' IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster, nband int) RETURNS SETOF histogram - AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, $2, TRUE, 0.1, 0, NULL, FALSE) $$ + AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, TRUE, 0.1, 0, NULL, FALSE) $$ LANGUAGE 'sql' IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster, sample_percent double precision) RETURNS SETOF histogram - AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, 1, TRUE, $2, 0, NULL, FALSE) $$ + AS $$ SELECT min, max, count, percent FROM _st_histogram($1, 1, TRUE, $2, 0, NULL, FALSE) $$ LANGUAGE 'sql' IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster) RETURNS SETOF histogram - AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, 1, TRUE, 0.1, 0, NULL, FALSE) $$ + AS $$ SELECT min, max, count, percent FROM _st_histogram($1, 1, TRUE, 0.1, 0, NULL, FALSE) $$ LANGUAGE 'sql' IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster, nband int, sample_percent double precision, bins int, width double precision[], right boolean) RETURNS SETOF histogram - AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, $2, TRUE, $3, $4, $5, $6) $$ + AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, TRUE, $3, $4, $5, $6) $$ LANGUAGE 'sql' IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster, nband int, sample_percent double precision, bins int, right boolean) RETURNS SETOF histogram - AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, $2, TRUE, $3, $4, NULL, $5) $$ + AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, TRUE, $3, $4, NULL, $5) $$ LANGUAGE 'sql' IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster, nband int, sample_percent double precision, bins int) RETURNS SETOF histogram - AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, $2, TRUE, $3, $4, NULL, FALSE) $$ + AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, TRUE, $3, $4, NULL, FALSE) $$ LANGUAGE 'sql' IMMUTABLE STRICT; ----------------------------------------------------------------------- diff --git a/raster/test/core/testapi.c b/raster/test/core/testapi.c index c47bf5a2d..854eef7fd 100644 --- a/raster/test/core/testapi.c +++ b/raster/test/core/testapi.c @@ -1002,7 +1002,7 @@ struct rt_bandstats_t { }; struct rt_histogram_t { uint32_t count; - double proportion; + double percent; double min; double max; diff --git a/raster/test/regress/rt_histogram.sql b/raster/test/regress/rt_histogram.sql index 41824c0f4..e1d356cec 100644 --- a/raster/test/regress/rt_histogram.sql +++ b/raster/test/regress/rt_histogram.sql @@ -2,7 +2,7 @@ SELECT round(min::numeric, 3), round(max::numeric, 3), count, - round(proportion::numeric, 3) + round(percent::numeric, 3) FROM ST_Histogram( ST_SetValue( ST_SetValue( @@ -22,7 +22,7 @@ SELECT round(min::numeric, 3), round(max::numeric, 3), count, - round(proportion::numeric, 3) + round(percent::numeric, 3) FROM ST_Histogram( ST_SetValue( ST_SetValue( @@ -43,7 +43,7 @@ SELECT round(min::numeric, 3), round(max::numeric, 3), count, - round(proportion::numeric, 3) + round(percent::numeric, 3) FROM ST_Histogram( ST_SetValue( ST_SetValue( @@ -64,7 +64,7 @@ SELECT round(min::numeric, 3), round(max::numeric, 3), count, - round(proportion::numeric, 3) + round(percent::numeric, 3) FROM ST_Histogram( ST_SetValue( ST_SetValue( @@ -85,7 +85,7 @@ SELECT round(min::numeric, 3), round(max::numeric, 3), count, - round(proportion::numeric, 3) + round(percent::numeric, 3) FROM ST_Histogram( ST_SetValue( ST_SetValue( @@ -106,7 +106,7 @@ SELECT round(min::numeric, 3), round(max::numeric, 3), count, - round(proportion::numeric, 3) + round(percent::numeric, 3) FROM ST_Histogram( ST_SetValue( ST_SetValue( @@ -127,7 +127,7 @@ SELECT round(min::numeric, 3), round(max::numeric, 3), count, - round(proportion::numeric, 3) + round(percent::numeric, 3) FROM ST_Histogram( ST_SetValue( ST_SetValue( @@ -148,7 +148,7 @@ SELECT round(min::numeric, 3), round(max::numeric, 3), count, - round(proportion::numeric, 3) + round(percent::numeric, 3) FROM ST_Histogram( ST_SetValue( ST_SetValue( @@ -169,7 +169,7 @@ SELECT round(min::numeric, 3), round(max::numeric, 3), count, - round(proportion::numeric, 3) + round(percent::numeric, 3) FROM ST_Histogram( ST_SetValue( ST_SetValue(