Backup automatico script del 2026-09-19 07:00

This commit is contained in:
daniele committed 2026-09-19 07:00:03 +02:00
1 parent 35677497dc
commit f347badf3b
4 files changed
+144 -39

No files matched your search

+10 -13
View File
@@ -340,13 +340,14 @@ def generate_snow_map(results: List[Dict], center_lat: float, center_lon: float,
LOGGER.warning("matplotlib non disponibile: %s. Mappa non generata.", e)
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
LOGGER.warning("contextily non disponibile. Mappa generata senza sfondo geografico.")
add_basemap = None # type: ignore
LOGGER.warning("contextily/basemap_tiles non disponibile. Mappa generata senza sfondo geografico.")
if not results:
return False
@@ -377,16 +378,12 @@ def generate_snow_map(results: List[Dict], center_lat: float, center_lon: float,
ax.set_ylim(lat_min, lat_max)
ax.set_aspect('equal', adjustable='box')
# Aggiungi mappa di sfondo OpenStreetMap se disponibile
if CONTEXTILY_AVAILABLE:
try:
# Aggiungi tile OpenStreetMap (contextily gestisce automaticamente la conversione)
ctx.add_basemap(ax, crs='EPSG:4326', source=ctx.providers.OpenStreetMap.Mapnik,
alpha=0.6, attribution_size=6)
LOGGER.debug("Mappa OpenStreetMap aggiunta come sfondo")
except Exception as e:
LOGGER.warning("Errore aggiunta mappa sfondo: %s. Continuo senza sfondo.", e)
# Non reimpostare CONTEXTILY_AVAILABLE qui, solo logga l'errore
# Aggiungi mappa di sfondo (CARTO; OSM Mapnik è bloccato per lo UA di contextily)
if CONTEXTILY_AVAILABLE and add_basemap is not None:
if add_basemap(ax, alpha=0.85, attribution_size=6):
LOGGER.debug("Basemap aggiunta come sfondo")
else:
LOGGER.warning("Errore aggiunta mappa sfondo. Continuo senza sfondo.")
# Disegna punti con colore basato su accumulo totale
# Colori: blu (poco) -> verde -> giallo -> arancione -> rosso (molto)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.