{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# GeoPython Lab 05 — Raster & NDVI\n",
        "**Στόχος:** κατανόηση raster ως πίνακα και υπολογισμός NDVI με NumPy.\n",
        "\n",
        "Χρησιμοποιούμε συνθετικά δεδομένα για να μην απαιτείται download αρχείων.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "import numpy as np\n",
        "import matplotlib.pyplot as plt\n",
        "\n",
        "np.random.seed(4)\n",
        "red = np.random.uniform(0.10, 0.45, (120, 120))\n",
        "nir = np.random.uniform(0.25, 0.85, (120, 120))\n",
        "\n",
        "ndvi = (nir - red) / (nir + red)\n",
        "print(\"NDVI min/max:\", ndvi.min(), ndvi.max())\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "plt.imshow(ndvi)\n",
        "plt.colorbar(label=\"NDVI\")\n",
        "plt.title(\"Synthetic NDVI\")\n",
        "plt.axis(\"off\")\n",
        "plt.show()\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "vegetation_mask = ndvi > 0.3\n",
        "percentage = vegetation_mask.mean() * 100\n",
        "print(f\"Pixels με NDVI > 0.3: {percentage:.1f}%\")\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Μικρή άσκηση\n",
        "Άλλαξε το threshold από 0.3 σε 0.4 και σύγκρινε το ποσοστό βλάστησης.\n"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "name": "python",
      "version": "3.x"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 5
}