Compare commits

..

2 commits

Author SHA1 Message Date
Felix Delattre
cdfa350dc6 Added link to source code repo. 2026-06-12 18:42:31 +02:00
Felix Delattre
2ca1a808d2 Addressed negative reflectance values from fusion. 2026-06-11 23:36:54 +02:00
2 changed files with 19 additions and 4 deletions

View file

@ -117,7 +117,11 @@ def compute_gcc_from_refl(refl_dir: Path, gcc_dir: Path) -> None:
"""Derive GCC from ``REFL_YYYYMMDD.tif`` files (BtI fusion output).
Reads every ``REFL_*.tif`` and writes a co-located single-band
``GCC_YYYYMMDD.tif``. Zero pixels remain zero.
``GCC_YYYYMMDD.tif``. Pixels where any reflectance band is negative (which
can arise from EFAST's temporal correction) are written as NaN; the GCC
ratio is undefined there because the denominator B+G+R is near-zero or
negative due to band cancellation. All-zero pixels (cloud mask) remain
zero.
"""
gcc_dir.mkdir(parents=True, exist_ok=True)
for src_path in sorted(refl_dir.glob("REFL_*.tif")):
@ -128,9 +132,10 @@ def compute_gcc_from_refl(refl_dir: Path, gcc_dir: Path) -> None:
b, g, r = src.read(1), src.read(2), src.read(3)
profile = src.profile
total = b + g + r
gcc = g / (total + 1e-10)
gcc[total == 0] = 0
profile.update(count=1)
invalid = (b < 0) | (g < 0) | (r < 0)
gcc = np.where(invalid, np.nan, g / (total + 1e-10))
gcc[total == 0] = np.nan
profile.update(count=1, dtype="float32")
with rasterio.open(out_path, "w", **profile) as dst:
dst.write(gcc[np.newaxis].astype("float32"))

View file

@ -123,6 +123,15 @@ body { margin: 0; font: 13px/1.4 system-ui, sans-serif; background: #f5f5f5; col
}
#worldMapBtn:hover { background: #3a5278; }
#repoLink {
margin-left: auto;
font-size: 12px;
color: #7eb8f7;
text-decoration: none;
white-space: nowrap;
}
#repoLink:hover { color: #9ecef8; text-decoration: underline; }
/* worldwide map overlay */
#worldOverlay {
display: none; position: fixed; inset: 0; z-index: 3000;
@ -158,6 +167,7 @@ body { margin: 0; font: 13px/1.4 system-ui, sans-serif; background: #f5f5f5; col
<label>Year <select id="yearSel"></select></label>
<span id="sitesCount" style="font-size:12px;color:#aaa;white-space:nowrap"></span>
<button type="button" id="worldMapBtn" title="World map of all sites">World map</button>
<a id="repoLink" href="https://git.delattre.de/pantierra/efast-phenocam-validation" target="_blank" rel="noopener noreferrer">Source code</a>
</div>
<div id="worldOverlay" aria-hidden="true">