PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ rtpg_union_mean_callback()

static int rtpg_union_mean_callback ( rt_iterator_arg  arg,
void *  userarg,
double *  value,
int *  nodata 
)
static

Definition at line 1887 of file rtpg_mapalgebra.c.

1890  {
1891  if (arg == NULL)
1892  return 0;
1893 
1894  if (
1895  arg->rasters != 2 ||
1896  arg->rows != 1 ||
1897  arg->columns != 1
1898  ) {
1899  elog(ERROR, "rtpg_union_mean_callback: Invalid arguments passed to callback");
1900  return 0;
1901  }
1902 
1903  *value = 0;
1904  *nodata = 1;
1905 
1906  POSTGIS_RT_DEBUGF(4, "rast0: %f %d", arg->values[0][0][0], arg->nodata[0][0][0]);
1907  POSTGIS_RT_DEBUGF(4, "rast1: %f %d", arg->values[1][0][0], arg->nodata[1][0][0]);
1908 
1909  if (
1910  !arg->nodata[0][0][0] &&
1911  FLT_NEQ(arg->values[0][0][0], 0) &&
1912  !arg->nodata[1][0][0]
1913  ) {
1914  *value = arg->values[1][0][0] / arg->values[0][0][0];
1915  *nodata = 0;
1916  }
1917 
1918  POSTGIS_RT_DEBUGF(4, "value, nodata = (%f, %d)", *value, *nodata);
1919 
1920  return 1;
1921 }
#define FLT_NEQ(x, y)
Definition: librtcore.h:2233
int value
Definition: genraster.py:61
#define POSTGIS_RT_DEBUGF(level, msg,...)
Definition: rtpostgis.h:65
double *** values
Definition: librtcore.h:2459
uint32_t columns
Definition: librtcore.h:2455
uint16_t rasters
Definition: librtcore.h:2451

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, genraster::value, and rt_iterator_arg_t::values.

Referenced by RASTER_union_finalfn().

Here is the caller graph for this function: