Upload flood.py
Browse files- hazards/flood.py +5 -0
hazards/flood.py
CHANGED
|
@@ -13,6 +13,11 @@ def generate_flood_raster(iso: str, rp: int, gis_name: str = None):
|
|
| 13 |
has_features, _ = has_associated_features(iso, base_url)
|
| 14 |
if has_features:
|
| 15 |
gdf = get_geometry(iso, url=base_url)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
else:
|
| 17 |
if not gis_name:
|
| 18 |
return None, f"❌ Subdivision required for {iso}."
|
|
|
|
| 13 |
has_features, _ = has_associated_features(iso, base_url)
|
| 14 |
if has_features:
|
| 15 |
gdf = get_geometry(iso, url=base_url)
|
| 16 |
+
# If a specific subdivision is selected, filter to it
|
| 17 |
+
if gis_name:
|
| 18 |
+
gdf = gdf[gdf['gis_name'] == gis_name]
|
| 19 |
+
if gdf.empty:
|
| 20 |
+
return None, f"❌ No geometry found for {gis_name} in {iso}."
|
| 21 |
else:
|
| 22 |
if not gis_name:
|
| 23 |
return None, f"❌ Subdivision required for {iso}."
|