import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon,Rectangle,FancyArrowPatch
T="#222222";G="#555555";EAU="#2c7fb8";ROC="#b9a88a";PV="#f2b705";NEUF="#d62828"
fig,ax=plt.subplots(figsize=(18,8.5),dpi=110)
fig.patch.set_facecolor("white")
ax.set_xlim(-2.5,25);ax.set_ylim(-30,420);ax.axis("off")
ax.add_patch(Polygon([(-2.5,-30),(-2.5,380),(2,380),(5.5,360),(8.3,350),(8.3,170),(9.2,170),(12,150),(16,150),(20,160),(25,170),(25,-30)],closed=True,color=ROC,lw=0))
ax.add_patch(Polygon([(-2.5,350),(8.3,350),(8.3,300),(-2.5,300)],closed=True,color=EAU,alpha=0.9,lw=0))
ax.add_patch(Polygon([(9.2,170),(25,170),(25,150),(12,150),(9.2,160)],closed=True,color=EAU,alpha=0.9,lw=0))
ax.add_patch(Polygon([(8.3,350),(8.3,170),(9.2,170),(9.2,350)],closed=True,color="#8d8d8d",lw=0))
ax.text(2.5,325,"Lake Mead, 32 km³\nthe upper reserve already exists",ha="center",va="center",fontsize=11,color="white",weight="bold")
ax.text(17.5,160,"Lake Mohave, 2.2 km³ (Davis Dam, 108 km downstream): the lower lake already exists",ha="center",va="center",fontsize=10.5,color="white",weight="bold")
ax.text(8.75,365,"Hoover Dam\n221 m, 2,080 MW substation",ha="center",va="bottom",fontsize=10.5,color=T,weight="bold")
ax.add_patch(Rectangle((9.3,172),1.6,30,color="#444444"))
ax.text(5.5,235,"17 existing turbines\n2,080 MW, 4.5 h a day\non the river's water",ha="center",va="center",fontsize=9.5,color=T)
ax.add_patch(FancyArrowPatch((8.3,330),(9.5,190),arrowstyle="-|>",mutation_scale=18,lw=3,color="#444444"))
ax.add_patch(Rectangle((11.6,172),1.6,22,color=NEUF))
ax.text(12.9,206,"NEW: pumping station\n300 MW in Lake Mohave",ha="left",va="bottom",fontsize=9.5,color=NEUF,weight="bold")
ax.plot([12.4,12.4,7.5],[194,320,320],color=NEUF,lw=3.5,ls="--",zorder=6)
ax.text(12.9,262,"NEW: 2 km tunnel in the rock,\nnext to the dam, to Lake Mead, 170 m",ha="left",va="bottom",fontsize=9.5,color=NEUF,weight="bold")
for i in range(9):
    x=15.5+i*1.0
    ax.add_patch(Polygon([(x-0.35,172),(x+0.35,172),(x+0.45,186),(x-0.25,186)],closed=True,color=PV,lw=0))
ax.text(19.5,195,"NEW: 1,500 MWp of trackers on 21 km² of desert\n(the Eldorado Valley already has 800 MW)",ha="center",va="bottom",fontsize=10,color=T,weight="bold")
ax.plot([19.5,19.5,10.1],[172,120,120],color=NEUF,lw=2);ax.plot([10.1,10.1],[120,172],color=NEUF,lw=2)
ax.text(15,108,"NEW: 20 km line to the Hoover substation",ha="center",va="top",fontsize=9.5,color=NEUF,weight="bold")
ax.text(3,60,"By day: 1,500 MWp sell 2,560 GWh through the Hoover substation, free 19 h out of 24,\nand 823 GWh pump 1.5 km³ of water a year from Lake Mohave to Lake Mead (0.2% of the lake per day).\nIn the evening: the existing turbines return 644 GWh more, 371 more hours a year.\nNothing dug for the water: no basin, no dam, no new turbine, no water permit.\n3,201 GWh more sold a year for 1,144 M€: 0.357 M€ per annual GWh, 23.5 €/MWh private, 19.6 public.",ha="left",va="center",fontsize=10.5,color=T)
ax.plot([20,24],[-18,-18],color=T,lw=3);ax.text(22,-10,"4 km (horizontal); heights are in metres, the vertical scale is stretched",ha="center",fontsize=9,color=G)
ax.plot([24.5,24.5],[170,370],color=T,lw=2);ax.text(24.7,270,"200 m",va="center",fontsize=9,color=G)
ax.set_title("Hydroloop Muhleisen 2026 V21 Barrage on the Hoover Dam: the civil works are already paid for, we add the sun, pumps and the operating rule of a Sky. www.mulo.world, 26/10/2026, CC BY 4.0",fontsize=12.5,color=T,weight="bold",pad=14)
plt.tight_layout()
plt.savefig("schema_hydroloop_muhleisen_2026_v21_barrage_hoover.png",dpi=110,facecolor="white")
print("ok")
