update app.py
Browse files
app.py
CHANGED
@@ -369,9 +369,11 @@ def calculate_custom_formula(image, geometry, selected_bands, custom_formula, re
|
|
369 |
# Check if all selected bands are available in the image
|
370 |
missing_bands = [band for band in selected_bands if band not in band_names]
|
371 |
if missing_bands:
|
372 |
-
|
373 |
-
|
|
|
374 |
|
|
|
375 |
for band in selected_bands:
|
376 |
band_values[band] = image.select(band)
|
377 |
|
|
|
369 |
# Check if all selected bands are available in the image
|
370 |
missing_bands = [band for band in selected_bands if band not in band_names]
|
371 |
if missing_bands:
|
372 |
+
error_msg = f"The following bands are not available in this image: {', '.join(missing_bands)}. Available bands: {', '.join(band_names)}. Please adjust your formula or check the data for your region and date range."
|
373 |
+
st.error(error_msg)
|
374 |
+
return ee.Image(0).rename('custom_result').set('error', error_msg)
|
375 |
|
376 |
+
# Only proceed if all bands are available
|
377 |
for band in selected_bands:
|
378 |
band_values[band] = image.select(band)
|
379 |
|