maxcasado commited on
Commit
1823022
·
verified ·
1 Parent(s): 11352a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -7
app.py CHANGED
@@ -173,6 +173,8 @@ with st.spinner("Téléchargement Sentinel-2 + calcul NDWI…"):
173
 
174
  rgb = np.where(mask_rgb[..., None] > 0, rgb, np.nan)
175
  rgb = normalize_rgb(rgb)
 
 
176
 
177
  eps = 1e-6
178
  ndwi_11 = (b8a - b11) / (b8a + b11 + eps)
@@ -190,13 +192,26 @@ with st.spinner("Téléchargement Sentinel-2 + calcul NDWI…"):
190
  left, right = st.columns([1.2, 1.0], gap="large")
191
 
192
  with left:
193
- st.subheader("Overlay stress hydrique sur vraie couleur")
194
- fig = plt.figure(figsize=(8, 8))
195
- plt.imshow(rgb)
196
- plt.imshow(stress, cmap="Reds", alpha=0.40, vmin=0, vmax=1)
197
- plt.axis("off")
198
- plt.title(f"Stress = NDWI < p{p} (seuil {thr:.3f}) — {swir_choice}")
199
- st.pyplot(fig, clear_figure=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
200
 
201
  with right:
202
  st.subheader("Cartes NDWI")
 
173
 
174
  rgb = np.where(mask_rgb[..., None] > 0, rgb, np.nan)
175
  rgb = normalize_rgb(rgb)
176
+ rgb_raw = rgb.copy() # même image true color, sans overlay
177
+
178
 
179
  eps = 1e-6
180
  ndwi_11 = (b8a - b11) / (b8a + b11 + eps)
 
192
  left, right = st.columns([1.2, 1.0], gap="large")
193
 
194
  with left:
195
+ st.subheader("Vraie couleur : raw vs stress")
196
+
197
+ c1, c2 = st.columns(2, gap="medium")
198
+
199
+ with c1:
200
+ st.caption("Raw (true color)")
201
+ fig_raw = plt.figure(figsize=(6, 6))
202
+ plt.imshow(rgb_raw)
203
+ plt.axis("off")
204
+ st.pyplot(fig_raw, clear_figure=True)
205
+
206
+ with c2:
207
+ st.caption("Overlay stress hydrique")
208
+ fig = plt.figure(figsize=(6, 6))
209
+ plt.imshow(rgb)
210
+ plt.imshow(stress, cmap="Reds", alpha=0.40, vmin=0, vmax=1)
211
+ plt.axis("off")
212
+ plt.title(f"Stress = NDWI < p{p} (seuil {thr:.3f})")
213
+ st.pyplot(fig, clear_figure=True)
214
+
215
 
216
  with right:
217
  st.subheader("Cartes NDWI")