Backup automatico script del 2026-09-19 07:00
This commit is contained in:
1 parent
35677497dc
commit
f347badf3b
4 files changed
+144
-39
No files matched your search
@@ -1673,13 +1673,14 @@ def generate_route_ice_map(df: pd.DataFrame, city1: str, city2: str, output_path
|
||||
print(f"matplotlib non disponibile: {e}. Mappa non generata.")
|
||||
return False
|
||||
|
||||
# Prova a importare contextily per mappa di sfondo
|
||||
# Prova a importare basemap (CARTO / OSM HOT; non tile.openstreetmap.org)
|
||||
try:
|
||||
import contextily as ctx
|
||||
from basemap_tiles import add_basemap
|
||||
CONTEXTILY_AVAILABLE = True
|
||||
except ImportError:
|
||||
CONTEXTILY_AVAILABLE = False
|
||||
print("contextily non disponibile. Mappa generata senza sfondo geografico.")
|
||||
add_basemap = None # type: ignore
|
||||
print("contextily/basemap_tiles non disponibile. Mappa generata senza sfondo geografico.")
|
||||
|
||||
if df.empty:
|
||||
return False
|
||||
@@ -1720,13 +1721,10 @@ def generate_route_ice_map(df: pd.DataFrame, city1: str, city2: str, output_path
|
||||
ax.set_ylim(lat_min, lat_max)
|
||||
ax.set_aspect('equal', adjustable='box')
|
||||
|
||||
# Aggiungi mappa di sfondo OpenStreetMap se disponibile
|
||||
if CONTEXTILY_AVAILABLE:
|
||||
try:
|
||||
ctx.add_basemap(ax, crs='EPSG:4326', source=ctx.providers.OpenStreetMap.Mapnik,
|
||||
alpha=0.6, attribution_size=6)
|
||||
except Exception as e:
|
||||
print(f"Errore aggiunta mappa sfondo: {e}")
|
||||
# Aggiungi mappa di sfondo (CARTO; OSM Mapnik è bloccato per lo UA di contextily)
|
||||
if CONTEXTILY_AVAILABLE and add_basemap is not None:
|
||||
if not add_basemap(ax, alpha=0.85, attribution_size=6):
|
||||
print("Errore aggiunta mappa sfondo")
|
||||
CONTEXTILY_AVAILABLE = False
|
||||
|
||||
# Disegna linea del percorso
|
||||
@@ -1871,13 +1869,14 @@ def generate_ice_risk_map(points_data: List[Dict], output_path: str) -> bool:
|
||||
print(f"matplotlib non disponibile: {e}. Mappa non generata.")
|
||||
return False
|
||||
|
||||
# Prova a importare contextily per mappa di sfondo
|
||||
# Prova a importare basemap (CARTO / OSM HOT; non tile.openstreetmap.org)
|
||||
try:
|
||||
import contextily as ctx
|
||||
from basemap_tiles import add_basemap
|
||||
CONTEXTILY_AVAILABLE = True
|
||||
except ImportError:
|
||||
CONTEXTILY_AVAILABLE = False
|
||||
print("contextily non disponibile. Mappa generata senza sfondo geografico.")
|
||||
add_basemap = None # type: ignore
|
||||
print("contextily/basemap_tiles non disponibile. Mappa generata senza sfondo geografico.")
|
||||
|
||||
if not points_data:
|
||||
return False
|
||||
@@ -1901,13 +1900,10 @@ def generate_ice_risk_map(points_data: List[Dict], output_path: str) -> bool:
|
||||
ax.set_ylim(lat_min, lat_max)
|
||||
ax.set_aspect('equal', adjustable='box')
|
||||
|
||||
# Aggiungi mappa di sfondo OpenStreetMap se disponibile
|
||||
if CONTEXTILY_AVAILABLE:
|
||||
try:
|
||||
ctx.add_basemap(ax, crs='EPSG:4326', source=ctx.providers.OpenStreetMap.Mapnik,
|
||||
alpha=0.6, attribution_size=6)
|
||||
except Exception as e:
|
||||
print(f"Errore aggiunta mappa sfondo: {e}")
|
||||
# Aggiungi mappa di sfondo (CARTO; OSM Mapnik è bloccato per lo UA di contextily)
|
||||
if CONTEXTILY_AVAILABLE and add_basemap is not None:
|
||||
if not add_basemap(ax, alpha=0.85, attribution_size=6):
|
||||
print("Errore aggiunta mappa sfondo")
|
||||
CONTEXTILY_AVAILABLE = False
|
||||
|
||||
# Colori per livelli di rischio: verde (0), giallo (1), arancione (2), rosso scuro (3), azzurro (4=neve)
|
||||
|
||||