xrspatial.multispectral.sipi#
- xrspatial.multispectral.sipi(nir_agg: xarray.core.dataarray.DataArray, red_agg: xarray.core.dataarray.DataArray, blue_agg: xarray.core.dataarray.DataArray, name='sipi')[source]#
Computes Structure Insensitive Pigment Index which helpful in early disease detection in vegetation.
- Parameters
nir_agg (xr.DataArray) – 2D array of near-infrared band data.
red_agg (xr.DataArray) – 2D array of red band data.
blue_agg (xr.DataArray) – 2D array of blue band data.
name (str, default='sipi') – Name of output DataArray.
- Returns
sipi_agg – 2D array of sipi values. All other input attributes are preserved.
- Return type
xr.DataArray of same type as inputs
References
Examples
>>> from xrspatial.datasets import get_data >>> data = get_data('sentinel-2') # Open Example Data >>> nir = data['NIR'] >>> red = data['Red'] >>> blue = data['Blue'] >>> from xrspatial.multispectral import sipi >>> # Generate SIPI Aggregate Array >>> sipi_agg = sipi(nir_agg=nir, red_agg=red, blue_agg=blue) >>> nir.plot(cmap='Greys', aspect=2, size=4) >>> red.plot(aspect=2, size=4) >>> blue.plot(aspect=2, size=4) >>> sipi_agg.plot(aspect=2, size=4)
>>> y1, x1, y2, x2 = 100, 100, 103, 104 >>> print(nir[y1:y2, x1:x2].data) [[1519. 1504. 1530. 1589.] [1491. 1473. 1542. 1609.] [1479. 1461. 1592. 1653.]] >>> print(red[y1:y2, x1:x2].data) [[1327. 1329. 1363. 1392.] [1309. 1331. 1423. 1424.] [1293. 1337. 1455. 1414.]] >>> print(blue[y1:y2, x1:x2].data) [[1281. 1270. 1254. 1297.] [1241. 1249. 1280. 1309.] [1239. 1257. 1322. 1329.]] >>> print(sipi_agg[y1:y2, x1:x2].data) [[1.2395834 1.3371428 1.6526946 1.4822335] [1.3736264 1.5774648 2.2016807 1.6216216] [1.2903225 1.6451613 1.9708029 1.3556485]]