# Cloud & Collection Fallback Strategy for GEE Sentinel-2

## Why SR_HARMONIZED has fewer images in Africa

The `COPERNICUS/S2_SR_HARMONIZED` collection undergoes atmospheric correction (Sen2Cor). This reduces available passes because:
- Only scenes with sufficient processing metadata are included
- Cloudy scenes are more likely to fail correction
- Archive coverage varies by region — Africa has fewer processed tiles than Europe/US

**Rule of thumb:** In tropical Africa (Ethiopia, Kenya, Somalia), expect SR_HARMONIZED to have ~60-70% of the L1C count.

## Cloud cover by region

| Region | Season | Typical cloud cover | Recommended starting threshold |
|---|---|---|---|
| Ethiopia/Kenya/Somalia | Dry (Dec-Mar) | 20-40% | <30% |
| Ethiopia/Kenya/Somalia | Wet (Oct-Nov) | 60-80% | <50% |
| Ethiopia/Kenya/Somalia | Wet (Apr-Jun) | 50-70% | <40% |
| Sahel/Sudan | Dry | 5-20% | <20% |
| Mediterranean | Winter | 40-70% | <50% |
| Europe | Summer | 10-30% | <20% |

## Fallback Chain

```
1. SR_HARMONIZED + CLOUD < 50%
   → if count > 0: use it, done
2. L1C (COPERNICUS/S2) + CLOUD < 80%
   → if count > 0: use it, done
3. L1C + CLOUD < 90% + ±60 day window
   → if count > 0: use it, done
4. Tell user: try different date or use Sentinel-1 SAR (works through clouds)
```

## Implementation (GEE JavaScript)

```javascript
// Collection auto-select
var sr = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED')
  .filterBounds(aoi).filterDate(start, end)
  .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 50));

var collectionStr = ee.Algorithms.If(
  sr.size().gt(0),
  'COPERNICUS/S2_SR_HARMONIZED',
  'COPERNICUS/S2_HARMONIZED'
);

var images = ee.ImageCollection(collectionStr)
  .filterBounds(aoi).filterDate(start, end)
  .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE',
    ee.Algorithms.If(sr.size().gt(0), 50, 80)));
```

Note: `ee.Algorithms.If()` evaluates lazily in GEE — both branches of `collectionStr` are valid ImageCollection IDs, so no error is thrown for the unselected branch.
