YashMK89 commited on
Commit
6c1cb21
·
verified ·
1 Parent(s): 91458a3

update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
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
- st.warning(f"The following bands are not available in the dataset for this image: {', '.join(missing_bands)}. Available bands: {', '.join(band_names)}. Please adjust your formula or data selection.")
373
- return ee.Image(0).rename('custom_result').set('error', f"Missing bands: {', '.join(missing_bands)}")
 
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