In MW
    """
    c = vresutils.reatlas.solarpanelconf_to_solar_panel_config_object(panel)
    return c['A'] + c['B'] * 1000 + c['C'] * np.log(1000)

solar_layouts = DEgen.eeg_solarlayouts(graph,cutout)

panel_cap = panel_capacity(solar_layouts[0]["panel"])
solar_caps = pd.Series(solar_layouts[1].sum(axis=(1,2))*panel_cap,
                       graph.nodes())

solar_caps.describe(),solar_caps.sum()

(generation.solar.max()/solar_caps).describe()

windon_layouts = DEgen.eeg_windonlayouts_per_class(graph,cutout)

windon_capacities = pd.DataFrame(index=graph.nodes())
for turbine_items in windon_layouts:
    name = turbine_items[0]["onshore"]
    turbine_cap = np.array(vresutils.reatlas.turbineconf_to_powercurve_object(name)["POW"]).max()
    print(name,turbine_cap)
    windon_capacities[name] = turbine_items[1].sum(axis=(1,2))*turbine_cap/1000.

windon_caps = windon_capacities.sum(axis=1)
windon_caps.describe(),windon_caps.sum()

(generation.windon.max()/windon_caps).describe()

windoff_layouts = DEgen.eeg_windofflayouts_per_class(graph,cutout)
    """
    c = vresutils.reatlas.solarpanelconf_to_solar_panel_config_object(panel)
    return c['A'] + c['B'] * 1000 + c['C'] * np.log(1000)


solar_layouts = DEgen.eeg_solarlayouts(graph, cutout)

panel_cap = panel_capacity(solar_layouts[0]["panel"])
solar_caps = pd.Series(solar_layouts[1].sum(axis=(1, 2)) * panel_cap,
                       graph.nodes())

solar_caps.describe(), solar_caps.sum()

(generation.solar.max() / solar_caps).describe()

windon_layouts = DEgen.eeg_windonlayouts_per_class(graph, cutout)

windon_capacities = pd.DataFrame(index=graph.nodes())
for turbine_items in windon_layouts:
    name = turbine_items[0]["onshore"]
    turbine_cap = np.array(
        vresutils.reatlas.turbineconf_to_powercurve_object(name)["POW"]).max()
    print(name, turbine_cap)
    windon_capacities[name] = turbine_items[1].sum(
        axis=(1, 2)) * turbine_cap / 1000.

windon_caps = windon_capacities.sum(axis=1)
windon_caps.describe(), windon_caps.sum()

(generation.windon.max() / windon_caps).describe()