|
1596 | 1596 | "# Calculate NDVI" |
1597 | 1597 | ] |
1598 | 1598 | }, |
| 1599 | + { |
| 1600 | + "cell_type": "markdown", |
| 1601 | + "id": "f618310e", |
| 1602 | + "metadata": {}, |
| 1603 | + "source": [ |
| 1604 | + "### NDVI (Normalized Difference Vegetation Index)\n", |
| 1605 | + "\n", |
| 1606 | + "The **Normalized Difference Vegetation Index (NDVI)** quantifies vegetation greenness and health by comparing the reflectance in the near-infrared (NIR) and red (RED) spectral bands.\n", |
| 1607 | + "\n", |
| 1608 | + "**Formula:**\n", |
| 1609 | + "\n", |
| 1610 | + "NDVI = \\frac{(NIR - RED)}{(NIR + RED)}\n", |
| 1611 | + "\n", |
| 1612 | + "**Where:**\n", |
| 1613 | + "- **NIR** → Reflectance in the near-infrared band (typically 0.76–0.90 µm) \n", |
| 1614 | + "- **RED** → Reflectance in the red band (typically 0.63–0.69 µm)\n", |
| 1615 | + "\n", |
| 1616 | + "**Typical NDVI interpretation:**\n", |
| 1617 | + "\n", |
| 1618 | + "| NDVI range | Surface type / Vegetation condition |\n", |
| 1619 | + "|:-----------:|:------------------------------------|\n", |
| 1620 | + "| -1.0 – 0.0 | Water, snow, clouds (no vegetation) |\n", |
| 1621 | + "| 0.0 – 0.2 | Bare soil or sparse vegetation |\n", |
| 1622 | + "| 0.2 – 0.5 | Moderate vegetation (grasslands, crops) |\n", |
| 1623 | + "| 0.5 – 1.0 | Dense, healthy vegetation (forests, tropical areas) |\n" |
| 1624 | + ] |
| 1625 | + }, |
1599 | 1626 | { |
1600 | 1627 | "cell_type": "code", |
1601 | 1628 | "execution_count": null, |
1602 | 1629 | "id": "71b13ef8", |
1603 | 1630 | "metadata": {}, |
1604 | 1631 | "outputs": [], |
1605 | 1632 | "source": [ |
1606 | | - "import rasterio\n", |
1607 | | - "import numpy as np\n", |
1608 | | - "import matplotlib.pyplot as plt\n", |
1609 | | - "\n", |
1610 | 1633 | "# File paths for NIR (B08) and Red (B04) bands\n", |
1611 | 1634 | "band_paths = {\n", |
1612 | 1635 | " 'nir': './out/S2B_MSIL1C_20240320T095649_N0510_R122_T32TQM_20240320T120139.SAFE/GRANULE/L1C_T32TQM_A036756_20240320T100108/IMG_DATA/T32TQM_20240320T095649_B08.jp2',\n", |
|
0 commit comments