* tweak the deviation factor used in computation with
* SDFACTOR.
*/
-#define USE_STANDARD_DEVIATION 1
#define SDFACTOR 3.25
double total_width = 0;
int notnull_cnt = 0, examinedsamples = 0, total_count_cells=0, total_cells_coverage = 0;
-#if USE_STANDARD_DEVIATION
/* for standard deviation */
double avgLOWx, avgLOWy, avgLOWz, avgHIGx, avgHIGy, avgHIGz;
double sumLOWx = 0, sumLOWy = 0, sumLOWz = 0, sumHIGx = 0, sumHIGy = 0, sumHIGz = 0;
double sdLOWx = 0, sdLOWy = 0, sdLOWz = 0, sdHIGx = 0, sdHIGy = 0, sdHIGz = 0;
GBOX *newhistobox = NULL;
-#endif
bool isnull;
int i;
{
Datum datum;
GSERIALIZED *serialized;
- LWGEOM *geometry;
/* Fetch the datum and cast it into a geography */
datum = fetchfunc(stats, i, &isnull);
if (isnull)
continue;
-// serialized = (GSERIALIZED *)PG_DETOAST_DATUM(datum);
-// geometry = lwgeom_from_gserialized(serialized);
-
/* Convert coordinates to 3D geodesic */
if ( ! gserialized_datum_get_gbox_p(datum, &gbox) )
{
/** TODO: ask if we need geom or bvol size for stawidth */
total_width += VARSIZE(serialized);
-#if USE_STANDARD_DEVIATION
/*
* Add bvol coordinates to sum for standard deviation
* computation.
sumHIGx += gbox.xmax;
sumHIGy += gbox.ymax;
sumHIGz += gbox.zmax;
-#endif
notnull_cnt++;
return;
}
-#if USE_STANDARD_DEVIATION
-
POSTGIS_DEBUG(3, "Standard deviation filter enabled");
/*
if ( histobox.zmax > newhistobox->zmax )
histobox.zmax = newhistobox->zmax;
-#else /* ! USE_STANDARD_DEVIATION */
-
- /*
- * Set histogram extent box
- */
- histobox.xmin = sample_extent->xmin;
- histobox.ymin = sample_extent->ymin;
- histobox.zmin = sample_extent->zmin;
- histobox.xmax = sample_extent->xmax;
- histobox.ymax = sample_extent->ymax;
- histobox.zmax = sample_extent->zmax;
-
-#endif /* USE_STANDARD_DEVIATION */
-
-
POSTGIS_DEBUGF(3, " histogram_extent: xmin, ymin, zmin: %f, %f, %f",
histobox.xmin, histobox.ymin, histobox.zmin);
POSTGIS_DEBUGF(3, " histogram_extent: xmax, ymax, zmax: %f, %f, %f",
* tweak the deviation factor used in computation with
* SDFACTOR.
*/
-#define USE_STANDARD_DEVIATION 1
#define SDFACTOR 3.25
typedef struct GEOM_STATS_T
double cell_area;
double cell_width;
double cell_height;
-#if USE_STANDARD_DEVIATION
+
/* for standard deviation */
double avgLOWx, avgLOWy, avgHIGx, avgHIGy;
double sumLOWx=0, sumLOWy=0, sumHIGx=0, sumHIGy=0;
double sdLOWx=0, sdLOWy=0, sdHIGx=0, sdHIGy=0;
GBOX *newhistobox=NULL;
-#endif
+
double geow, geoh; /* width and height of histogram */
int histocells;
int cols, rows; /* histogram grid size */
total_width += VARSIZE(geom);
total_boxes_area += (box.xmax-box.xmin)*(box.ymax-box.ymin);
-#if USE_STANDARD_DEVIATION
/*
* Add bvol coordinates to sum for standard deviation
* computation.
sumLOWy += box.ymin;
sumHIGx += box.xmax;
sumHIGy += box.ymax;
-#endif
notnull_cnt++;
return;
}
-#if USE_STANDARD_DEVIATION
POSTGIS_DEBUGF(3, " sample_extent: xmin,ymin: %f,%f",
sample_extent->xmin, sample_extent->ymin);
histobox.ymax = newhistobox->ymax;
-#else /* ! USE_STANDARD_DEVIATION */
-
- /*
- * Set histogram extent box
- */
- histobox.xmin = sample_extent->xmin;
- histobox.ymin = sample_extent->ymin;
- histobox.xmax = sample_extent->xmax;
- histobox.ymax = sample_extent->ymax;
-#endif /* USE_STANDARD_DEVIATION */
-
-
POSTGIS_DEBUGF(3, " histogram_extent: xmin,ymin: %f,%f",
histobox.xmin, histobox.ymin);
POSTGIS_DEBUGF(3, " histogram_extent: xmax,ymax: %f,%f",