# Path: example/modelchain_example.py
# def get_weather_data(filename="weather.csv", **kwargs):
# def initialize_wind_turbines():
# def calculate_power_output(weather, my_turbine, e126, my_turbine2):
# def plot_or_print(my_turbine, e126, my_turbine2):
# def run_example():
# 
# Path: example/turbine_cluster_modelchain_example.py
# def initialize_wind_farms(my_turbine, e126):
# def initialize_wind_turbine_cluster(example_farm, example_farm_2):
# def calculate_power_output(weather, example_farm, example_cluster):
# def plot_or_print(example_farm, example_cluster):
# def run_example():


import os
import subprocess
import tempfile
import nbformat
import sys
import pytest
from example import modelchain_example as mc_e
from example import turbine_cluster_modelchain_example as tc_mc_e
from numpy.testing import assert_allclose
"""
SPDX-FileCopyrightText: 2019 oemof developer group <contact@oemof.org>
SPDX-License-Identifier: MIT
"""



class TestExamples:
    def test_modelchain_example_flh(self):
        # tests full load hours
        weather = mc_e.get_weather_data("weather.csv")
        my_turbine, e126, dummy_turbine = mc_e.initialize_wind_turbines()
        mc_e.calculate_power_output(weather, my_turbine, e126, dummy_turbine)

        assert_allclose(
            2730.142, (e126.power_output.sum() / e126.nominal_power), 0.01
        )
        assert_allclose(
            1882.7567,
            (my_turbine.power_output.sum() / my_turbine.nominal_power),
            0.01,
        )

    def test_turbine_cluster_modelchain_example_flh(self):
        # tests full load hours
        weather = mc_e.get_weather_data("weather.csv")
        my_turbine, e126, dummy_turbine = mc_e.initialize_wind_turbines()
        example_farm, example_farm_2 = tc_mc_e.initialize_wind_farms(
            my_turbine, e126
        )

# Path: example/modelchain_example.py
# def get_weather_data(filename="weather.csv", **kwargs):
# def initialize_wind_turbines():
# def calculate_power_output(weather, my_turbine, e126, my_turbine2):
# def plot_or_print(my_turbine, e126, my_turbine2):
# def run_example():
# 
# Path: example/turbine_cluster_modelchain_example.py
# def initialize_wind_farms(my_turbine, e126):
# def initialize_wind_turbine_cluster(example_farm, example_farm_2):
# def calculate_power_output(weather, example_farm, example_cluster):
# def plot_or_print(example_farm, example_cluster):
# def run_example():


# Path: example/test_examples.py
import os
import subprocess
import tempfile
import nbformat
import sys
import pytest
from example import modelchain_example as mc_e
from example import turbine_cluster_modelchain_example as tc_mc_e
from numpy.testing import assert_allclose

"""
SPDX-FileCopyrightText: 2019 oemof developer group <contact@oemof.org>
SPDX-License-Identifier: MIT
"""



class TestExamples:
    def test_modelchain_example_flh(self):
        # tests full load hours
        weather = mc_e.get_weather_data("weather.csv")
        my_turbine, e126, dummy_turbine = mc_e.initialize_wind_turbines()
        mc_e.calculate_power_output(weather, my_turbine, e126, dummy_turbine)

        assert_allclose(
            2730.142, (e126.power_output.sum() / e126.nominal_power), 0.01
        )
        assert_allclose(
            1882.7567,
            (my_turbine.power_output.sum() / my_turbine.nominal_power),
            0.01,
        )

    def test_turbine_cluster_modelchain_example_flh(self):
        # tests full load hours
        weather = mc_e.get_weather_data("weather.csv")
        my_turbine, e126, dummy_turbine = mc_e.initialize_wind_turbines()
        example_farm, example_farm_2 = tc_mc_e.initialize_wind_farms(
            my_turbine, e126
        )

        example_cluster = tc_mc_e.initialize_wind_turbine_cluster(