}
/* band is NODATA */
- if (band->hasnodata && band->isnodata) {
+ if (band->isnodata) {
RASTER_DEBUG(3, "Band's isnodata flag is TRUE. Returning NODATA value");
*value = band->nodataval;
if (nodata != NULL) *nodata = 1;
const uint32_t MAX_VALUES = 750;
uint8_t *data = NULL;
- int hasnodata = FALSE;
- double nodata = 0;
double value;
int isnodata = 0;
return NULL;
}
- hasnodata = rt_band_get_hasnodata_flag(band);
- if (hasnodata != FALSE)
- rt_band_get_nodata(band, &nodata);
- else
+ if (!rt_band_get_hasnodata_flag(band))
exclude_nodata_value = 0;
- RASTER_DEBUGF(3, "nodata = %f", nodata);
- RASTER_DEBUGF(3, "hasnodata = %d", hasnodata);
RASTER_DEBUGF(3, "exclude_nodata_value = %d", exclude_nodata_value);
/* quantile_llist not provided */
rt_valuecount vcnts = NULL;
rt_pixtype pixtype = PT_END;
uint8_t *data = NULL;
- int hasnodata = FALSE;
double nodata = 0;
int scale = 0;
uint32_t y = 0;
int rtn;
double pxlval;
+ int isnodata = 0;
double rpxlval;
uint32_t total = 0;
int vcnts_count = 0;
pixtype = band->pixtype;
- hasnodata = rt_band_get_hasnodata_flag(band);
- if (hasnodata != FALSE)
+ if (rt_band_get_hasnodata_flag(band)) {
rt_band_get_nodata(band, &nodata);
- else
+ RASTER_DEBUGF(3, "hasnodata, nodataval = 1, %f", nodata);
+ }
+ else {
exclude_nodata_value = 0;
+ RASTER_DEBUG(3, "hasnodata, nodataval = 0, 0");
+ }
- RASTER_DEBUGF(3, "nodata = %f", nodata);
- RASTER_DEBUGF(3, "hasnodata = %d", hasnodata);
RASTER_DEBUGF(3, "exclude_nodata_value = %d", exclude_nodata_value);
/* process roundto */
for (x = 0; x < band->width; x++) {
for (y = 0; y < band->height; y++) {
- rtn = rt_band_get_pixel(band, x, y, &pxlval, NULL);
+ rtn = rt_band_get_pixel(band, x, y, &pxlval, &isnodata);
/* error getting value, continue */
if (rtn == -1) continue;
- if (
- !exclude_nodata_value || (
- exclude_nodata_value &&
- (hasnodata != FALSE) && (
- FLT_NEQ(pxlval, nodata) &&
- (rt_band_clamped_value_is_nodata(band, pxlval) != 1)
- )
- )
- ) {
+ if (!exclude_nodata_value || (exclude_nodata_value && !isnodata)) {
total++;
if (doround) {
rpxlval = ROUND(pxlval, scale);
void *mem = NULL;
uint32_t src_hasnodata = 0;
double src_nodataval = 0.0;
+ int isnodata = 0;
int rtn;
uint32_t x;
for (x = 0; x < width; x++) {
for (y = 0; y < height; y++) {
- rtn = rt_band_get_pixel(srcband, x, y, &ov, NULL);
+ rtn = rt_band_get_pixel(srcband, x, y, &ov, &isnodata);
/* error getting value, skip */
if (rtn == -1) {
do_nv = 0;
/* no data*/
- if (src_hasnodata && hasnodata && FLT_EQ(ov, src_nodataval)) {
+ if (hasnodata && isnodata) {
do_nv = 1;
break;
}
*/
/* nodata */
- if (
- src_hasnodata &&
- hasnodata &&
- FLT_EQ(ov, src_nodataval)
- ) {
+ if (hasnodata && isnodata) {
nv = nodataval;
}
/*
double val = 0;
int isnodata = 0;
- int hasnodata = 0;
- double nodataval = 0;
POSTGIS_RT_DEBUG(2, "RASTER_dumpValues first call");
SRF_RETURN_DONE(funcctx);
}
- /* band's hasnodata and nodataval */
- hasnodata = rt_band_get_hasnodata_flag(band);
- if (hasnodata)
- rt_band_get_nodata(band, &nodataval);
- POSTGIS_RT_DEBUGF(4, "(hasnodata, nodataval) = (%d, %f)", hasnodata, nodataval);
-
/* allocate memory for values and nodata flags */
arg1->values[z] = palloc(sizeof(Datum) * arg1->rows * arg1->columns);
arg1->nodata[z] = palloc(sizeof(bool) * arg1->rows * arg1->columns);
arg1->values[z][i] = Float8GetDatum(val);
POSTGIS_RT_DEBUGF(5, "arg1->values[z][i] = %f", DatumGetFloat8(arg1->values[z][i]));
- if (hasnodata) {
- POSTGIS_RT_DEBUGF(5, "FLT_EQ?: %d", FLT_EQ(val, nodataval) ? 1 : 0);
- }
POSTGIS_RT_DEBUGF(5, "clamped is?: %d", rt_band_clamped_value_is_nodata(band, val));
if (exclude_nodata_value && isnodata) {
rt_pgraster *pgraster = NULL;
rt_raster raster = NULL;
rt_band band = NULL;
- int hasnodata = FALSE;
- double nodataval = 0;
int nband = 1;
int numbands;
bool noband = FALSE;
break;
}
- hasnodata = rt_band_get_hasnodata_flag(band);
- if (hasnodata) {
- rt_band_get_nodata(band, &nodataval);
- POSTGIS_RT_DEBUGF(4, "(hasnodata, nodataval) = (%d, %f)", hasnodata, nodataval);
- }
- else
+ if (!rt_band_get_hasnodata_flag(band))
exclude_nodata_value = FALSE;
}
while (0);