]> granicus.if.org Git - postgis/commitdiff
- fixed usage of function parameter "hasnodata" to follow standardized interpretation
authorBborie Park <bkpark at ucdavis.edu>
Mon, 16 May 2011 22:01:10 +0000 (22:01 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Mon, 16 May 2011 22:01:10 +0000 (22:01 +0000)
- added copyright notices for work done by Bborie Park funded through the Regents of the University of California

git-svn-id: http://svn.osgeo.org/postgis/trunk@7160 b70326c6-7e19-0410-871a-916f4a2858ee

13 files changed:
raster/rt_core/rt_api.c
raster/rt_core/rt_api.h
raster/rt_pg/rt_pg.c
raster/rt_pg/rtpostgis.sql.in.c
raster/scripts/python/rtgdalraster.py
raster/test/core/testapi.c
raster/test/regress/Makefile.in
raster/test/regress/rt_histogram.sql
raster/test/regress/rt_mean.sql
raster/test/regress/rt_minmax.sql
raster/test/regress/rt_quantile.sql
raster/test/regress/rt_stddev.sql
raster/test/regress/rt_summarystats.sql

index cd3f9c9a06d0b5daebee5ea024d12588b3e2caec..035afe5071a93dc820a8a05ab114019a406446f7 100644 (file)
@@ -4,6 +4,8 @@
  * WKTRaster - Raster Types for PostGIS
  * http://www.postgis.org/support/wiki/index.php?WKTRasterHomePage
  *
+ * Copyright (C) 2011 Regents of the University of California
+ *   <bkpark@ucdavis.edu>
  * Copyright (C) 2010-2011 Jorge Arevalo <jorge.arevalo@deimos-space.com>
  * Copyright (C) 2010-2011 David Zwarg <dzwarg@avencia.com>
  * Copyright (C) 2009-2011 Pierre Racine <pierre.racine@sbf.ulaval.ca>
@@ -1498,7 +1500,7 @@ struct rt_bandstats_t {
  * Compute summary statistics for a band
  *
  * @param band: the band to query for minimum and maximum pixel values
- * @param hasnodata: if zero, ignore nodata value
+ * @param hasnodata: if non-zero, ignore nodata values
  * @param sample: percentage of pixels to sample
  * @param inc_vals: flag to include values in return struct
  *
@@ -1559,7 +1561,7 @@ rt_band_get_summary_stats(rt_band band, int hasnodata, double sample,
                nodata = rt_band_get_nodata(band);
        }
        else {
-               hasnodata = 1;
+               hasnodata = 0;
        }
 
        RASTER_DEBUGF(3, "nodata = %f", nodata);
@@ -1568,7 +1570,7 @@ rt_band_get_summary_stats(rt_band band, int hasnodata, double sample,
 
        /* entire band is nodata */
        if (rt_band_get_isnodata_flag(band) != FALSE) {
-               if (!hasnodata) {
+               if (hasnodata) {
                        rtwarn("All pixels of band have the NODATA value");
                        return NULL;
                }
@@ -1657,8 +1659,8 @@ rt_band_get_summary_stats(rt_band band, int hasnodata, double sample,
                        j++;
                        if (rtn != -1) {
                                if (
-                                       hasnodata ||
-                                       (!hasnodata && (hasnodata_flag != FALSE) && (value != nodata))
+                                       !hasnodata ||
+                                       (hasnodata && (hasnodata_flag != FALSE) && (value != nodata))
                                ) {
 
                                        /* inc_vals set, collect pixel values */
index 967e6c7ae30150a7c980ef45d46df9f472371f16..86145a1578a82e16350233fa537aa52a7dd6a4af 100644 (file)
@@ -4,6 +4,8 @@
  * WKTRaster - Raster Types for PostGIS
  * http://www.postgis.org/support/wiki/index.php?WKTRasterHomePage
  *
+ * Copyright (C) 2011 Regents of the University of California
+ *   <bkpark@ucdavis.edu>
  * Copyright (C) 2010-2011 Jorge Arevalo <jorge.arevalo@deimos-space.com>
  * Copyright (C) 2010-2011 David Zwarg <dzwarg@avencia.com>
  * Copyright (C) 2009-2011 Pierre Racine <pierre.racine@sbf.ulaval.ca>
@@ -449,7 +451,7 @@ int rt_band_check_is_nodata(rt_band band);
  * Compute summary statistics for a band
  *
  * @param band: the band to query for minimum and maximum pixel values
- * @param hasnodata: if zero, ignore nodata value
+ * @param hasnodata: if non-zero, ignore nodata values
  * @param sample: percentage of pixels to sample
  * @param inc_vals: flag to include values in return struct
  *
index df016bf025a01d5d6d73712b4e134f6ce972c6a4..c984fcf4280d280202bfaa5a7c328039caad6b1f 100644 (file)
@@ -4,6 +4,8 @@
  * WKTRaster - Raster Types for PostGIS
  * http://www.postgis.org/support/wiki/index.php?WKTRasterHomePage
  *
+ * Copyright (C) 2011 Regents of the University of California
+ *   <bkpark@ucdavis.edu>
  * Copyright (C) 2010-2011 Jorge Arevalo <jorge.arevalo@deimos-space.com>
  * Copyright (C) 2010-2011 David Zwarg <dzwarg@avencia.com>
  * Copyright (C) 2009-2011 Pierre Racine <pierre.racine@sbf.ulaval.ca>
@@ -2946,7 +2948,7 @@ Datum RASTER_summaryStats(PG_FUNCTION_ARGS)
                rt_raster raster = NULL;
                rt_band band = NULL;
                int32_t bandindex = 0;
-               bool hasnodata = FALSE;
+               bool hasnodata = TRUE;
                int num_bands = 0;
                double sample = 0;
 
@@ -3160,7 +3162,7 @@ Datum RASTER_histogram(PG_FUNCTION_ARGS)
                rt_band band = NULL;
                int32_t bandindex = 0;
                int num_bands = 0;
-               bool hasnodata = FALSE;
+               bool hasnodata = TRUE;
                double sample = 0;
                int bin_count = 0;
                double *bin_width = NULL;
@@ -3458,7 +3460,7 @@ Datum RASTER_quantile(PG_FUNCTION_ARGS)
                rt_band band = NULL;
                int32_t bandindex = 0;
                int num_bands = 0;
-               bool hasnodata = FALSE;
+               bool hasnodata = TRUE;
                double sample = 0;
                double *quantiles = NULL;
                int quantiles_count = 0;
index 1d8f2f4e8dd47489fc6680c5b7cda06332a68ad9..78c9d1184373fb2ea463f26d4afa69170edc3ef4 100644 (file)
@@ -10,6 +10,8 @@
 -- Copyright (c) 2009-2010 Jorge Arevalo <jorge.arevalo@deimos-space.com>
 -- Copyright (c) 2009-2010 Mateusz Loskot <mateusz@loskot.net>
 -- Copyright (c) 2010 David Zwarg <dzwarg@avencia.com>
+-- Copyright (C) 2011 Regents of the University of California 
+--   <bkpark@ucdavis.edu>
 --
 -- This is free software; you can redistribute and/or modify it under
 -- the terms of the GNU General Public Licence. See the COPYING file.
@@ -279,7 +281,7 @@ CREATE OR REPLACE FUNCTION st_summarystats(rast raster, nband int, hasnodata boo
 
 CREATE OR REPLACE FUNCTION st_summarystats(rast raster, nband int)
        RETURNS summarystats
-       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, $2, FALSE, 1) $$
+       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, $2, TRUE, 1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_summarystats(rast raster, hasnodata boolean)
@@ -289,7 +291,7 @@ CREATE OR REPLACE FUNCTION st_summarystats(rast raster, hasnodata boolean)
 
 CREATE OR REPLACE FUNCTION st_summarystats(rast raster)
        RETURNS summarystats
-       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, 1, FALSE, 1) $$
+       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, 1, TRUE, 1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxsummarystats(rast raster, nband int, hasnodata boolean, sample_percent double precision)
@@ -299,7 +301,7 @@ CREATE OR REPLACE FUNCTION st_approxsummarystats(rast raster, nband int, hasnoda
 
 CREATE OR REPLACE FUNCTION st_approxsummarystats(rast raster, nband int, sample_percent double precision)
        RETURNS summarystats
-       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, $2, FALSE, $3) $$
+       AS $$ SELECT count, 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)
@@ -309,12 +311,12 @@ CREATE OR REPLACE FUNCTION st_approxsummarystats(rast raster, hasnodata boolean,
 
 CREATE OR REPLACE FUNCTION st_approxsummarystats(rast raster, sample_percent double precision)
        RETURNS summarystats
-       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, 1, FALSE, $2) $$
+       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, 1, TRUE, $2) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxsummarystats(rast raster)
        RETURNS summarystats
-       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, 1, FALSE, 0.1) $$
+       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, 1, TRUE, 0.1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION _st_summarystats(rastertable text, rastercolumn text, nband integer, hasnodata boolean, sample_percent double precision)
@@ -416,12 +418,12 @@ CREATE OR REPLACE FUNCTION st_summarystats(rastertable text, rastercolumn text,
 
 CREATE OR REPLACE FUNCTION st_summarystats(rastertable text, rastercolumn text, nband integer)
        RETURNS summarystats
-       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, $2, $3, FALSE, 1) $$
+       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, $2, $3, TRUE, 1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_summarystats(rastertable text, rastercolumn text)
        RETURNS summarystats
-       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, $2, 1, FALSE, 1) $$
+       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, $2, 1, TRUE, 1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxsummarystats(rastertable text, rastercolumn text, nband integer, hasnodata boolean, sample_percent double precision)
@@ -431,22 +433,22 @@ CREATE OR REPLACE FUNCTION st_approxsummarystats(rastertable text, rastercolumn
 
 CREATE OR REPLACE FUNCTION st_approxsummarystats(rastertable text, rastercolumn text, nband integer, sample_percent double precision)
        RETURNS summarystats
-       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, $2, $3, FALSE, $4) $$
+       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, $2, $3, TRUE, $4) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxsummarystats(rastertable text, rastercolumn text, nband integer)
        RETURNS summarystats
-       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, $2, $3, FALSE, 0.1) $$
+       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, $2, $3, TRUE, 0.1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxsummarystats(rastertable text, rastercolumn text, sample_percent double precision)
        RETURNS summarystats
-       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, $2, 1, FALSE, $3) $$
+       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, $2, 1, TRUE, $3) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxsummarystats(rastertable text, rastercolumn text)
        RETURNS summarystats
-       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, $2, 1, FALSE, 0.1) $$
+       AS $$ SELECT count, mean, stddev, min, max FROM _st_summarystats($1, $2, 1, TRUE, 0.1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 -----------------------------------------------------------------------
@@ -459,7 +461,7 @@ CREATE OR REPLACE FUNCTION st_mean(rast raster, nband int, hasnodata boolean, OU
 
 CREATE OR REPLACE FUNCTION st_mean(rast raster, nband int, OUT mean double precision)
        RETURNS double precision
-       AS $$ SELECT mean FROM _st_summarystats($1, $2, FALSE, 1) $$
+       AS $$ SELECT mean FROM _st_summarystats($1, $2, TRUE, 1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_mean(rast raster, hasnodata boolean, OUT mean double precision)
@@ -469,7 +471,7 @@ CREATE OR REPLACE FUNCTION st_mean(rast raster, hasnodata boolean, OUT mean doub
 
 CREATE OR REPLACE FUNCTION st_mean(rast raster, OUT mean double precision)
        RETURNS double precision
-       AS $$ SELECT mean FROM _st_summarystats($1, 1, FALSE, 1) $$
+       AS $$ SELECT mean FROM _st_summarystats($1, 1, TRUE, 1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxmean(rast raster, nband int, hasnodata boolean, sample_percent double precision, OUT mean double precision)
@@ -479,7 +481,7 @@ CREATE OR REPLACE FUNCTION st_approxmean(rast raster, nband int, hasnodata boole
 
 CREATE OR REPLACE FUNCTION st_approxmean(rast raster, nband int, sample_percent double precision, OUT mean double precision)
        RETURNS double precision
-       AS $$ SELECT mean FROM _st_summarystats($1, $2, FALSE, $3) $$
+       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, OUT mean double precision)
@@ -489,12 +491,12 @@ CREATE OR REPLACE FUNCTION st_approxmean(rast raster, hasnodata boolean, sample_
 
 CREATE OR REPLACE FUNCTION st_approxmean(rast raster, sample_percent double precision, OUT mean double precision)
        RETURNS double precision
-       AS $$ SELECT mean FROM _st_summarystats($1, 1, FALSE, $2) $$
+       AS $$ SELECT mean FROM _st_summarystats($1, 1, TRUE, $2) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxmean(rast raster, OUT mean double precision)
        RETURNS double precision
-       AS $$ SELECT mean FROM _st_summarystats($1, 1, FALSE, 0.1) $$
+       AS $$ SELECT mean FROM _st_summarystats($1, 1, TRUE, 0.1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_mean(rastertable text, rastercolumn text, nband int, hasnodata boolean, OUT mean double precision)
@@ -504,7 +506,7 @@ CREATE OR REPLACE FUNCTION st_mean(rastertable text, rastercolumn text, nband in
 
 CREATE OR REPLACE FUNCTION st_mean(rastertable text, rastercolumn text, nband int, OUT mean double precision)
        RETURNS double precision
-       AS $$ SELECT mean FROM _st_summarystats($1, $2, $3, FALSE, 1) $$
+       AS $$ SELECT mean FROM _st_summarystats($1, $2, $3, TRUE, 1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_mean(rastertable text, rastercolumn text, hasnodata boolean, OUT mean double precision)
@@ -514,7 +516,7 @@ CREATE OR REPLACE FUNCTION st_mean(rastertable text, rastercolumn text, hasnodat
 
 CREATE OR REPLACE FUNCTION st_mean(rastertable text, rastercolumn text, OUT mean double precision)
        RETURNS double precision
-       AS $$ SELECT mean FROM _st_summarystats($1, $2, 1, FALSE, 1) $$
+       AS $$ SELECT mean FROM _st_summarystats($1, $2, 1, TRUE, 1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxmean(rastertable text, rastercolumn text, nband int, hasnodata boolean, sample_percent double precision, OUT mean double precision)
@@ -524,7 +526,7 @@ CREATE OR REPLACE FUNCTION st_approxmean(rastertable text, rastercolumn text, nb
 
 CREATE OR REPLACE FUNCTION st_approxmean(rastertable text, rastercolumn text, nband int, sample_percent double precision, OUT mean double precision)
        RETURNS double precision
-       AS $$ SELECT mean FROM _st_summarystats($1, $2, $3, FALSE, $4) $$
+       AS $$ SELECT mean FROM _st_summarystats($1, $2, $3, TRUE, $4) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxmean(rastertable text, rastercolumn text, hasnodata boolean, sample_percent double precision, OUT mean double precision)
@@ -534,12 +536,12 @@ CREATE OR REPLACE FUNCTION st_approxmean(rastertable text, rastercolumn text, ha
 
 CREATE OR REPLACE FUNCTION st_approxmean(rastertable text, rastercolumn text, sample_percent double precision, OUT mean double precision)
        RETURNS double precision
-       AS $$ SELECT mean FROM _st_summarystats($1, $2, 1, FALSE, $3) $$
+       AS $$ SELECT mean FROM _st_summarystats($1, $2, 1, TRUE, $3) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxmean(rastertable text, rastercolumn text, OUT mean double precision)
        RETURNS double precision
-       AS $$ SELECT mean FROM _st_summarystats($1, $2, 1, FALSE, 0.1) $$
+       AS $$ SELECT mean FROM _st_summarystats($1, $2, 1, TRUE, 0.1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 -----------------------------------------------------------------------
@@ -552,7 +554,7 @@ CREATE OR REPLACE FUNCTION st_stddev(rast raster, nband int, hasnodata boolean,
 
 CREATE OR REPLACE FUNCTION st_stddev(rast raster, nband int, OUT stddev double precision)
        RETURNS double precision
-       AS $$ SELECT stddev FROM _st_summarystats($1, $2, FALSE, 1) $$
+       AS $$ SELECT stddev FROM _st_summarystats($1, $2, TRUE, 1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_stddev(rast raster, hasnodata boolean, OUT stddev double precision)
@@ -562,7 +564,7 @@ CREATE OR REPLACE FUNCTION st_stddev(rast raster, hasnodata boolean, OUT stddev
 
 CREATE OR REPLACE FUNCTION st_stddev(rast raster, OUT stddev double precision)
        RETURNS double precision
-       AS $$ SELECT stddev FROM _st_summarystats($1, 1, FALSE, 1) $$
+       AS $$ SELECT stddev FROM _st_summarystats($1, 1, TRUE, 1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxstddev(rast raster, nband int, hasnodata boolean, sample_percent double precision, OUT stddev double precision)
@@ -572,7 +574,7 @@ CREATE OR REPLACE FUNCTION st_approxstddev(rast raster, nband int, hasnodata boo
 
 CREATE OR REPLACE FUNCTION st_approxstddev(rast raster, nband int, sample_percent double precision, OUT stddev double precision)
        RETURNS double precision
-       AS $$ SELECT stddev FROM _st_summarystats($1, $2, FALSE, $3) $$
+       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, OUT stddev double precision)
@@ -582,12 +584,12 @@ CREATE OR REPLACE FUNCTION st_approxstddev(rast raster, hasnodata boolean, sampl
 
 CREATE OR REPLACE FUNCTION st_approxstddev(rast raster, sample_percent double precision, OUT stddev double precision)
        RETURNS double precision
-       AS $$ SELECT stddev FROM _st_summarystats($1, 1, FALSE, $2) $$
+       AS $$ SELECT stddev FROM _st_summarystats($1, 1, TRUE, $2) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxstddev(rast raster, OUT stddev double precision)
        RETURNS double precision
-       AS $$ SELECT stddev FROM _st_summarystats($1, 1, FALSE, 0.1) $$
+       AS $$ SELECT stddev FROM _st_summarystats($1, 1, TRUE, 0.1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_stddev(rastertable text, rastercolumn text, nband int, hasnodata boolean, OUT stddev double precision)
@@ -597,7 +599,7 @@ CREATE OR REPLACE FUNCTION st_stddev(rastertable text, rastercolumn text, nband
 
 CREATE OR REPLACE FUNCTION st_stddev(rastertable text, rastercolumn text, nband int, OUT stddev double precision)
        RETURNS double precision
-       AS $$ SELECT stddev FROM _st_summarystats($1, $2, $3, FALSE, 1) $$
+       AS $$ SELECT stddev FROM _st_summarystats($1, $2, $3, TRUE, 1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_stddev(rastertable text, rastercolumn text, hasnodata boolean, OUT stddev double precision)
@@ -607,7 +609,7 @@ CREATE OR REPLACE FUNCTION st_stddev(rastertable text, rastercolumn text, hasnod
 
 CREATE OR REPLACE FUNCTION st_stddev(rastertable text, rastercolumn text, OUT stddev double precision)
        RETURNS double precision
-       AS $$ SELECT stddev FROM _st_summarystats($1, $2, 1, FALSE, 1) $$
+       AS $$ SELECT stddev FROM _st_summarystats($1, $2, 1, TRUE, 1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxstddev(rastertable text, rastercolumn text, nband int, hasnodata boolean, sample_percent double precision, OUT stddev double precision)
@@ -617,7 +619,7 @@ CREATE OR REPLACE FUNCTION st_approxstddev(rastertable text, rastercolumn text,
 
 CREATE OR REPLACE FUNCTION st_approxstddev(rastertable text, rastercolumn text, nband int, sample_percent double precision, OUT stddev double precision)
        RETURNS double precision
-       AS $$ SELECT stddev FROM _st_summarystats($1, $2, $3, FALSE, $4) $$
+       AS $$ SELECT stddev FROM _st_summarystats($1, $2, $3, TRUE, $4) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxstddev(rastertable text, rastercolumn text, hasnodata boolean, sample_percent double precision, OUT stddev double precision)
@@ -627,12 +629,12 @@ CREATE OR REPLACE FUNCTION st_approxstddev(rastertable text, rastercolumn text,
 
 CREATE OR REPLACE FUNCTION st_approxstddev(rastertable text, rastercolumn text, sample_percent double precision, OUT stddev double precision)
        RETURNS double precision
-       AS $$ SELECT stddev FROM _st_summarystats($1, $2, 1, FALSE, $3) $$
+       AS $$ SELECT stddev FROM _st_summarystats($1, $2, 1, TRUE, $3) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxstddev(rastertable text, rastercolumn text, OUT stddev double precision)
        RETURNS double precision
-       AS $$ SELECT stddev FROM _st_summarystats($1, $2, 1, FALSE, 0.1) $$
+       AS $$ SELECT stddev FROM _st_summarystats($1, $2, 1, TRUE, 0.1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 -----------------------------------------------------------------------
@@ -645,7 +647,7 @@ CREATE OR REPLACE FUNCTION st_minmax(rast raster, nband int, hasnodata boolean,
 
 CREATE OR REPLACE FUNCTION st_minmax(rast raster, nband int, OUT min double precision, OUT max double precision)
        RETURNS record
-       AS $$ SELECT min, max FROM _st_summarystats($1, $2, FALSE, 1) $$
+       AS $$ SELECT min, max FROM _st_summarystats($1, $2, TRUE, 1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_minmax(rast raster, hasnodata boolean, OUT min double precision, OUT max double precision)
@@ -655,7 +657,7 @@ CREATE OR REPLACE FUNCTION st_minmax(rast raster, hasnodata boolean, OUT min dou
 
 CREATE OR REPLACE FUNCTION st_minmax(rast raster, OUT min double precision, OUT max double precision)
        RETURNS record
-       AS $$ SELECT min, max FROM _st_summarystats($1, 1, FALSE, 1) $$
+       AS $$ SELECT min, max FROM _st_summarystats($1, 1, TRUE, 1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxminmax(rast raster, nband int, hasnodata boolean, sample_percent double precision, OUT min double precision, OUT max double precision)
@@ -665,7 +667,7 @@ CREATE OR REPLACE FUNCTION st_approxminmax(rast raster, nband int, hasnodata boo
 
 CREATE OR REPLACE FUNCTION st_approxminmax(rast raster, nband int, sample_percent double precision, OUT min double precision, OUT max double precision)
        RETURNS record
-       AS $$ SELECT min, max FROM _st_summarystats($1, $2, FALSE, $3) $$
+       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, OUT min double precision, OUT max double precision)
@@ -675,12 +677,12 @@ CREATE OR REPLACE FUNCTION st_approxminmax(rast raster, hasnodata boolean, sampl
 
 CREATE OR REPLACE FUNCTION st_approxminmax(rast raster, sample_percent double precision, OUT min double precision, OUT max double precision)
        RETURNS record
-       AS $$ SELECT min, max FROM _st_summarystats($1, 1, FALSE, $2) $$
+       AS $$ SELECT min, max FROM _st_summarystats($1, 1, TRUE, $2) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxminmax(rast raster, OUT min double precision, OUT max double precision)
        RETURNS record
-       AS $$ SELECT min, max FROM _st_summarystats($1, 1, FALSE, 0.1) $$
+       AS $$ SELECT min, max FROM _st_summarystats($1, 1, TRUE, 0.1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_minmax(rastertable text, rastercolumn text, nband int, hasnodata boolean, OUT min double precision, OUT max double precision)
@@ -690,7 +692,7 @@ CREATE OR REPLACE FUNCTION st_minmax(rastertable text, rastercolumn text, nband
 
 CREATE OR REPLACE FUNCTION st_minmax(rastertable text, rastercolumn text, nband int, OUT min double precision, OUT max double precision)
        RETURNS record
-       AS $$ SELECT min, max FROM _st_summarystats($1, $2, $3, FALSE, 1) $$
+       AS $$ SELECT min, max FROM _st_summarystats($1, $2, $3, TRUE, 1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_minmax(rastertable text, rastercolumn text, hasnodata boolean, OUT min double precision, OUT max double precision)
@@ -700,7 +702,7 @@ CREATE OR REPLACE FUNCTION st_minmax(rastertable text, rastercolumn text, hasnod
 
 CREATE OR REPLACE FUNCTION st_minmax(rastertable text, rastercolumn text, OUT min double precision, OUT max double precision)
        RETURNS record
-       AS $$ SELECT min, max FROM _st_summarystats($1, $2, 1, FALSE, 1) $$
+       AS $$ SELECT min, max FROM _st_summarystats($1, $2, 1, TRUE, 1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxminmax(rastertable text, rastercolumn text, nband int, hasnodata boolean, sample_percent double precision, OUT min double precision, OUT max double precision)
@@ -710,7 +712,7 @@ CREATE OR REPLACE FUNCTION st_approxminmax(rastertable text, rastercolumn text,
 
 CREATE OR REPLACE FUNCTION st_approxminmax(rastertable text, rastercolumn text, nband int, sample_percent double precision, OUT min double precision, OUT max double precision)
        RETURNS record
-       AS $$ SELECT min, max FROM _st_summarystats($1, $2, $3, FALSE, $4) $$
+       AS $$ SELECT min, max FROM _st_summarystats($1, $2, $3, TRUE, $4) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxminmax(rastertable text, rastercolumn text, hasnodata boolean, sample_percent double precision, OUT min double precision, OUT max double precision)
@@ -720,12 +722,12 @@ CREATE OR REPLACE FUNCTION st_approxminmax(rastertable text, rastercolumn text,
 
 CREATE OR REPLACE FUNCTION st_approxminmax(rastertable text, rastercolumn text, sample_percent double precision, OUT min double precision, OUT max double precision)
        RETURNS record
-       AS $$ SELECT min, max FROM _st_summarystats($1, $2, 1, FALSE, $3) $$
+       AS $$ SELECT min, max FROM _st_summarystats($1, $2, 1, TRUE, $3) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxminmax(rastertable text, rastercolumn text, OUT min double precision, OUT max double precision)
        RETURNS record
-       AS $$ SELECT min, max FROM _st_summarystats($1, $2, 1, FALSE, 0.1) $$
+       AS $$ SELECT min, max FROM _st_summarystats($1, $2, 1, TRUE, 0.1) $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 -----------------------------------------------------------------------
@@ -766,27 +768,27 @@ CREATE OR REPLACE FUNCTION st_histogram(rast raster, nband int, hasnodata boolea
 
 CREATE OR REPLACE FUNCTION st_histogram(rast raster, nband int)
        RETURNS SETOF histogram
-       AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, $2, FALSE, 1, 0, NULL, FALSE) $$
+       AS $$ SELECT min, max, count, proportion 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, FALSE, 1, 0, NULL, FALSE) $$
+       AS $$ SELECT min, max, count, proportion 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, FALSE, 1, $3, $4, $5) $$
+       AS $$ SELECT min, max, count, proportion 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, FALSE, 1, $3, NULL, $4) $$
+       AS $$ SELECT min, max, count, proportion 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, FALSE, 1, $3, NULL, FALSE) $$
+       AS $$ SELECT min, max, count, proportion 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)
@@ -811,37 +813,37 @@ CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster, nband int, hasnodata
 
 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, FALSE, $3, 0, NULL, FALSE) $$
+       AS $$ SELECT min, max, count, proportion 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, FALSE, 0.1, 0, NULL, FALSE) $$
+       AS $$ SELECT min, max, count, proportion 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, FALSE, $2, 0, NULL, FALSE) $$
+       AS $$ SELECT min, max, count, proportion 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, FALSE, 0.1, 0, NULL, FALSE) $$
+       AS $$ SELECT min, max, count, proportion 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, FALSE, $3, $4, $5, $6) $$
+       AS $$ SELECT min, max, count, proportion 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, FALSE, $3, $4, NULL, $5) $$
+       AS $$ SELECT min, max, count, proportion 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, FALSE, $3, $4, NULL, FALSE) $$
+       AS $$ SELECT min, max, count, proportion FROM _st_histogram($1, $2, TRUE, $3, $4, NULL, FALSE) $$
        LANGUAGE 'sql' IMMUTABLE STRICT;
 
 -----------------------------------------------------------------------
@@ -865,7 +867,7 @@ CREATE OR REPLACE FUNCTION st_quantile(rast raster, nband int, hasnodata boolean
 
 CREATE OR REPLACE FUNCTION st_quantile(rast raster, nband int, quantiles double precision[])
        RETURNS SETOF quantile
-       AS $$ SELECT quantile, value FROM _st_quantile($1, $2, FALSE, 1, $3) $$
+       AS $$ SELECT quantile, value FROM _st_quantile($1, $2, TRUE, 1, $3) $$
        LANGUAGE 'sql' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_quantile(rast raster, nband int, hasnodata boolean)
@@ -875,17 +877,17 @@ CREATE OR REPLACE FUNCTION st_quantile(rast raster, nband int, hasnodata boolean
 
 CREATE OR REPLACE FUNCTION st_quantile(rast raster, nband int)
        RETURNS SETOF quantile
-       AS $$ SELECT quantile, value FROM _st_quantile($1, $2, FALSE, 1, NULL) $$
+       AS $$ SELECT quantile, value FROM _st_quantile($1, $2, TRUE, 1, NULL) $$
        LANGUAGE 'sql' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_quantile(rast raster, quantiles double precision[])
        RETURNS SETOF quantile
-       AS $$ SELECT quantile, value FROM _st_quantile($1, 1, FALSE, 1, $2) $$
+       AS $$ SELECT quantile, value FROM _st_quantile($1, 1, TRUE, 1, $2) $$
        LANGUAGE 'sql' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_quantile(rast raster)
        RETURNS SETOF quantile
-       AS $$ SELECT quantile, value FROM _st_quantile($1, 1, FALSE, 1, NULL) $$
+       AS $$ SELECT quantile, value FROM _st_quantile($1, 1, TRUE, 1, NULL) $$
        LANGUAGE 'sql' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_quantile(rast raster, nband int, hasnodata boolean, quantile double precision)
@@ -895,7 +897,7 @@ CREATE OR REPLACE FUNCTION st_quantile(rast raster, nband int, hasnodata boolean
 
 CREATE OR REPLACE FUNCTION st_quantile(rast raster, nband int, quantile double precision)
        RETURNS quantile
-       AS $$ SELECT quantile, value FROM _st_quantile($1, $2, FALSE, 1, ARRAY[$3]::double precision[]) $$
+       AS $$ SELECT quantile, value FROM _st_quantile($1, $2, TRUE, 1, ARRAY[$3]::double precision[]) $$
        LANGUAGE 'sql' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_quantile(rast raster, hasnodata boolean, quantile double precision)
@@ -905,7 +907,7 @@ CREATE OR REPLACE FUNCTION st_quantile(rast raster, hasnodata boolean, quantile
 
 CREATE OR REPLACE FUNCTION st_quantile(rast raster, quantile double precision)
        RETURNS quantile
-       AS $$ SELECT quantile, value FROM _st_quantile($1, 1, FALSE, 1, ARRAY[$2]::double precision[]) $$
+       AS $$ SELECT quantile, value FROM _st_quantile($1, 1, TRUE, 1, ARRAY[$2]::double precision[]) $$
        LANGUAGE 'sql' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, nband int, hasnodata boolean, sample_percent double precision, quantiles double precision[])
@@ -915,37 +917,37 @@ CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, nband int, hasnodata b
 
 CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, nband int, sample_percent double precision, quantiles double precision[])
        RETURNS SETOF quantile
-       AS $$ SELECT quantile, value FROM _st_quantile($1, $2, FALSE, $3, $4) $$
+       AS $$ SELECT quantile, value FROM _st_quantile($1, $2, TRUE, $3, $4) $$
        LANGUAGE 'sql' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, nband int, sample_percent double precision)
        RETURNS SETOF quantile
-       AS $$ SELECT quantile, value FROM _st_quantile($1, $2, FALSE, $3, NULL) $$
+       AS $$ SELECT quantile, value FROM _st_quantile($1, $2, TRUE, $3, NULL) $$
        LANGUAGE 'sql' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, sample_percent double precision, quantiles double precision[])
        RETURNS SETOF quantile
-       AS $$ SELECT quantile, value FROM _st_quantile($1, 1, FALSE, $2, $3) $$
+       AS $$ SELECT quantile, value FROM _st_quantile($1, 1, TRUE, $2, $3) $$
        LANGUAGE 'sql' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, sample_percent double precision)
        RETURNS SETOF quantile
-       AS $$ SELECT quantile, value FROM _st_quantile($1, 1, FALSE, $2, NULL) $$
+       AS $$ SELECT quantile, value FROM _st_quantile($1, 1, TRUE, $2, NULL) $$
        LANGUAGE 'sql' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, quantiles double precision[])
        RETURNS SETOF quantile
-       AS $$ SELECT quantile, value FROM _st_quantile($1, 1, FALSE, 0.1, $2) $$
+       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)
        RETURNS SETOF quantile
-       AS $$ SELECT quantile, value FROM _st_quantile($1, $2, FALSE, 0.1, NULL) $$
+       AS $$ SELECT quantile, value FROM _st_quantile($1, $2, TRUE, 0.1, NULL) $$
        LANGUAGE 'sql' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxquantile(rast raster)
        RETURNS SETOF quantile
-       AS $$ SELECT quantile, value FROM _st_quantile($1, 1, FALSE, 0.1, NULL) $$
+       AS $$ SELECT quantile, value FROM _st_quantile($1, 1, TRUE, 0.1, NULL) $$
        LANGUAGE 'sql' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, nband int, hasnodata boolean, sample_percent double precision, quantile double precision)
@@ -955,12 +957,12 @@ CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, nband int, hasnodata b
 
 CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, nband int, sample_percent double precision, quantile double precision)
        RETURNS quantile
-       AS $$ SELECT quantile, value FROM _st_quantile($1, $2, FALSE, $3, ARRAY[$4]::double precision[]) $$
+       AS $$ SELECT quantile, value FROM _st_quantile($1, $2, TRUE, $3, ARRAY[$4]::double precision[]) $$
        LANGUAGE 'sql' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, sample_percent double precision, quantile double precision)
        RETURNS quantile
-       AS $$ SELECT quantile, value FROM _st_quantile($1, 1, FALSE, $2, ARRAY[$3]::double precision[]) $$
+       AS $$ SELECT quantile, value FROM _st_quantile($1, 1, TRUE, $2, ARRAY[$3]::double precision[]) $$
        LANGUAGE 'sql' IMMUTABLE STRICT;
 
 CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, hasnodata boolean, quantile double precision)
index 6b4552a3eb101042802c06eb1875cf69b4f3f5e6..b5d58e532cd61a05a2a25e70d1bd6d2cebf4e314 100644 (file)
@@ -11,6 +11,8 @@
 #
 #
 ###############################################################################
+# Copyright (C) 2011 Regents of the University of California
+#   <bkpark@ucdavis.edu>
 # Copyright (C) 2009 Mateusz Loskot <mateusz@loskot.net>
 # 
 # This program is free software; you can redistribute it and/or modify
index ef4e912b15434120530f47598aaef805a1d5a247..6fae70868e35b2560e2cb7afa5082d9ef048dec4 100644 (file)
@@ -1046,7 +1046,7 @@ static void testBandStats() {
        nodata = rt_band_get_nodata(band);
        CHECK_EQUALS(nodata, 0);
 
-       stats = (rt_bandstats) rt_band_get_summary_stats(band, 0, 0, 1);
+       stats = (rt_bandstats) rt_band_get_summary_stats(band, 1, 0, 1);
        CHECK(stats);
        CHECK_EQUALS(stats->min, 1);
        CHECK_EQUALS(stats->max, 19998);
@@ -1070,7 +1070,7 @@ static void testBandStats() {
        rtdealloc(stats->values);
        rtdealloc(stats);
 
-       stats = (rt_bandstats) rt_band_get_summary_stats(band, 0, 0.1, 1);
+       stats = (rt_bandstats) rt_band_get_summary_stats(band, 1, 0.1, 1);
        CHECK(stats);
 
        quantile = (rt_quantile) rt_band_get_quantiles(stats, NULL, 0, &count);
@@ -1089,19 +1089,19 @@ static void testBandStats() {
        rtdealloc(stats->values);
        rtdealloc(stats);
 
-       stats = (rt_bandstats) rt_band_get_summary_stats(band, 0, 0.15, 0);
+       stats = (rt_bandstats) rt_band_get_summary_stats(band, 1, 0.15, 0);
        CHECK(stats);
        rtdealloc(stats);
 
-       stats = (rt_bandstats) rt_band_get_summary_stats(band, 0, 0.2, 0);
+       stats = (rt_bandstats) rt_band_get_summary_stats(band, 1, 0.2, 0);
        CHECK(stats);
        rtdealloc(stats);
 
-       stats = (rt_bandstats) rt_band_get_summary_stats(band, 0, 0.25, 0);
+       stats = (rt_bandstats) rt_band_get_summary_stats(band, 1, 0.25, 0);
        CHECK(stats);
        rtdealloc(stats);
 
-       stats = (rt_bandstats) rt_band_get_summary_stats(band, 1, 0, 1);
+       stats = (rt_bandstats) rt_band_get_summary_stats(band, 0, 0, 1);
        CHECK(stats);
        CHECK_EQUALS(stats->min, 0);
        CHECK_EQUALS(stats->max, 19998);
@@ -1113,7 +1113,7 @@ static void testBandStats() {
        rtdealloc(stats->values);
        rtdealloc(stats);
 
-       stats = (rt_bandstats) rt_band_get_summary_stats(band, 1, 0.1, 1);
+       stats = (rt_bandstats) rt_band_get_summary_stats(band, 0, 0.1, 1);
        CHECK(stats);
 
        quantile = (rt_quantile) rt_band_get_quantiles(stats, NULL, 0, &count);
index b7eae7402c4ad80cd60cd08c139f46ca565f4e21..d9ab152b2e38ceb3f86df2a9c2d732da3fdcd0ed 100644 (file)
@@ -3,6 +3,8 @@
 #
 # Copyright (c) 2009 Sandro Santilli <strk@keybit.net>, Pierre Racine <pierre.racine@sbf.ulaval.ca>
 # Copyright (c) 2011 Jorge Arevalo <jorge.arevalo@deimos-space.com>
+# Copyright (c) 2011 Regents of the University of California
+#   <bkpark@ucdavis.edu>
 #
 # This is free software; you can redistribute and/or modify it under
 # the terms of the GNU General Public Licence. See the COPYING file.
index b6791e2423fc308ff1419c9fa73a4beef176f5d1..2dc91f6366bbeadf629ad542f431130476638935 100644 (file)
@@ -42,7 +42,7 @@ SELECT * FROM ST_Histogram(
                )
                , 1, 5, 5, 3.14159
        ),
-       1, TRUE, 0, ARRAY[]::double precision[], FALSE
+       1, FALSE, 0, ARRAY[]::double precision[], FALSE
 );
 SELECT * FROM ST_Histogram(
        ST_SetValue(
@@ -58,7 +58,7 @@ SELECT * FROM ST_Histogram(
                )
                , 1, 5, 5, 3.14159
        ),
-       1, TRUE, 1, FALSE
+       1, FALSE, 1, FALSE
 );
 SELECT * FROM ST_Histogram(
        ST_SetValue(
@@ -74,7 +74,7 @@ SELECT * FROM ST_Histogram(
                )
                , 1, 5, 5, 3.14159
        ),
-       1, TRUE, 5
+       1, FALSE, 5
 );
 SELECT * FROM ST_Histogram(
        ST_SetValue(
@@ -90,7 +90,7 @@ SELECT * FROM ST_Histogram(
                )
                , 1, 5, 5, 3.14159
        ),
-       1, TRUE
+       1, FALSE
 );
 SELECT * FROM ST_Histogram(
        ST_SetValue(
index 9155154e61d5b794f2e83d821bea80fae37351a6..3a17f3c5c3fb261a3f5c22480eafb19797433622 100644 (file)
@@ -12,7 +12,7 @@ SELECT * FROM ST_Mean(
                )
                , 1, 5, 5, 3.14159
        )
-       , FALSE
+       , TRUE
 );
 SELECT ST_Mean(
        ST_SetValue(
@@ -28,7 +28,7 @@ SELECT ST_Mean(
                )
                , 1, 5, 5, 3.14159
        )
-       , FALSE
+       , TRUE
 );
 SELECT mean FROM ST_Mean(
        ST_SetValue(
@@ -44,7 +44,7 @@ SELECT mean FROM ST_Mean(
                )
                , 1, 5, 5, 3.14159
        )
-       , FALSE
+       , TRUE
 );
 SELECT mean FROM ST_Mean(
        ST_SetValue(
@@ -60,7 +60,7 @@ SELECT mean FROM ST_Mean(
                )
                , 1, 5, 5, 3.14159
        )
-       , TRUE
+       , FALSE
 );
 BEGIN;
 CREATE TEMP TABLE test
@@ -86,8 +86,8 @@ CREATE TEMP TABLE test
                SELECT generate_series(1, 10) AS id
        ) AS id
                ON 1 = 1;
-SELECT * FROM ST_Mean('test', 'rast', 1, FALSE);
 SELECT * FROM ST_Mean('test', 'rast', 1, TRUE);
+SELECT * FROM ST_Mean('test', 'rast', 1, FALSE);
 SELECT * FROM ST_Mean('test', 'rast', 1);
 SELECT * FROM ST_Mean('test', 'rast');
 ROLLBACK;
index 887d19f1a3d344ba6bade98f4a6de68ddb28c558..db91483393d845e73a8837f4fe2d3e8d09677c20 100644 (file)
@@ -12,7 +12,7 @@ SELECT min, max FROM ST_MinMax(
                )
                , 1, 5, 5, 3.14159
        )
-       , FALSE
+       , TRUE
 );
 SELECT ST_MinMax(
        ST_SetValue(
@@ -28,7 +28,7 @@ SELECT ST_MinMax(
                )
                , 1, 5, 5, 3.14159
        )
-       , FALSE
+       , TRUE
 );
 SELECT min FROM ST_MinMax(
        ST_SetValue(
@@ -44,7 +44,7 @@ SELECT min FROM ST_MinMax(
                )
                , 1, 5, 5, 3.14159
        )
-       , FALSE
+       , TRUE
 );
 SELECT max,max FROM ST_MinMax(
        ST_SetValue(
@@ -60,5 +60,5 @@ SELECT max,max FROM ST_MinMax(
                )
                , 1, 5, 5, 3.14159
        )
-       , FALSE
+       , TRUE
 );
index b0204f0c3a128ec29a6fb612a0b84bd35a23d451..3ee41af7a6e294bb5b08c05523234b99d28d59cd 100644 (file)
@@ -12,7 +12,7 @@ SELECT * FROM ST_Quantile(
                )
                , 1, 5, 5, 3.14159
        )
-       , 1, TRUE, ARRAY[0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]::double precision[]
+       , 1, FALSE, ARRAY[0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]::double precision[]
 );
 SELECT * FROM ST_Quantile(
        ST_SetValue(
@@ -44,7 +44,7 @@ SELECT * FROM ST_Quantile(
                )
                , 1, 5, 5, 3.14159
        ),
-       1, TRUE
+       1, FALSE
 );
 SELECT * FROM ST_Quantile(
        ST_SetValue(
@@ -107,7 +107,7 @@ SELECT * FROM ST_Quantile(
                )
                , 1, 5, 5, 3.14159
        ),
-       1, TRUE, 0.05
+       1, FALSE, 0.05
 );
 SELECT * FROM ST_Quantile(
        ST_SetValue(
@@ -139,7 +139,7 @@ SELECT * FROM ST_Quantile(
                )
                , 1, 5, 5, 3.14159
        ),
-       TRUE, 0.7
+       FALSE, 0.7
 );
 SELECT * FROM ST_Quantile(
        ST_SetValue(
index 48bc9935e4db7483ab4c102eadc188f8202ecb2b..84370ddf8e40e9d0b299c90a20c1862cddeea5eb 100644 (file)
@@ -12,7 +12,7 @@ SELECT * FROM ST_StdDev(
                )
                , 1, 5, 5, 3.14159
        )
-       , FALSE
+       , TRUE
 );
 SELECT ST_StdDev(
        ST_SetValue(
@@ -28,7 +28,7 @@ SELECT ST_StdDev(
                )
                , 1, 5, 5, 3.14159
        )
-       , FALSE
+       , TRUE
 );
 SELECT stddev FROM ST_StdDev(
        ST_SetValue(
@@ -44,7 +44,7 @@ SELECT stddev FROM ST_StdDev(
                )
                , 1, 5, 5, 3.14159
        )
-       , FALSE
+       , TRUE
 );
 SELECT stddev FROM ST_StdDev(
        ST_SetValue(
@@ -60,7 +60,7 @@ SELECT stddev FROM ST_StdDev(
                )
                , 1, 5, 5, 3.14159
        )
-       , TRUE
+       , FALSE
 );
 BEGIN;
 CREATE TEMP TABLE test
@@ -86,8 +86,8 @@ CREATE TEMP TABLE test
                SELECT generate_series(1, 10) AS id
        ) AS id
                ON 1 = 1;
-SELECT * FROM ST_StdDev('test', 'rast', 1, FALSE);
 SELECT * FROM ST_StdDev('test', 'rast', 1, TRUE);
+SELECT * FROM ST_StdDev('test', 'rast', 1, FALSE);
 SELECT * FROM ST_StdDev('test', 'rast', 1);
 SELECT * FROM ST_StdDev('test', 'rast');
 ROLLBACK;
index 9b09b10ed338a57797befe884ae2a5d2e6543717..97267631cd186fcb2feb97ff16989f4ff2edb3ad 100644 (file)
@@ -12,7 +12,7 @@ SELECT * FROM ST_SummaryStats(
                )
                , 1, 5, 5, 3.14159
        )
-       , FALSE
+       , TRUE
 );
 SELECT ST_SummaryStats(
        ST_SetValue(
@@ -28,7 +28,7 @@ SELECT ST_SummaryStats(
                )
                , 1, 5, 5, 3.14159
        )
-       , FALSE
+       , TRUE
 );
 SELECT count FROM ST_SummaryStats(
        ST_SetValue(
@@ -44,7 +44,7 @@ SELECT count FROM ST_SummaryStats(
                )
                , 1, 5, 5, 3.14159
        )
-       , FALSE
+       , TRUE
 );
 SELECT count FROM ST_SummaryStats(
        ST_SetValue(
@@ -60,7 +60,7 @@ SELECT count FROM ST_SummaryStats(
                )
                , 1, 5, 5, 3.14159
        )
-       , TRUE
+       , FALSE
 );
 SELECT mean, stddev FROM ST_SummaryStats(
        ST_SetValue(
@@ -76,7 +76,7 @@ SELECT mean, stddev FROM ST_SummaryStats(
                )
                , 1, 5, 5, 3.14159
        )
-       , FALSE
+       , TRUE
 );
 SELECT mean, stddev FROM ST_SummaryStats(
        ST_SetValue(
@@ -92,7 +92,7 @@ SELECT mean, stddev FROM ST_SummaryStats(
                )
                , 1, 5, 5, 3.14159
        )
-       , TRUE
+       , FALSE
 );
 BEGIN;
 CREATE TEMP TABLE test
@@ -118,8 +118,8 @@ CREATE TEMP TABLE test
                SELECT generate_series(1, 10) AS id
        ) AS id
                ON 1 = 1;
-SELECT * FROM ST_SummaryStats('test', 'rast', 1, FALSE);
 SELECT * FROM ST_SummaryStats('test', 'rast', 1, TRUE);
+SELECT * FROM ST_SummaryStats('test', 'rast', 1, FALSE);
 SELECT * FROM ST_SummaryStats('test', 'rast', 1);
 SELECT * FROM ST_SummaryStats('test', 'rast');
 ROLLBACK;