PostGIS  2.1.10dev-r@@SVN_REVISION@@
static int rtpg_union_mean_callback ( rt_iterator_arg  arg,
void *  userarg,
double *  value,
int *  nodata 
)
static

Definition at line 17886 of file rt_pg.c.

References rt_iterator_arg_t::columns, FLT_NEQ, rt_iterator_arg_t::nodata, POSTGIS_RT_DEBUGF, rt_iterator_arg_t::rasters, rt_iterator_arg_t::rows, and rt_iterator_arg_t::values.

Referenced by RASTER_union_finalfn().

17889  {
17890  if (arg == NULL)
17891  return 0;
17892 
17893  if (
17894  arg->rasters != 2 ||
17895  arg->rows != 1 ||
17896  arg->columns != 1
17897  ) {
17898  elog(ERROR, "rtpg_union_mean_callback: Invalid arguments passed to callback");
17899  return 0;
17900  }
17901 
17902  *value = 0;
17903  *nodata = 1;
17904 
17905  POSTGIS_RT_DEBUGF(4, "rast0: %f %d", arg->values[0][0][0], arg->nodata[0][0][0]);
17906  POSTGIS_RT_DEBUGF(4, "rast1: %f %d", arg->values[1][0][0], arg->nodata[1][0][0]);
17907 
17908  if (
17909  !arg->nodata[0][0][0] &&
17910  FLT_NEQ(arg->values[0][0][0], 0) &&
17911  !arg->nodata[1][0][0]
17912  ) {
17913  *value = arg->values[1][0][0] / arg->values[0][0][0];
17914  *nodata = 0;
17915  }
17916 
17917  POSTGIS_RT_DEBUGF(4, "value, nodata = (%f, %d)", *value, *nodata);
17918 
17919  return 1;
17920 }
#define FLT_NEQ(x, y)
Definition: rt_api.h:2158
uint32_t rows
Definition: rt_api.h:2370
uint32_t columns
Definition: rt_api.h:2372
uint16_t rasters
Definition: rt_api.h:2368
double *** values
Definition: rt_api.h:2376
#define POSTGIS_RT_DEBUGF(level, msg,...)
Definition: rt_pg.h:62
int *** nodata
Definition: rt_api.h:2378

Here is the caller graph for this function: