Loading repository data…
Loading repository data…
EstefaPizarro / repository
Estimacion de Indice de Area Foliar (LAI) en uva de mesa en Chile combinando ceptometro SunScan y Landsat 8 (proyecto de tesis)
Estimating Leaf Area Index (LAI) for Chilean vineyards (table grapes), combining ground-truth ceptometer (PAR sensor) field measurements with Landsat 8 remote sensing. Thesis research project (Estefanía Pizarro Arias).
LAI (Leaf Area Index) is a number that summarizes how much leaf a crop has per square meter of ground — a key input for modeling how much water that crop needs (e.g. in a HYDRUS-1D water balance model, or when computing FAO-56 crop coefficients Kc/Kcb). Measuring it by hand in the field is accurate but slow and pointwise (only where the instrument is); estimating it from satellite imagery is fast and covers the whole farm, but needs to be calibrated against real measurements.
This repository does both and connects them:
The pipeline is implemented in R (src/, canonical) and ported functionally to Python (python/) — both do the same thing, one is the thesis original and the other an equivalent reimplementation.
FIELD SATELLITE
┌─────────────────────────────┐ ┌───────────────────────────────────┐
│ Raw SunScan CSV (64 │ │ Landsat 8 bands (.tif) + │
│ PAR sensors) per farm │ │ boundary/points shapefiles │
└───────────────┬─────────────┘ └───────────────────┬─────────────────┘
│ 01_procesar_ceptometro.R │ 02_procesar_landsat.R
▼ ▼
Real LAI (Beer-Lambert) + Kcb/Ke NDVI/SAVI/NDVIg/SAVIg → estimated LAI/FI
data/processed/ceptometro/*.csv outputs/tablas/{Farm}/IV_*.csv
│ │
└───────────────┬───────────────────────────┘
│ (manual merge of both outputs)
▼
data/processed/validacion/tabla_ndvi_nueva.csv
│
03_modelo_predictor.R
(NDVI vs real LAI/FI regression → model)
│
04_validacion.R
(DOY→LAI polynomial vs real LAI, Galdames farm only)
▼
outputs/figuras/PredichosvsObservados.png
| Script (R / Python) | What it does | Input | Output |
|---|---|---|---|
01_procesar_ceptometro.R / ceptometro.py | From the raw ceptometer CSV, computes intercepted light fraction (FI), transmittance (T/Tf), LAI via Beer-Lambert, and FAO-56 crop coefficients Kcb/Ke | Raw SunScan CSV per site in data/raw/ceptometro/ (included in the repo) | data/processed/ceptometro/{farm}_IAF_completo.csv (included) |
02_procesar_landsat.R / landsat.py | Crops Landsat bands to each farm's boundary, computes 4 vegetation indices, and estimates LAI/FI at the 6 sample points (A1–A6) | Landsat 8 bands (.tif, bands 3/4/5) in data/raw/landsat/ (the seasons the script uses are included) + shapefiles in data/shapes/{farm}/Shape/ (included) | outputs/tablas/{Farm}/IV_*.csv (not versioned) |
03_modelo_predictor.R / predictor_model.py | Fits a linear regression NDVI→LAI and NDVI→FI using real LAI as the reference, and generates the figures for that relationship | data/processed/validacion/tabla_ndvi_nueva.csv — manually assembled by combining stage 1 and 2 outputs, not generated automatically | Regression model + figures in outputs/figuras/ |
04_validacion.R / validacion.py | Fits a day-of-year→LAI polynomial per row (calibrated coefficients exist only for Galdames) and compares predicted vs. observed | data/processed/ceptometro/*_IAF_completo.csv, filtered to predio == "galdames" | outputs/figuras/PredichosvsObservados.png + error statistics |
Cloning this repository already includes almost all the data needed to run the 4 pipeline stages end to end:
data/shapes/).data/raw/ceptometro/) and the Landsat scene IDs used (data/raw/scene_ids/).data/raw/landsat/2018-2019 and 2017-2018-extraidos) — the seasons that 02_procesar_landsat.R actually consumes.data/processed/ceptometro/).What's not included:
data/processed/validacion/tabla_ndvi_nueva.csv (stage 3 input) — no script produces it; it's a file assembled by hand, combining columns from stages 1 and 2's outputs. If it doesn't exist, stage 3 fails with an error explaining this.Known limitation — Cunaquito has no correct Landsat imagery: I ran the full pipeline end to end to verify it before this release, and data/raw/landsat/2018-2019 (the folder 02_procesar_landsat.R uses for Cunaquito/Santa Cruz) only contains scenes from WRS-2 path/row 233083 (San Esteban's), not 233084 (Santa Cruz's). There isn't a single 233084 scene in the repo, so Cunaquito's satellite output (outputs/tablas/Cunaquito/IV_Cunaquito.csv) comes out entirely NaN — the script doesn't fail, it just finds no overlap between the farm polygon and the raster. Galdames and Contreras are unaffected.
Outside the pipeline, the following stay intentionally excluded from the repo (.gitignore): data/raw/landsat/AST.tif (unused by any script), the original compressed ESPA downloads (*.tar.gz, redundant with the already-extracted bands), legacy/ (pre-migration scripts), documents/ (the thesis) and outputs/tablas/ (regenerated when stage 2 runs).
Important: the empirical LAI/FI formulas (02_procesar_landsat.R) and the Beer-Lambert k coefficients (01_procesar_ceptometro.R) are calibrated specifically for these three farms (Cunaquito, Galdames, Contreras). They aren't valid for another crop or location without recalibration.
install.packages(c("sf", "raster", "hydroGOF"))
source("src/01_procesar_ceptometro.R")
source("src/02_procesar_landsat.R")
source("src/03_modelo_predictor.R")
source("src/04_validacion.R")
There's no build system or package manager for the R code — the scripts are standalone, run in order from the project root.
pip install -e ./python[dev]
lai-pipeline --root . # runs the 4 stages in order
pytest python/tests/ # test suite
See python/README.md for port details (module layout, per-stage commands, geopandas/rasterio install requirements).
src/ Canonical R pipeline (4 scripts, run in order)
python/ Python port of the same pipeline (lai_ceptometer package)
data/raw/ Versioned raw inputs: ceptometer, scene_ids and the Landsat bands used
data/processed/ Output CSVs from stages 1 and 2 (versioned)
data/shapes/ Boundary/sample-point shapefiles per farm (versioned)
outputs/figuras/ Publication-ready figures generated by the pipeline (versioned)
legacy/, documents/ and outputs/tablas/ are excluded from the repository (.gitignore) — pre-migration scripts, the thesis document, and regenerable tables, and won't be present in a fresh clone. Inside data/raw/landsat/, AST.tif and the original ESPA .tar.gz downloads are also excluded since they aren't needed to run the pipeline (see "What you need to replicate it from scratch" above).
This repository implements one of the methodological components of the following thesis:
Pizarro Arias, Estefanía de los Ángeles (2018). "Proyección de los componentes del balance hídrico que definen las estrategias de riego de uva de mesa en Chile Central bajo escenarios de cambio global." Thesis for the Professional Degree of Agricultural Engineer and the Master's Degree in Agricultural Sciences. Universidad de Chile, Facultad de Ciencias Agronómicas, Escuela de Postgrado. Thesis advisor: Mauricio Galleguillos Torres.
The thesis evaluates how climate change scenarios and different irrigation strategies affect the water balance of a 'Red Globe' table grape vineyard (Predio M. Galdames, Central Chile), using the HYDRUS-1D numerical model calibrated and validated against field soil-moisture measurements. Within that work, one of the required inputs is Leaf Area Index (LAI) over the season — which is exactly what this repository computes and models, combining field ceptometer measurements with Landsat 8 vegetation indices (thesis section: "Generación de modelo predictivo de Índice de Área Foliar mediante mediciones en terreno con ceptómetro y uso de índice vegetacional").
The thesis isn't published online. The cited work is available in more detail in the paper derived from this research:
Pizarro, E., Galleguillos, M., Barría, P., Callejas, R. (2022). "Irrigation management or climate change? Which is more important to cope with water shortage in the production of table grape in a Mediterranean context." Agricultural Water Management, 263, 107467. https://doi.org/10.1016/j.agwat.2022.107467
MIT — see LICENSE.