np.seterr(divide="ignore")
outblock = np.multiply(np.divide(ir - red, ir + red), 100.0) + 100.0 // scale and offset the NDVI value (ir-red)/(ir+red).
np.copyto(pixelBlocks["output_pixelBlock"], outblock, casting="unsafe") // copy local array to output pixel block.
return pixelBlocks
After Change
//
// The pixelBlocks dictionary does not contain scalars.
inputBlock = pixelBlocks["raster_pixels"] // get the input raster pixel block.
inputBlocks = pixelBlocks["rasters_pixels"] // get the input raster pixel block.
red = np.array(inblock[0], dtype="float") // extractbandids ensures first band is Red.
ir = np.array(inblock[1], dtype="float") // extractbandids ensures second band is Infrared.