]> granicus.if.org Git - postgis/commitdiff
changed name "proportion" to "percent" for ST_Histogram to stay consistent with ST_Va...
authorBborie Park <bkpark at ucdavis.edu>
Thu, 26 May 2011 20:09:50 +0000 (20:09 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Thu, 26 May 2011 20:09:50 +0000 (20:09 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7257 b70326c6-7e19-0410-871a-916f4a2858ee

raster/rt_core/rt_api.c
raster/rt_pg/rt_pg.c
raster/rt_pg/rtpostgis.sql.in.c
raster/test/core/testapi.c
raster/test/regress/rt_histogram.sql

index 13887436dc41bb95eb57eadd47062471efbb556b..3a0df7e3c9f86fdf76538263757a0955b566f4a0 100644 (file)
@@ -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
 
index a3229e6cdb09b705911103112a6c37553d1a7211..830eaee4b75c7133e4ba91d3d65b7de532334cd8 100644 (file)
@@ -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 */
index 60a5de8be8716faa734c899548c2a9d9e3aac3e4..eb1a216fa1a85146094306b199f4c385117852b7 100644 (file)
@@ -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;
 
 -----------------------------------------------------------------------
index c47bf5a2d4212332205ee50cc0c56d3bb2d776fb..854eef7fd117c34e5ea834f6fb8629262afa4121 100644 (file)
@@ -1002,7 +1002,7 @@ struct rt_bandstats_t {
 };
 struct rt_histogram_t {
        uint32_t count;
-       double proportion;
+       double percent;
 
        double min;
        double max;
index 41824c0f48b38d960b5b832fca13b3168de0e4a1..e1d356cecb528779e17a0d3025f1ff58da8e871d 100644 (file)
@@ -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(