# vp717/ndvi architecture

> Architecture diagram of the GitHub repository vp717/ndvi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vp717/ndvi
- Repository: https://github.com/vp717/ndvi

## Overview

This is a small Python utility for calculating NDVI from near-infrared and red raster bands. The demo opens the bundled images, passes their bands and geospatial metadata to the calculation function, and requests both integer-scaled and floating-point outputs. The function reads the bands into NumPy arrays, computes NDVI, and uses GDAL to write a georeferenced GeoTIFF. The runtime relationships are shown from the excerpts; no additional subsystems are evident in this small repository.

Main entry points: [`ndvi/ndvi_demo.py`](https://github.com/vp717/ndvi/blob/master/ndvi/ndvi_demo.py) (Demo script), [`ndvi/ndvi.py`](https://github.com/vp717/ndvi/blob/master/ndvi/ndvi.py) (NDVI calculation), [`ndvi/NIR_IMAGE.tif`](https://github.com/vp717/ndvi/blob/master/ndvi/NIR_IMAGE.tif) (NIR raster), [`ndvi/RED_IMAGE.tif`](https://github.com/vp717/ndvi/blob/master/ndvi/RED_IMAGE.tif) (Red raster)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("User"))
node_demo["Demo script<br/>[ndvi_demo.py]"]
node_nir["NIR raster<br/>[NIR_IMAGE.tif]"]
node_red["Red raster<br/>[RED_IMAGE.tif]"]
node_ndvi["NDVI calculation<br/>[ndvi.py]"]
node_numpy["NumPy"]
node_gdal["GDAL"]
node_output["Output GeoTIFF"]

node_user -->|"runs"| node_demo
node_demo -->|"opens"| node_nir
node_demo -->|"opens"| node_red
node_demo -->|"calls"| node_ndvi
node_ndvi -->|"computes with"| node_numpy
node_ndvi -->|"reads and writes"| node_gdal
node_ndvi -->|"creates"| node_output

click node_demo "https://github.com/vp717/ndvi/blob/master/ndvi/ndvi_demo.py"
click node_nir "https://github.com/vp717/ndvi/blob/master/ndvi/NIR_IMAGE.tif"
click node_red "https://github.com/vp717/ndvi/blob/master/ndvi/RED_IMAGE.tif"
click node_ndvi "https://github.com/vp717/ndvi/blob/master/ndvi/ndvi.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_user toneBlue
class node_demo,node_nir,node_red,node_ndvi toneTeal
class node_numpy,node_gdal,node_output toneIndigo
```

## Components

### Other components

- **User**
- [Demo script](https://github.com/vp717/ndvi/blob/master/ndvi/ndvi_demo.py): `ndvi/ndvi_demo.py`
- [NIR raster](https://github.com/vp717/ndvi/blob/master/ndvi/NIR_IMAGE.tif): `ndvi/NIR_IMAGE.tif`
- [Red raster](https://github.com/vp717/ndvi/blob/master/ndvi/RED_IMAGE.tif): `ndvi/RED_IMAGE.tif`
- [NDVI calculation](https://github.com/vp717/ndvi/blob/master/ndvi/ndvi.py): `ndvi/ndvi.py`
- **NumPy**
- **GDAL**
- **Output GeoTIFF**

## Connections

- User → Demo script: runs (evidence: `README.md`)
- Demo script → NIR raster: opens (evidence: `ndvi/ndvi_demo.py`)
- Demo script → Red raster: opens (evidence: `ndvi/ndvi_demo.py`)
- Demo script → NDVI calculation: calls (evidence: `ndvi/ndvi_demo.py`)
- NDVI calculation → NumPy: computes with (evidence: `ndvi/ndvi.py`)
- NDVI calculation → GDAL: reads and writes (evidence: `ndvi/ndvi.py`)
- NDVI calculation → Output GeoTIFF: creates (evidence: `ndvi/ndvi.py`)
