gee-ndvi-composite

Cloud-free NDVI composites from Sentinel-2: robust GEE script, median reducer, and advanced cloud/shadow masking.

https://github.com/r-zimmerle/gee-ndvi-composite

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 15 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.2%) to scientific vocabulary
Last synced: 8 months ago · JSON representation ·

Repository

Cloud-free NDVI composites from Sentinel-2: robust GEE script, median reducer, and advanced cloud/shadow masking.

Basic Info
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • Open Issues: 0
  • Releases: 3
Created 11 months ago · Last pushed 11 months ago
Metadata Files
Readme License Citation

README.md

Sentinel‑2 NDVI Median Composite (GEE)

DOI

Clean, reproducible NDVI mosaics in *one click*—with peer‑reviewed cloud masking and per‑pixel median compositing baked‑in.


What this repo gives you

|✔|Benefit|How it’s guaranteed| |---|---|---| |⚡ Ready‑to‑run|Copy the script into the GEE Code Editor and hit Run.|Self‑contained JS file code/gee_ndvi_annual_median.js.| |🛰 Cloud‑robust NDVI|Removes thick/thin cloud and shadows before index calc.|Scene filter (<25% cloud); pixel mask combines SCL (classes 4‑7) & s2cloudless (<40%) [Zupanc, 2017]. This GEE-native approach offers good accuracy and accessibility, with s2cloudless being benchmarked in studies like Wright et al. (2024).| |📊 Per‑pixel median|Dampens sensor noise & residual haze.|Median reducer over time stack (common good‑practice).| |🎨 Consistent palette|Nine‑step, perceptually‑uniform ramp (brown → red → greens).|Matched to common NDVI legends; colour list hard‑coded in the script.| |🔁 Reproducible workflow|DOI‑frozen release on Zenodo; cite & rerun next season.|Versioned GitHub → Zenodo archiving.| |📚 Fully referenced|Built from primary literature & ESA docs.|See References below and detailed Methodology.md.|

Ideal for: vegetation monitoring, baseline layers for ML, classroom demos—anyone who wants a trustworthy NDVI without delving into cloud‑mask minutiae.

Annual median NDVI (2024) example
Figure 1 – Annual median NDVI (2024) for a sample region of interest (ROI), generated using the default script settings.


Quick start

|  Step |  Action | | ----- | ------------------------------------------------------ | |  1  | Open the GEE Code Editor | |  2  | Copy–paste code/gee_ndvi_annual_median.js | |  3  | Edit ROI geometry, start, endRun & Export |

The script previews the mosaic on the map and exports a GeoTIFF (10 m, native CRS of the tile).


Advanced settings (optional)

The script exports by default in EPSG 4326 (WGS-84 lat/lon), which is universally accepted and perfect for quick-look maps and web overlays. If you need metric-accurate area or distance calculations, open code/gee_ndvi_annual_median.js and either:

  1. set userCRS = 'EPSG:xxxxx' to your known UTM zone, or
  2. leave userCRS = null and run once — the console will print “Suggested CRS: EPSG:326/327xx” for your ROI; copy that code back into userCRS before exporting.

Workflow at a glance

This script generates cloud-free Sentinel-2 NDVI median composites by:

  1. Scene filtering: Pre-selects Sentinel-2 Level-2A images with less than 25% cloud cover (CLOUDY_PIXEL_PERCENTAGE < 25%) for the specified period and ROI.

  2. Pixel masking: For each selected image, it applies a robust pixel-level mask by:

- Retaining pixels classified as vegetation, bare soil, water, or unclassified by the Scene Classification Layer (SCL classes 4–7).

- Further refining this by keeping only those pixels where the `s2cloudless` cloud probability [Zupanc, 2017] is below 40%. This combined approach aims to effectively remove clouds and their shadows.
  1. NDVI calculation: Computes the NDVI for each valid pixel in every masked image using the standard formula: (B8 - B4) / (B8 + B4) [Rouse et al., 1974].

  2. Temporal aggregation: Creates a single composite image by calculating the per-pixel median NDVI from the stack of all processed images. This method is robust to outliers and residual atmospheric effects.

For a detailed scientific rationale behind these steps, including data sources, specific parameter justifications, and advanced customisation notes (e.g., monthly mosaics, threshold tuning), please refer to docs/Methodology.md.


Repository layout

text ├── code/ │ └── gee_ndvi_annual_median.js # plug-and-play Earth Engine script ├── docs/ │ ├── LICENSE-docs.md # CC BY 4.0 – docs & figures │ ├── Methodology.md # detailed tech note + refs │ └── media/ │ └── nvdi-model.png # example image ├── CITATION.cff # citation metadata (CFF) ├── LICENSE # MIT – applies to code └── README.md # you are here


How to Cite

If this software assists your research, please cite it using the following DOI. This DOI represents all versions and will always resolve to the latest one:

Zimmerle, R. (2025). Sentinel-2 NDVI median composite with cloud masking. Zenodo. https://doi.org/10.5281/zenodo.15588637

Citations are important as they help justify the continued development and maintenance of this project.

For reproducibility, or if your work depends on a specific version, please also cite the DOI of that particular version. You can find the DOIs for all specific versions (e.g., v1.0.1, v1.0.0) on the Zenodo record page associated with this project. For example:

  • Version v1.0.1: https://doi.org/10.5281/zenodo.15589146

References


License

Owner

  • Name: Rodrigo Zimmerle
  • Login: r-zimmerle
  • Kind: user

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this workflow or the code, please cite it using the concept DOI below."
title: "Sentinel-2 NDVI median composite with cloud masking"
version: "1.1.1" # Specific version of this release
type: software
authors:
  - family-names: "Zimmerle"
    given-names: "R."
    orcid: "https://orcid.org/0000-0003-2811-829X"
repository-code: "https://github.com/r-zimmerle/gee-ndvi-composite"
license: MIT
# The DOI below is the concept DOI representing all versions.
# It will always resolve to the latest one.
doi: "10.5281/zenodo.15588637"
url: "https://doi.org/10.5281/zenodo.15588637"
date-released: 2025-06-04 # Release date of this specific version (v1.1.1)
abstract: >
  Google Earth Engine (GEE) script that generates robust, per-pixel median NDVI
  composites from Sentinel-2 Level-2A imagery. Cloud masking combines the Sentinel-2
  Scene Classification Layer (SCL) with the s2cloudless cloud probability product
  [Zupanc, 2017]. The s2cloudless algorithm is a widely used, GEE-accessible method
  for cloud detection, frequently included as a benchmark in studies evaluating
  more advanced algorithms [e.g., Wright et al., 2024]. The repository includes
  a detailed methodology (Methodology.md) and an example figure for reproducibility.
keywords:
  - "NDVI"
  - "Sentinel-2"
  - "Google Earth Engine"
  - "GEE"
  - "cloud masking"
  - "s2cloudless"
  - "remote sensing"
  - "median composite"
  - "geospatial"
  - "Earth observation"
notes: >
  Documentation and figures (docs/, docs/media/) are licensed under
  Creative Commons Attribution 4.0 International (CC BY 4.0);
  see file LICENSE-CC-BY.md (or LICENSE-docs.md if that's the name you used).
references:
  - type: article
    authors:
      - family-names: "Wright"
        given-names: "N."
      - family-names: "Duncan"
        given-names: "J. M. A."
      - family-names: "Callow"
        given-names: "J. N."
      - family-names: "Thompson"
        given-names: "S. E."
      - family-names: "George"
        given-names: "R. J."
    title: "CloudS2Mask: A novel deep-learning approach for improved cloud and cloud-shadow masking in Sentinel-2 imagery"
    journal: "Remote Sensing of Environment"
    volume: 306
    year: 2024
    doi: "10.1016/j.rse.2024.114122"
  - type: report # Or 'manual' or 'software-documentation' depending on preference
    authors:
      - name: "European Space Agency"
    title: "Sentinel-2 user handbook"
    year: 2015
    institution:
      name: "ESA"
    version: "Issue 1, Rev. 2"
    url: "https://sentinels.copernicus.eu/documents/247904/685211/Sentinel-2_User_Handbook"
    date-accessed: 2025-06-04
  - type: article
    authors:
      - family-names: "Gorelick"
        given-names: "N."
      - family-names: "Hancher"
        given-names: "M."
      - family-names: "Dixon"
        given-names: "M."
      - family-names: "Ilyushchenko"
        given-names: "S."
      - family-names: "Thau"
        given-names: "D."
      - family-names: "Moore"
        given-names: "R."
    title: "Google Earth Engine: Planetary-scale geospatial analysis for everyone"
    journal: "Remote Sensing of Environment"
    volume: 202
    pages: "18-27"
    year: 2017
    doi: "10.1016/j.rse.2017.06.031"
  - type: conference-paper # Or 'report' as it's a NASA SP
    authors:
      - family-names: "Rouse"
        given-names: "J. W."
      - family-names: "Haas"
        given-names: "R. H."
      - family-names: "Schell"
        given-names: "J. A."
      - family-names: "Deering"
        given-names: "D. W."
    title: "Monitoring vegetation systems in the Great Plains with ERTS"
    collection-title: "Proceedings of the 3rd ERTS-1 Symposium" # Or booktitle
    volume: 1 # Or part-of: "Section A"
    pages: "309-317"
    year: 1974
    publisher:
      name: "NASA" # Or institution: name: "NASA Goddard Space Flight Center"
    url: "https://ntrs.nasa.gov/citations/19740022614"
    date-accessed: 2025-06-04
  - type: webpage # Or 'blog'
    authors:
      - family-names: "Zupanc"
        given-names: "A."
    title: "Improving Cloud Detection with Machine Learning"
    year: 2017
    month: 12 # CFF uses numeric month
    day: 19   # CFF uses numeric day
    url: "https://medium.com/sentinel-hub/improving-cloud-detection-with-machinelearning-c09dc5d7cf13"
    date-accessed: 2025-06-04

GitHub Events

Total
  • Release event: 5
  • Push event: 6
  • Create event: 5
Last Year
  • Release event: 5
  • Push event: 6
  • Create event: 5