From 82368434853a354fa475e2cc3a337331eed262f8 Mon Sep 17 00:00:00 2001 From: uvchik Date: Tue, 7 Apr 2020 09:16:53 +0200 Subject: [PATCH 01/19] Add module for data handling It might be a good idea to copy some other data-functions to this module. --- tests/test_data_handling.py | 10 ++++++++++ windpowerlib/data.py | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 tests/test_data_handling.py create mode 100644 windpowerlib/data.py diff --git a/tests/test_data_handling.py b/tests/test_data_handling.py new file mode 100644 index 00000000..12af7005 --- /dev/null +++ b/tests/test_data_handling.py @@ -0,0 +1,10 @@ +""" +SPDX-FileCopyrightText: 2019 oemof developer group +SPDX-License-Identifier: MIT +""" + +from windpowerlib import data + + +def test_integretiy_check(): + data.check_data_integretiy() diff --git a/windpowerlib/data.py b/windpowerlib/data.py new file mode 100644 index 00000000..f8a6a67e --- /dev/null +++ b/windpowerlib/data.py @@ -0,0 +1,10 @@ +""" +The ``data`` module contains functions to handle the needed data. + +SPDX-FileCopyrightText: 2019 oemof developer group +SPDX-License-Identifier: MIT +""" + + +def check_data_integretiy(): + pass From 3d80ad3b5fd7d2a534588f2b785fff94ffb22956 Mon Sep 17 00:00:00 2001 From: uvchik Date: Fri, 22 May 2020 14:54:26 +0200 Subject: [PATCH 02/19] Move function create_power_curve to power_curves module --- windpowerlib/power_curves.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/windpowerlib/power_curves.py b/windpowerlib/power_curves.py index 00549a01..43df0071 100644 --- a/windpowerlib/power_curves.py +++ b/windpowerlib/power_curves.py @@ -266,3 +266,24 @@ def wake_losses_to_power_curve( "but is {}".format(type(wind_farm_efficiency)) ) return power_curve_df + + +def create_power_curve(wind_speed, power): + """ + A list, numpy.array, pandas.Series or other iterables can be passed to + define the wind speed and the power output. Make sure that the order is + not mutable because, values from both parameters will be used as value + pairs. + + Parameters + ---------- + wind_speed : iterable + A series of wind speed values in meter per second [m/s]. + power : iterable + A series of power values in Watt [W]. + + Returns + ------- + pandas.DataFrame + """ + return pd.DataFrame(data={"value": power, "wind_speed": wind_speed}) From 73f65f7e83effc3c8fae7a121793bdc6c77dd2e6 Mon Sep 17 00:00:00 2001 From: uvchik Date: Fri, 22 May 2020 14:56:47 +0200 Subject: [PATCH 03/19] Move data functions from wind_turbine to data --- example/modelchain_example.ipynb | 2 +- tests/test_data_handling.py | 2 +- tests/test_wind_turbine.py | 6 +- windpowerlib/__init__.py | 4 +- windpowerlib/data.py | 307 ++++++++++++++++++++++++++++++- windpowerlib/wind_turbine.py | 216 +--------------------- 6 files changed, 316 insertions(+), 221 deletions(-) diff --git a/example/modelchain_example.ipynb b/example/modelchain_example.ipynb index 1b4dfa9e..18440f98 100644 --- a/example/modelchain_example.ipynb +++ b/example/modelchain_example.ipynb @@ -41,7 +41,7 @@ "\n", "from windpowerlib.modelchain import ModelChain\n", "from windpowerlib.wind_turbine import WindTurbine\n", - "from windpowerlib import wind_turbine as wt" + "from windpowerlib import data as wt" ] }, { diff --git a/tests/test_data_handling.py b/tests/test_data_handling.py index 12af7005..5e2bd46e 100644 --- a/tests/test_data_handling.py +++ b/tests/test_data_handling.py @@ -7,4 +7,4 @@ def test_integretiy_check(): - data.check_data_integretiy() + pass diff --git a/tests/test_wind_turbine.py b/tests/test_wind_turbine.py index 12af8763..5d4e4bf0 100644 --- a/tests/test_wind_turbine.py +++ b/tests/test_wind_turbine.py @@ -12,11 +12,11 @@ from windpowerlib.wind_turbine import ( get_turbine_data_from_file, WindTurbine, - get_turbine_types, WindTurbineGroup, - load_turbine_data_from_oedb, ) +from windpowerlib.data import store_turbine_data_from_oedb, get_turbine_types + class TestWindTurbine: @classmethod @@ -54,7 +54,7 @@ def test_wrong_url_load_turbine_data(self): with pytest.raises( ConnectionError, match="Database connection not successful" ): - load_turbine_data_from_oedb("wrong_schema") + store_turbine_data_from_oedb("wrong_schema") @pytest.mark.filterwarnings("ignore:The WindTurbine") def test_string_representation_of_wind_turbine(self): diff --git a/windpowerlib/__init__.py b/windpowerlib/__init__.py index 86aa5125..f65b4c63 100644 --- a/windpowerlib/__init__.py +++ b/windpowerlib/__init__.py @@ -3,8 +3,8 @@ __version__ = "0.2.1dev" from .wind_turbine import WindTurbine # noqa: F401 -from .wind_turbine import get_turbine_types # noqa: F401 -from .wind_turbine import create_power_curve # noqa: F401 +from .data import get_turbine_types # noqa: F401 +from .power_curves import create_power_curve # noqa: F401 from .wind_farm import WindFarm # noqa: F401 from .wind_turbine_cluster import WindTurbineCluster # noqa: F401 from .modelchain import ModelChain # noqa: F401 diff --git a/windpowerlib/data.py b/windpowerlib/data.py index f8a6a67e..63938ff5 100644 --- a/windpowerlib/data.py +++ b/windpowerlib/data.py @@ -5,6 +5,309 @@ SPDX-License-Identifier: MIT """ +import os +import warnings +import logging +from datetime import datetime +from shutil import copyfile -def check_data_integretiy(): - pass +import pandas as pd +import requests + +from windpowerlib.wind_turbine import WindTurbine + + +def get_turbine_types(turbine_library="local", print_out=True, filter_=True): + r""" + Get all provided wind turbine types provided. + + Choose by `turbine_library` whether to get wind turbine types provided by + the OpenEnergy Database ('oedb') or wind turbine types provided in your + local file(s) ('local'). + By default only turbine types for which a power coefficient curve or power + curve is provided are returned. Set `filter_=False` to see all turbine + types for which any data (e.g. hub height, rotor diameter, ...) is + provided. + + Parameters + ---------- + turbine_library : str + Specifies if the oedb turbine library ('oedb') or your local turbine + data file ('local') is evaluated. Default: 'local'. + print_out : bool + Directly prints a tabular containing the turbine types in column + 'turbine_type', the manufacturer in column 'manufacturer' and + information about whether a power (coefficient) curve exists (True) or + not (False) in columns 'has_power_curve' and 'has_cp_curve'. + Default: True. + filter_ : bool + If True only turbine types for which a power coefficient curve or + power curve is provided in the oedb turbine library are + returned. Default: True. + + Returns + ------- + :pandas:`pandas.DataFrame` + Contains turbine types in column 'turbine_type', the manufacturer in + column 'manufacturer' and information about whether a power + (coefficient) curve exists (True) or not (False) in columns + 'has_power_curve' and 'has_cp_curve'. + + Notes + ----- + If the power (coefficient) curve of the desired turbine type (or the + turbine type itself) is missing you can contact us via github or + windpowerlib@rl-institut.de. You can help us by providing data in the + format as shown in + `the data base `_. + + Examples + -------- + >>> from windpowerlib import get_turbine_types + >>> df=get_turbine_types(print_out=False) + >>> print(df[df["turbine_type"].str.contains("E-126")].iloc[0]) + manufacturer Enercon + turbine_type E-126/4200 + has_power_curve True + has_cp_curve True + Name: 5, dtype: object + >>> print(df[df["manufacturer"].str.contains("Enercon")].iloc[0]) + manufacturer Enercon + turbine_type E-101/3050 + has_power_curve True + has_cp_curve True + Name: 1, dtype: object + + """ + if turbine_library == "local": + filename = os.path.join( + os.path.dirname(__file__), "oedb", "turbine_data.csv" + ) + df = pd.read_csv(filename, index_col=0).reset_index() + elif turbine_library == "oedb": + df = fetch_turbine_data_from_oedb() + + else: + raise ValueError( + "`turbine_library` is '{}' ".format(turbine_library) + + "but must be 'local' or 'oedb'." + ) + if filter_: + cp_curves_df = df.loc[df["has_cp_curve"]][ + ["manufacturer", "turbine_type", "has_cp_curve"] + ] + p_curves_df = df.loc[df["has_power_curve"]][ + ["manufacturer", "turbine_type", "has_power_curve"] + ] + curves_df = pd.merge( + p_curves_df, cp_curves_df, how="outer", sort=True + ).fillna(False) + else: + curves_df = df[ + ["manufacturer", "turbine_type", "has_power_curve", "has_cp_curve"] + ] + if print_out: + pd.set_option("display.max_rows", len(curves_df)) + print(curves_df) + pd.reset_option("display.max_rows") + return curves_df + + +def fetch_turbine_data_from_oedb( + schema="supply", table="wind_turbine_library"): + r""" + Fetches turbine library from the OpenEnergy database (oedb). + + Parameters + ---------- + schema : str + Database schema of the turbine library. + table : str + Table name of the turbine library. + + Returns + ------- + :pandas:`pandas.DataFrame` + Turbine data of different turbines such as 'manufacturer', + 'turbine_type', 'nominal_power'. + + """ + # url of OpenEnergy Platform that contains the oedb + oep_url = "http://oep.iks.cs.ovgu.de/" + + # load data + result = requests.get( + oep_url + "/api/v0/schema/{}/tables/{}/rows/?".format(schema, table), + ) + if not result.status_code == 200: + raise ConnectionError( + "Database connection not successful. " + "Response: [{}]".format(result.status_code) + ) + # extract data to dataframe + return pd.DataFrame(result.json()) + + +def load_turbine_data_from_oedb( + schema="supply", table="wind_turbine_library"): + msg = ("\nUse >>store_turbine_data_from_oedb<< and not" + " >>load_turbine_data_from_oedb<<") + warnings.warn(msg, FutureWarning) + return store_turbine_data_from_oedb( + schema=schema, table=table) + + +def store_turbine_data_from_oedb( + schema="supply", table="wind_turbine_library"): + r""" + Loads turbine library from the OpenEnergy database (oedb). + + Turbine data is saved to csv files ('oedb_power_curves.csv', + 'oedb_power_coefficient_curves.csv' and 'oedb_nominal_power') for offline + usage of the windpowerlib. If the files already exist they are overwritten. + + Parameters + ---------- + schema : str + Database schema of the turbine library. + table : str + Table name of the turbine library. + + Returns + ------- + :pandas:`pandas.DataFrame` + Turbine data of different turbines such as 'manufacturer', + 'turbine_type', 'nominal_power'. + + """ + turbine_data = fetch_turbine_data_from_oedb(schema=schema, table=table) + # standard file name for saving data + filename = os.path.join(os.path.dirname(__file__), "oedb", "{}.csv") + + time_stamp = datetime.now().strftime('%Y%m%d%H%M%S') + # get all power (coefficient) curves and save to file + # for curve_type in ['power_curve', 'power_coefficient_curve']: + for curve_type in ["power_curve", "power_coefficient_curve"]: + curves_df = pd.DataFrame(columns=["wind_speed"]) + for index in turbine_data.index: + if ( + turbine_data["{}_wind_speeds".format(curve_type)][index] + and turbine_data["{}_values".format(curve_type)][index] + ): + df = ( + pd.DataFrame( + data=[ + eval( + turbine_data[ + "{}_wind_speeds".format(curve_type) + ][index] + ), + eval( + turbine_data["{}_values".format(curve_type)][ + index + ] + ), + ] + ) + .transpose() + .rename( + columns={ + 0: "wind_speed", + 1: turbine_data["turbine_type"][index], + } + ) + ) + curves_df = pd.merge( + left=curves_df, right=df, how="outer", on="wind_speed" + ) + curves_df = curves_df.set_index("wind_speed").sort_index().transpose() + # power curve values in W + if curve_type == "power_curve": + curves_df *= 1000 + curves_df.index.name = "turbine_type" + copyfile(filename.format("{}s".format(curve_type)), + filename.format("{0}s_{1}".format(curve_type, time_stamp))) + curves_df.to_csv(filename.format("{}s".format(curve_type))) + + # get turbine data and save to file (excl. curves) + turbine_data_df = turbine_data.drop( + [ + "power_curve_wind_speeds", + "power_curve_values", + "power_coefficient_curve_wind_speeds", + "power_coefficient_curve_values", + "thrust_coefficient_curve_wind_speeds", + "thrust_coefficient_curve_values", + ], + axis=1, + ).set_index("turbine_type") + # nominal power in W + turbine_data_df["nominal_power"] *= 1000 + copyfile(filename.format("turbine_data"), + filename.format("turbine_data_{0}".format(time_stamp))) + check_imported_data(turbine_data_df, filename, time_stamp) + turbine_data_df.to_csv(filename.format("turbine_data")) + remove_tmp_file(filename, time_stamp) + return turbine_data + + +def remove_tmp_file(filename, time_stamp): + os.remove(filename.format("turbine_data_{0}".format(time_stamp))) + for curve_type in ["power_curve", "power_coefficient_curve"]: + copyfile( + filename.format("{0}s_{1}".format(curve_type, time_stamp)), + filename.format("{}s".format(curve_type))) + os.remove( + filename.format("{0}s_{1}".format(curve_type, time_stamp))) + + +def check_imported_data(data, filename, time_stamp): + data.to_csv(filename.format("turbine_data")) + try: + data = check_data_integretiy(data) + except Exception as e: + copyfile(filename.format("turbine_data"), + filename.format("turbine_data_error{0}".format(time_stamp))) + copyfile(filename.format("turbine_data_{0}".format(time_stamp)), + filename.format("turbine_data")) + for curve_type in ["power_curve", "power_coefficient_curve"]: + copyfile( + filename.format("{}s".format(curve_type)), + filename.format("{0}s_error_{1}".format( + curve_type, time_stamp)) + ) + copyfile( + filename.format("{0}s_{1}".format(curve_type, time_stamp)), + filename.format("{}s".format(curve_type))) + remove_tmp_file(filename, time_stamp) + raise e + return data + + +def check_data_integretiy(data): + for dataset in data.iterrows(): + ttype = dataset[0] + enercon_e126 = { + "turbine_type": "{0}".format(ttype), + "hub_height": 135} + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + wt = WindTurbine(**enercon_e126) + if wt.power_curve is None and dataset[1].has_power_curve is True: + logging.warning( + "{0}: No power curve but has_power_curve=True.".format( + ttype + )) + if (wt.power_coefficient_curve is None and + dataset[1].has_cp_curve is True): + logging.warning( + "{0}: No cp-curve but has_cp_curve=True.".format( + ttype + )) + if dataset[1].has_power_curve is True: + if len(wt.power_curve) < 22: + logging.warning( + "{0}: power_curve is to short ({1} values),".format( + ttype, len(wt.power_curve) + )) + return data diff --git a/windpowerlib/wind_turbine.py b/windpowerlib/wind_turbine.py index 1c71aab9..41c24472 100644 --- a/windpowerlib/wind_turbine.py +++ b/windpowerlib/wind_turbine.py @@ -9,7 +9,6 @@ import pandas as pd import logging import warnings -import requests import os from windpowerlib.tools import WindpowerlibUserWarning from typing import NamedTuple @@ -409,215 +408,8 @@ def get_turbine_data_from_file(turbine_type, path): return wpp_df -def create_power_curve(wind_speed, power): - """ - A list, numpy.array, pandas.Series or other iterables can be passed to - define the wind speed and the power output. Make sure that the order is - not mutable because, values from both parameters will be used as value - pairs. - - Parameters - ---------- - wind_speed : iterable - A series of wind speed values in meter per second [m/s]. - power : iterable - A series of power values in Watt [W]. - - Returns - ------- - pandas.DataFrame - """ - return pd.DataFrame(data={"value": power, "wind_speed": wind_speed}) - - -def load_turbine_data_from_oedb(schema="supply", table="wind_turbine_library"): - r""" - Loads turbine library from the OpenEnergy database (oedb). - - Turbine data is saved to csv files ('oedb_power_curves.csv', - 'oedb_power_coefficient_curves.csv' and 'oedb_nominal_power') for offline - usage of the windpowerlib. If the files already exist they are overwritten. - - Parameters - ---------- - schema : str - Database schema of the turbine library. - table : str - Table name of the turbine library. - - Returns - ------- - :pandas:`pandas.DataFrame` - Turbine data of different turbines such as 'manufacturer', - 'turbine_type', 'nominal_power'. - - """ - # url of OpenEnergy Platform that contains the oedb - oep_url = "http://oep.iks.cs.ovgu.de/" - - # load data - result = requests.get( - oep_url + "/api/v0/schema/{}/tables/{}/rows/?".format(schema, table), - ) - if not result.status_code == 200: - raise ConnectionError( - "Database connection not successful. " - "Response: [{}]".format(result.status_code) - ) - # extract data to dataframe - turbine_data = pd.DataFrame(result.json()) - # standard file name for saving data - filename = os.path.join(os.path.dirname(__file__), "oedb", "{}.csv") - # get all power (coefficient) curves and save to file - # for curve_type in ['power_curve', 'power_coefficient_curve']: - for curve_type in ["power_curve", "power_coefficient_curve"]: - curves_df = pd.DataFrame(columns=["wind_speed"]) - for index in turbine_data.index: - if ( - turbine_data["{}_wind_speeds".format(curve_type)][index] - and turbine_data["{}_values".format(curve_type)][index] - ): - df = ( - pd.DataFrame( - data=[ - eval( - turbine_data[ - "{}_wind_speeds".format(curve_type) - ][index] - ), - eval( - turbine_data["{}_values".format(curve_type)][ - index - ] - ), - ] - ) - .transpose() - .rename( - columns={ - 0: "wind_speed", - 1: turbine_data["turbine_type"][index], - } - ) - ) - curves_df = pd.merge( - left=curves_df, right=df, how="outer", on="wind_speed" - ) - curves_df = curves_df.set_index("wind_speed").sort_index().transpose() - # power curve values in W - if curve_type == "power_curve": - curves_df *= 1000 - curves_df.index.name = "turbine_type" - curves_df.to_csv(filename.format("{}s".format(curve_type))) - - # get turbine data and save to file (excl. curves) - turbine_data_df = turbine_data.drop( - [ - "power_curve_wind_speeds", - "power_curve_values", - "power_coefficient_curve_wind_speeds", - "power_coefficient_curve_values", - "thrust_coefficient_curve_wind_speeds", - "thrust_coefficient_curve_values", - ], - axis=1, - ).set_index("turbine_type") - # nominal power in W - turbine_data_df["nominal_power"] *= 1000 - turbine_data_df.to_csv(filename.format("turbine_data")) - return turbine_data - - def get_turbine_types(turbine_library="local", print_out=True, filter_=True): - r""" - Get all provided wind turbine types provided. - - Choose by `turbine_library` whether to get wind turbine types provided by - the OpenEnergy Database ('oedb') or wind turbine types provided in your - local file(s) ('local'). - By default only turbine types for which a power coefficient curve or power - curve is provided are returned. Set `filter_=False` to see all turbine - types for which any data (e.g. hub height, rotor diameter, ...) is - provided. - - Parameters - ---------- - turbine_library : str - Specifies if the oedb turbine library ('oedb') or your local turbine - data file ('local') is evaluated. Default: 'local'. - print_out : bool - Directly prints a tabular containing the turbine types in column - 'turbine_type', the manufacturer in column 'manufacturer' and - information about whether a power (coefficient) curve exists (True) or - not (False) in columns 'has_power_curve' and 'has_cp_curve'. - Default: True. - filter_ : bool - If True only turbine types for which a power coefficient curve or - power curve is provided in the oedb turbine library are - returned. Default: True. - - Returns - ------- - :pandas:`pandas.DataFrame` - Contains turbine types in column 'turbine_type', the manufacturer in - column 'manufacturer' and information about whether a power - (coefficient) curve exists (True) or not (False) in columns - 'has_power_curve' and 'has_cp_curve'. - - Notes - ----- - If the power (coefficient) curve of the desired turbine type (or the - turbine type itself) is missing you can contact us via github or - windpowerlib@rl-institut.de. You can help us by providing data in the - format as shown in - `the data base `_. - - Examples - -------- - >>> from windpowerlib import wind_turbine - >>> df=wind_turbine.get_turbine_types(print_out=False) - >>> print(df[df["turbine_type"].str.contains("E-126")].iloc[0]) - manufacturer Enercon - turbine_type E-126/4200 - has_power_curve True - has_cp_curve True - Name: 5, dtype: object - >>> print(df[df["manufacturer"].str.contains("Enercon")].iloc[0]) - manufacturer Enercon - turbine_type E-101/3050 - has_power_curve True - has_cp_curve True - Name: 1, dtype: object - - """ - if turbine_library == "local": - filename = os.path.join( - os.path.dirname(__file__), "oedb", "turbine_data.csv" - ) - df = pd.read_csv(filename, index_col=0).reset_index() - elif turbine_library == "oedb": - df = load_turbine_data_from_oedb() - else: - raise ValueError( - "`turbine_library` is '{}' ".format(turbine_library) - + "but must be 'local' or 'oedb'." - ) - if filter_: - cp_curves_df = df.loc[df["has_cp_curve"]][ - ["manufacturer", "turbine_type", "has_cp_curve"] - ] - p_curves_df = df.loc[df["has_power_curve"]][ - ["manufacturer", "turbine_type", "has_power_curve"] - ] - curves_df = pd.merge( - p_curves_df, cp_curves_df, how="outer", sort=True - ).fillna(False) - else: - curves_df = df[ - ["manufacturer", "turbine_type", "has_power_curve", "has_cp_curve"] - ] - if print_out: - pd.set_option("display.max_rows", len(curves_df)) - print(curves_df) - pd.reset_option("display.max_rows") - return curves_df + print(turbine_library, print_out, filter_) + msg = ("\nUse >>from windpowerlib import get_turbine_types<< not" + ">>from windpowerlib.turbine import get_turbine_types<< not ") + raise(ImportError, msg) From 35c24561b5c29676520b5b9bc46d21a52bfb4905 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 22 May 2020 12:57:02 +0000 Subject: [PATCH 04/19] Fixing style errors. --- windpowerlib/data.py | 81 +++++++++++++++++++++--------------- windpowerlib/wind_turbine.py | 8 ++-- 2 files changed, 52 insertions(+), 37 deletions(-) diff --git a/windpowerlib/data.py b/windpowerlib/data.py index 63938ff5..62c3b3a7 100644 --- a/windpowerlib/data.py +++ b/windpowerlib/data.py @@ -114,7 +114,8 @@ def get_turbine_types(turbine_library="local", print_out=True, filter_=True): def fetch_turbine_data_from_oedb( - schema="supply", table="wind_turbine_library"): + schema="supply", table="wind_turbine_library" +): r""" Fetches turbine library from the OpenEnergy database (oedb). @@ -148,17 +149,18 @@ def fetch_turbine_data_from_oedb( return pd.DataFrame(result.json()) -def load_turbine_data_from_oedb( - schema="supply", table="wind_turbine_library"): - msg = ("\nUse >>store_turbine_data_from_oedb<< and not" - " >>load_turbine_data_from_oedb<<") +def load_turbine_data_from_oedb(schema="supply", table="wind_turbine_library"): + msg = ( + "\nUse >>store_turbine_data_from_oedb<< and not" + " >>load_turbine_data_from_oedb<<" + ) warnings.warn(msg, FutureWarning) - return store_turbine_data_from_oedb( - schema=schema, table=table) + return store_turbine_data_from_oedb(schema=schema, table=table) def store_turbine_data_from_oedb( - schema="supply", table="wind_turbine_library"): + schema="supply", table="wind_turbine_library" +): r""" Loads turbine library from the OpenEnergy database (oedb). @@ -184,7 +186,7 @@ def store_turbine_data_from_oedb( # standard file name for saving data filename = os.path.join(os.path.dirname(__file__), "oedb", "{}.csv") - time_stamp = datetime.now().strftime('%Y%m%d%H%M%S') + time_stamp = datetime.now().strftime("%Y%m%d%H%M%S") # get all power (coefficient) curves and save to file # for curve_type in ['power_curve', 'power_coefficient_curve']: for curve_type in ["power_curve", "power_coefficient_curve"]: @@ -225,8 +227,10 @@ def store_turbine_data_from_oedb( if curve_type == "power_curve": curves_df *= 1000 curves_df.index.name = "turbine_type" - copyfile(filename.format("{}s".format(curve_type)), - filename.format("{0}s_{1}".format(curve_type, time_stamp))) + copyfile( + filename.format("{}s".format(curve_type)), + filename.format("{0}s_{1}".format(curve_type, time_stamp)), + ) curves_df.to_csv(filename.format("{}s".format(curve_type))) # get turbine data and save to file (excl. curves) @@ -243,8 +247,10 @@ def store_turbine_data_from_oedb( ).set_index("turbine_type") # nominal power in W turbine_data_df["nominal_power"] *= 1000 - copyfile(filename.format("turbine_data"), - filename.format("turbine_data_{0}".format(time_stamp))) + copyfile( + filename.format("turbine_data"), + filename.format("turbine_data_{0}".format(time_stamp)), + ) check_imported_data(turbine_data_df, filename, time_stamp) turbine_data_df.to_csv(filename.format("turbine_data")) remove_tmp_file(filename, time_stamp) @@ -256,9 +262,9 @@ def remove_tmp_file(filename, time_stamp): for curve_type in ["power_curve", "power_coefficient_curve"]: copyfile( filename.format("{0}s_{1}".format(curve_type, time_stamp)), - filename.format("{}s".format(curve_type))) - os.remove( - filename.format("{0}s_{1}".format(curve_type, time_stamp))) + filename.format("{}s".format(curve_type)), + ) + os.remove(filename.format("{0}s_{1}".format(curve_type, time_stamp))) def check_imported_data(data, filename, time_stamp): @@ -266,19 +272,25 @@ def check_imported_data(data, filename, time_stamp): try: data = check_data_integretiy(data) except Exception as e: - copyfile(filename.format("turbine_data"), - filename.format("turbine_data_error{0}".format(time_stamp))) - copyfile(filename.format("turbine_data_{0}".format(time_stamp)), - filename.format("turbine_data")) + copyfile( + filename.format("turbine_data"), + filename.format("turbine_data_error{0}".format(time_stamp)), + ) + copyfile( + filename.format("turbine_data_{0}".format(time_stamp)), + filename.format("turbine_data"), + ) for curve_type in ["power_curve", "power_coefficient_curve"]: copyfile( filename.format("{}s".format(curve_type)), - filename.format("{0}s_error_{1}".format( - curve_type, time_stamp)) - ) + filename.format( + "{0}s_error_{1}".format(curve_type, time_stamp) + ), + ) copyfile( filename.format("{0}s_{1}".format(curve_type, time_stamp)), - filename.format("{}s".format(curve_type))) + filename.format("{}s".format(curve_type)), + ) remove_tmp_file(filename, time_stamp) raise e return data @@ -287,9 +299,7 @@ def check_imported_data(data, filename, time_stamp): def check_data_integretiy(data): for dataset in data.iterrows(): ttype = dataset[0] - enercon_e126 = { - "turbine_type": "{0}".format(ttype), - "hub_height": 135} + enercon_e126 = {"turbine_type": "{0}".format(ttype), "hub_height": 135} with warnings.catch_warnings(): warnings.simplefilter("ignore") wt = WindTurbine(**enercon_e126) @@ -297,17 +307,20 @@ def check_data_integretiy(data): logging.warning( "{0}: No power curve but has_power_curve=True.".format( ttype - )) - if (wt.power_coefficient_curve is None and - dataset[1].has_cp_curve is True): + ) + ) + if ( + wt.power_coefficient_curve is None + and dataset[1].has_cp_curve is True + ): logging.warning( - "{0}: No cp-curve but has_cp_curve=True.".format( - ttype - )) + "{0}: No cp-curve but has_cp_curve=True.".format(ttype) + ) if dataset[1].has_power_curve is True: if len(wt.power_curve) < 22: logging.warning( "{0}: power_curve is to short ({1} values),".format( ttype, len(wt.power_curve) - )) + ) + ) return data diff --git a/windpowerlib/wind_turbine.py b/windpowerlib/wind_turbine.py index 41c24472..f600de70 100644 --- a/windpowerlib/wind_turbine.py +++ b/windpowerlib/wind_turbine.py @@ -410,6 +410,8 @@ def get_turbine_data_from_file(turbine_type, path): def get_turbine_types(turbine_library="local", print_out=True, filter_=True): print(turbine_library, print_out, filter_) - msg = ("\nUse >>from windpowerlib import get_turbine_types<< not" - ">>from windpowerlib.turbine import get_turbine_types<< not ") - raise(ImportError, msg) + msg = ( + "\nUse >>from windpowerlib import get_turbine_types<< not" + ">>from windpowerlib.turbine import get_turbine_types<< not " + ) + raise (ImportError, msg) From f39d3bd70f6431853cffd59b0f6ac3aa536b005d Mon Sep 17 00:00:00 2001 From: uvchik Date: Fri, 22 May 2020 14:58:55 +0200 Subject: [PATCH 05/19] Revert changes in notebook --- example/modelchain_example.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/modelchain_example.ipynb b/example/modelchain_example.ipynb index 18440f98..1b4dfa9e 100644 --- a/example/modelchain_example.ipynb +++ b/example/modelchain_example.ipynb @@ -41,7 +41,7 @@ "\n", "from windpowerlib.modelchain import ModelChain\n", "from windpowerlib.wind_turbine import WindTurbine\n", - "from windpowerlib import data as wt" + "from windpowerlib import wind_turbine as wt" ] }, { From c12f2243fb0ff3ed9cfd6204e58f960b5289351d Mon Sep 17 00:00:00 2001 From: uvchik Date: Fri, 22 May 2020 15:00:11 +0200 Subject: [PATCH 06/19] Fix notebook test --- example/modelchain_example.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/modelchain_example.ipynb b/example/modelchain_example.ipynb index 7d80f76b..696301b2 100644 --- a/example/modelchain_example.ipynb +++ b/example/modelchain_example.ipynb @@ -41,7 +41,7 @@ "import requests\n", "\n", "from windpowerlib import ModelChain, WindTurbine, create_power_curve\n", - "from windpowerlib import wind_turbine as wt" + "from windpowerlib import data as wt" ] }, { From eac223e969d4d9370715a46539794d632ba9ea1a Mon Sep 17 00:00:00 2001 From: uvchik Date: Fri, 22 May 2020 15:01:13 +0200 Subject: [PATCH 07/19] Fix dummy test --- tests/test_data_handling.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/test_data_handling.py b/tests/test_data_handling.py index 5e2bd46e..31d8f8ba 100644 --- a/tests/test_data_handling.py +++ b/tests/test_data_handling.py @@ -3,8 +3,6 @@ SPDX-License-Identifier: MIT """ -from windpowerlib import data - def test_integretiy_check(): pass From d32aca5a23a9c9bab3c7b8d8d9ecb3c7e4899013 Mon Sep 17 00:00:00 2001 From: uvchik Date: Fri, 22 May 2020 15:15:33 +0200 Subject: [PATCH 08/19] Test new store function --- tests/test_wind_turbine.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_wind_turbine.py b/tests/test_wind_turbine.py index 5d4e4bf0..e7a1a38c 100644 --- a/tests/test_wind_turbine.py +++ b/tests/test_wind_turbine.py @@ -48,9 +48,11 @@ def test_get_turbine_types(self, capsys): with pytest.raises(ValueError, match=msg): get_turbine_types("wrong") + def test_store_turbine_data_from_oedb(self): + store_turbine_data_from_oedb() + def test_wrong_url_load_turbine_data(self): """Load turbine data from oedb.""" - with pytest.raises( ConnectionError, match="Database connection not successful" ): From 49da21357f181ff6ffd0313bc4d4d765d912ba23 Mon Sep 17 00:00:00 2001 From: uvchik Date: Fri, 22 May 2020 15:18:38 +0200 Subject: [PATCH 09/19] Fix if statement value --- windpowerlib/data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windpowerlib/data.py b/windpowerlib/data.py index 62c3b3a7..580422a6 100644 --- a/windpowerlib/data.py +++ b/windpowerlib/data.py @@ -317,7 +317,7 @@ def check_data_integretiy(data): "{0}: No cp-curve but has_cp_curve=True.".format(ttype) ) if dataset[1].has_power_curve is True: - if len(wt.power_curve) < 22: + if len(wt.power_curve) < 5: logging.warning( "{0}: power_curve is to short ({1} values),".format( ttype, len(wt.power_curve) From 7897a0114944e92419638705f367e18658a2ee11 Mon Sep 17 00:00:00 2001 From: uvchik Date: Fri, 22 May 2020 23:16:17 +0200 Subject: [PATCH 10/19] Add new test data sets --- tests/oedb/power_coefficient_curves.csv | 20 ++++++++ tests/oedb/power_curves.csv | 20 ++++++++ tests/oedb/power_curves_backup.csv | 68 +++++++++++++++++++++++++ tests/oedb/power_curves_broken.csv | 20 ++++++++ tests/oedb/turbine_data.csv | 20 ++++++++ 5 files changed, 148 insertions(+) create mode 100644 tests/oedb/power_coefficient_curves.csv create mode 100644 tests/oedb/power_curves.csv create mode 100644 tests/oedb/power_curves_backup.csv create mode 100644 tests/oedb/power_curves_broken.csv create mode 100644 tests/oedb/turbine_data.csv diff --git a/tests/oedb/power_coefficient_curves.csv b/tests/oedb/power_coefficient_curves.csv new file mode 100644 index 00000000..08b9b382 --- /dev/null +++ b/tests/oedb/power_coefficient_curves.csv @@ -0,0 +1,20 @@ +turbine_type,0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.2,4.5,5.0,5.2,5.5,6.0,6.2,6.5,7.0,7.5,8.0,8.1,8.5,8.8,9.0,9.5,10.0,10.2,10.5,11.0,11.1,11.5,12.0,12.5,13.0,13.5,14.0,14.5,15.0,15.5,16.0,16.5,17.0,17.5,18.0,18.5,19.0,19.5,20.0,20.5,21.0,21.5,22.0,22.5,23.0,23.5,24.0,24.5,25.0,26.0 +E48/800,,,0.0,,0.0,,0.17,,0.35,,,0.43,,,0.46,,,0.47,,0.48,,,,0.5,,0.5,,,0.45,,,0.39,,0.32,,0.27,,0.22,,0.18,,0.15,,0.13,,0.11,,0.09,,0.08,,0.07,,0.06,,0.05,,0.05, +E-115/3200,,,0.0,,0.06,,0.28,,0.38,,,0.42,,,0.45,,,0.47,,0.46,,,,0.45,,0.42,,,0.35,,,0.29,,0.23,,0.18,,0.15,,0.12,,0.1,,0.09,,0.07,,0.06,,0.05,,0.05,,0.04,,0.04,,0.03, +E-101/3500,,,0.0,,0.08,,0.28,,0.37,,,0.41,,,0.44,,,0.46,,0.47,,,,0.47,,0.46,,,0.43,,,0.38,,0.32,,0.26,,0.21,,0.17,,0.15,,0.12,,0.1,,0.09,,0.08,,0.07,,0.06,,0.05,,0.05, +E-126/4200,,,0.0,,0.0,,0.28,,0.37,,,0.41,,,0.44,,,0.45,,0.45,,,,0.43,,0.4,,,0.35,,,0.3,,0.24,,0.2,,0.16,,0.13,,0.11,,0.09,,0.08,,0.07,,0.06,,0.05,,0.04,,0.04,,0.03, +E-101/3050,,,0.0,,0.076,,0.279,,0.376,,,0.421,,,0.452,,,0.469,,0.478,,,,0.478,,0.477,,,0.439,,,0.358,,0.283,,0.227,,0.184,,0.152,,0.127,,0.107,,0.091,,0.078,,0.067,,0.058,,0.051,,0.045,,0.04, +E-115/3000,,,0.0,,0.058,,0.279,,0.376,,,0.421,,,0.451,,,0.469,,0.47,,,,0.445,,0.401,,,0.338,,,0.27,,0.212,,0.17,,0.138,,0.114,,0.095,,0.08,,0.068,,0.058,,0.05,,0.044,,0.038,,0.034,,0.03, +E-82/3000,,,0.0,,0.0,,0.286,,0.396,,,0.43,,,0.459,,,0.473,,0.483,,,,0.481,,0.467,,,0.437,,,0.394,,0.352,,0.312,,0.267,,0.226,,0.19,,0.16,,0.136,,0.117,,0.101,,0.088,,0.077,,0.068,,0.06, +E-92/2350,,,0.0,,0.11,,0.27,,0.38,,,0.41,,,0.44,,,0.46,,0.47,,,,0.47,,0.45,,,0.39,,,0.32,,0.26,,0.21,,0.17,,0.14,,0.12,,0.1,,0.08,,0.07,,0.06,,0.05,,0.05,,0.04,,0.04, +E-82/2350,,,0.0,,0.12,,0.29,,0.4,,,0.43,,,0.46,,,0.48,,0.49,,,,0.5,,0.49,,,0.44,,,0.38,,0.32,,0.26,,0.22,,0.18,,0.15,,0.12,,0.11,,0.09,,0.08,,0.07,,0.06,,0.05,,0.05, +E-82/2300,,,0.0,,0.12,,0.29,,0.4,,,0.43,,,0.46,,,0.48,,0.49,,,,0.5,,0.49,,,0.44,,,0.38,,0.32,,0.26,,0.22,,0.18,,0.15,,0.12,,0.11,,0.09,,0.08,,0.07,,0.06,,0.05,,0.05, +E-70/2300,,,0.0,,0.1,,0.27,,0.36,,,0.42,,,0.46,,,0.48,,0.5,,,,0.5,,0.5,,,0.49,,,0.45,,0.39,,0.34,,0.28,,0.23,,0.19,,0.16,,0.14,,0.12,,0.1,,0.09,,0.08,,0.07,,0.06, +E-82/2000,,,0.0,,0.12,,0.29,,0.4,,,0.43,,,0.46,,,0.48,,0.49,,,,0.5,,0.49,,,0.42,,,0.35,,0.29,,0.23,,0.19,,0.15,,0.13,,0.11,,0.09,,0.08,,0.07,,0.06,,0.05,,0.05,,0.04, +E-53/800,,,0.0,,0.19,,0.39,,0.44,,,0.46,,,0.48,,,0.49,,0.49,,,,0.49,,0.48,,,0.42,,,0.34,,0.27,,0.22,,0.18,,0.15,,0.12,,0.1,,0.09,,0.08,,0.06,,0.06,,0.05,,0.04,,0.04, +GE130/3200,,,,,,,0.255,0.367,0.413,,0.433,0.442,,0.448,0.45,,0.452,0.443,0.451,0.446,,0.436,,0.417,0.393,0.361,,0.326,0.292,,0.259,0.229,0.203,0.181,0.161,0.145,0.13,0.118,0.107,0.097,0.088,0.081,0.074,0.068,0.063,0.058,0.054,0.05,0.046,0.043,0.04,0.037,0.035,0.033,0.031,0.029,0.027,0.025, +GE120/2750,0.0,0.0,0.0,0.0,0.0,0.0,0.13,0.3,0.39,,0.43,0.45,,0.46,0.47,,0.48,0.48,0.48,0.47,,0.46,,0.43,0.4,0.36,,0.33,0.29,,0.26,0.23,0.23,0.23,0.23,0.23,0.23,0.23,0.23,0.23,0.23,0.23,0.23,0.23,0.23,0.23,0.23,0.23,0.23,0.23,0.23,0.23,0.23,0.23,0.23,0.23,0.23,0.23, +GE103/2750,0.0,0.0,0.0,0.0,0.0,0.0,0.12,0.25,0.32,,0.36,0.39,,0.42,0.43,,0.44,0.44,0.45,0.45,,0.45,,0.45,0.43,0.42,,0.39,0.36,,0.33,0.3,0.27,0.25,0.22,0.2,0.18,0.16,0.15,0.13,0.12,0.11,0.1,0.09,0.09,0.08,0.07,0.07,0.06,0.06,0.06,0.05,0.05,0.05,0.04,0.04,0.04,0.04, +GE120/2500,0.0,0.0,0.0,0.0,0.0,0.0,0.13,0.3,0.39,,0.43,0.45,,0.46,0.47,,0.48,0.48,0.48,0.47,,0.46,,0.43,0.39,0.35,,0.31,0.27,,0.24,0.21,0.19,0.17,0.15,0.13,0.12,0.11,0.1,0.09,0.08,0.07,0.065,0.06,0.055,0.05,0.05,0.05,,,,,,,,,,, +ENO126/3500,,,,,,,0.155,,0.419,,,0.444,,,0.442,,,0.446,,0.45,,,,0.419,,0.39,,,0.331,,,0.265,,0.209,,0.167,,0.136,,0.112,,0.093,,0.079,,0.067,,0.057,,0.049,,0.043,,0.038,,0.033,,0.029, +ENO114/3500,,,,,,,0.138,,,0.384,,,0.426,,,0.428,,0.421,,,0.427,,0.42,,,,0.404,,,0.378,,0.315,,0.251,,0.201,,0.163,,0.135,,0.112,,0.094,,0.08,,0.069,,0.06,,0.052,,0.045,,0.04,,0.035, \ No newline at end of file diff --git a/tests/oedb/power_curves.csv b/tests/oedb/power_curves.csv new file mode 100644 index 00000000..d52133bf --- /dev/null +++ b/tests/oedb/power_curves.csv @@ -0,0 +1,20 @@ +turbine_type,0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.2,4.5,5.0,5.2,5.5,6.0,6.2,6.5,7.0,7.5,8.0,8.1,8.5,8.8,9.0,9.5,10.0,10.2,10.5,11.0,11.1,11.5,12.0,12.5,13.0,13.5,14.0,14.5,15.0,15.5,16.0,16.5,17.0,17.5,18.0,18.5,19.0,19.5,20.0,20.5,21.0,21.5,22.0,22.5,23.0,23.5,24.0,24.5,25.0,25.5,26.0,26.5,27.0,27.5,28.0,28.5,29.0,29.5,30.0,30.5,31.0,31.5,32.0,32.5,33.0,33.5,34.0,34.5,35.0 +E48/800,,,0.0,,0.0,,5000.0,,25000.0,,,60000.0,,,110000.0,,,180000.0,,275000.0,,,,400000.0,,555000.0,,,671000.0,,,750000.0,,790000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,,,,,,,,,,,,,,,,,,, +E-115/3200,,,0.0,,3000.0,,49000.0,,155000.0,,,339000.0,,,628000.0,,,1036000.0,,1522000.0,,,,2215000.0,,2677000.0,,,3030000.0,,,3177000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,,,,,,,,,,,,,,,,,,, +E-101/3500,,,0.0,,3000.0,,37000.0,,116000.0,,,253000.0,,,469000.0,,,775000.0,,1175000.0,,,,1680000.0,,2280000.0,,,2810000.0,,,3200000.0,,3400000.0,,3465000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,,,,,,,,,,,,,,,,,,, +E-126/4200,,,0.0,,0.0,,58000.0,,185000.0,,,400000.0,,,745000.0,,,1200000.0,,1790000.0,,,,2450000.0,,3120000.0,,,3660000.0,,,4000000.0,,4150000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,,,,,,,,,,,,,,,,,,, +E-101/3050,0.0,0.0,0.0,0.0,3000.0,22000.0,49000.0,92000.0,155000.0,,240000.0,339000.0,,480000.0,628000.0,,830000.0,1035000.0,1292000.0,1549000.0,,1820000.0,,2090000.0,2350000.0,2580000.0,,2775000.0,2900000.0,,2980000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0 +E-115/3000,,,0.0,,3000.0,,48500.0,,155000.0,,,339000.0,,,627500.0,,,1035500.0,,1549000.0,,,,2090000.0,,2580000.0,,,2900000.0,,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,,,,,,,,,,,,,,,,,,, +E-82/3000,,,0.0,,0.0,,25000.0,,82000.0,,,174000.0,,,321000.0,,,525000.0,,800000.0,,,,1135000.0,,1510000.0,,,1880000.0,,,2200000.0,,2500000.0,,2770000.0,,2910000.0,,3000000.0,,3020000.0,,3020000.0,,3020000.0,,3020000.0,,3020000.0,,3020000.0,,3020000.0,,3020000.0,,3020000.0,,,,,,,,,,,,,,,,,,,, +E-92/2350,,,0.0,,3600.0,,29900.0,,98200.0,,,208300.0,,,384300.0,,,637000.0,,975800.0,,,,1403600.0,,1817800.0,,,2088699.9999999998,,,2237000.0,,2300000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,,,,,,,,,,,,,,,,,,, +E-82/2350,,,0.0,,3000.0,,25000.0,,82000.0,,,174000.0,,,321000.0,,,532000.0,,815000.0,,,,1180000.0,,1580000.0,,,1890000.0,,,2100000.0,,2250000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,,,,,,,,,,,,,,,,,,, +E-82/2300,,,0.0,,3000.0,,25000.0,,82000.0,,,174000.0,,,321000.0,,,532000.0,,815000.0,,,,1180000.0,,1580000.0,,,1890000.0,,,2100000.0,,2250000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,,,,,,,,,,,,,,,,,,, +E-70/2300,,,0.0,,2000.0,,18000.0,,56000.0,,,127000.0,,,240000.0,,,400000.0,,626000.0,,,,892000.0,,1223000.0,,,1590000.0,,,1900000.0,,2080000.0,,2230000.0,,2300000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,,,,,,,,,,,,,,,,,,, +E-82/2000,,,0.0,,3000.0,,25000.0,,82000.0,,,174000.0,,,321000.0,,,532000.0,,815000.0,,,,1180000.0,,1580000.0,,,1810000.0,,,1980000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,,,,,,,,,,,,,,,,,,, +E-70/2000,0.0,0.0,0.0,0.0,0.0,10000.0,18000.0,37000.0,56000.0,,92000.0,127000.0,,184000.0,240000.0,,320000.0,400000.0,513000.0,626000.0,,759000.0,,892000.0,1058000.0,1223000.0,,1407000.0,1590000.0,,1710000.0,1830000.0,1890000.0,1950000.0,2010000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,,,,,,,,,,,,,,,,,,,, +E-53/800,,,0.0,,2000.0,,14000.0,,38000.0,,,77000.0,,,141000.0,,,228000.0,,336000.0,,,,480000.0,,645000.0,,,744000.0,,,780000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,,,,,,,,,,,,,,,,,,, +AD116/5000,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,50000.0,,165000.0,280000.0,,410000.0,540000.0,,705000.0,870000.0,1102500.0,1335000.0,,1630000.0,,1925000.0,2270000.0,2615000.0,,3115000.0,3615000.0,,4205000.0,4795000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,,,,,,,,,, +GE130/3200,,,,,,,56000.0,128000.0,215000.0,,321000.0,449000.0,,606000.0,791000.0,,1010000.0,1263000.0,1547000.0,1857000.0,,2175000.0,,2473000.0,2737000.0,2933000.0,,3067000.0,3164000.0,,3202000.0,3221000.0,3229000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,,,,,,,,,,,,,,,,,,,, +GE120/2750,0.0,0.0,0.0,0.0,0.0,0.0,25000.0,89000.0,171000.0,,269000.0,389000.0,,533000.0,704000.0,,906000.0,1136000.0,1400000.0,1674000.0,,1945000.0,,2173000.0,2373000.0,2518000.0,,2619000.0,2696000.0,,2739000.0,2766000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,,,,,,,,,,,,,,,,,,,, +GE103/2750,0.0,0.0,0.0,0.0,0.0,0.0,17000.0,55000.0,104000.0,,169000.0,251000.0,,352000.0,470000.0,,610000.0,772000.0,959000.0,1170000.0,,1405000.0,,1656000.0,1899000.0,2120000.0,,2291000.0,2441000.0,,2567000.0,2661000.0,2730000.0,2768000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,,,,,,,,,,,,,,,,,,,, +GE120/2500,0.0,0.0,0.0,0.0,0.0,0.0,25000.0,89000.0,171000.0,,269000.0,389000.0,,533000.0,704000.0,,906000.0,1136000.0,1400000.0,1674000.0,,1934000.0,,2160000.0,2316000.0,2416000.0,,2477000.0,2514000.0,,2528000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, \ No newline at end of file diff --git a/tests/oedb/power_curves_backup.csv b/tests/oedb/power_curves_backup.csv new file mode 100644 index 00000000..108f71cb --- /dev/null +++ b/tests/oedb/power_curves_backup.csv @@ -0,0 +1,68 @@ +turbine_type,0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.2,4.5,5.0,5.2,5.5,6.0,6.2,6.5,7.0,7.5,8.0,8.1,8.5,8.8,9.0,9.5,10.0,10.2,10.5,11.0,11.1,11.5,12.0,12.5,13.0,13.5,14.0,14.5,15.0,15.5,16.0,16.5,17.0,17.5,18.0,18.5,19.0,19.5,20.0,20.5,21.0,21.5,22.0,22.5,23.0,23.5,24.0,24.5,25.0,25.5,26.0,26.5,27.0,27.5,28.0,28.5,29.0,29.5,30.0,30.5,31.0,31.5,32.0,32.5,33.0,33.5,34.0,34.5,35.0 +E48/800,,,0.0,,0.0,,5000.0,,25000.0,,,60000.0,,,110000.0,,,180000.0,,275000.0,,,,400000.0,,555000.0,,,671000.0,,,750000.0,,790000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,,,,,,,,,,,,,,,,,,, +E-115/3200,,,0.0,,3000.0,,49000.0,,155000.0,,,339000.0,,,628000.0,,,1036000.0,,1522000.0,,,,2215000.0,,2677000.0,,,3030000.0,,,3177000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,,,,,,,,,,,,,,,,,,, +E-101/3500,,,0.0,,3000.0,,37000.0,,116000.0,,,253000.0,,,469000.0,,,775000.0,,1175000.0,,,,1680000.0,,2280000.0,,,2810000.0,,,3200000.0,,3400000.0,,3465000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,,,,,,,,,,,,,,,,,,, +E-126/4200,,,0.0,,0.0,,58000.0,,185000.0,,,400000.0,,,745000.0,,,1200000.0,,1790000.0,,,,2450000.0,,3120000.0,,,3660000.0,,,4000000.0,,4150000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,,,,,,,,,,,,,,,,,,, +E-101/3050,0.0,0.0,0.0,0.0,3000.0,22000.0,49000.0,92000.0,155000.0,,240000.0,339000.0,,480000.0,628000.0,,830000.0,1035000.0,1292000.0,1549000.0,,1820000.0,,2090000.0,2350000.0,2580000.0,,2775000.0,2900000.0,,2980000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0 +E-115/3000,,,0.0,,3000.0,,48500.0,,155000.0,,,339000.0,,,627500.0,,,1035500.0,,1549000.0,,,,2090000.0,,2580000.0,,,2900000.0,,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,,,,,,,,,,,,,,,,,,, +E-82/3000,,,0.0,,0.0,,25000.0,,82000.0,,,174000.0,,,321000.0,,,525000.0,,800000.0,,,,1135000.0,,1510000.0,,,1880000.0,,,2200000.0,,2500000.0,,2770000.0,,2910000.0,,3000000.0,,3020000.0,,3020000.0,,3020000.0,,3020000.0,,3020000.0,,3020000.0,,3020000.0,,3020000.0,,3020000.0,,,,,,,,,,,,,,,,,,,, +E-92/2350,,,0.0,,3600.0,,29900.0,,98200.0,,,208300.0,,,384300.0,,,637000.0,,975800.0,,,,1403600.0,,1817800.0,,,2088699.9999999998,,,2237000.0,,2300000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,,,,,,,,,,,,,,,,,,, +E-82/2350,,,0.0,,3000.0,,25000.0,,82000.0,,,174000.0,,,321000.0,,,532000.0,,815000.0,,,,1180000.0,,1580000.0,,,1890000.0,,,2100000.0,,2250000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,,,,,,,,,,,,,,,,,,, +E-82/2300,,,0.0,,3000.0,,25000.0,,82000.0,,,174000.0,,,321000.0,,,532000.0,,815000.0,,,,1180000.0,,1580000.0,,,1890000.0,,,2100000.0,,2250000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,,,,,,,,,,,,,,,,,,, +E-70/2300,,,0.0,,2000.0,,18000.0,,56000.0,,,127000.0,,,240000.0,,,400000.0,,626000.0,,,,892000.0,,1223000.0,,,1590000.0,,,1900000.0,,2080000.0,,2230000.0,,2300000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,,,,,,,,,,,,,,,,,,, +E-82/2000,,,0.0,,3000.0,,25000.0,,82000.0,,,174000.0,,,321000.0,,,532000.0,,815000.0,,,,1180000.0,,1580000.0,,,1810000.0,,,1980000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,,,,,,,,,,,,,,,,,,, +E-70/2000,0.0,0.0,0.0,0.0,0.0,10000.0,18000.0,37000.0,56000.0,,92000.0,127000.0,,184000.0,240000.0,,320000.0,400000.0,513000.0,626000.0,,759000.0,,892000.0,1058000.0,1223000.0,,1407000.0,1590000.0,,1710000.0,1830000.0,1890000.0,1950000.0,2010000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,,,,,,,,,,,,,,,,,,,, +E-53/800,,,0.0,,2000.0,,14000.0,,38000.0,,,77000.0,,,141000.0,,,228000.0,,336000.0,,,,480000.0,,645000.0,,,744000.0,,,780000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,,,,,,,,,,,,,,,,,,, +AD116/5000,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,50000.0,,165000.0,280000.0,,410000.0,540000.0,,705000.0,870000.0,1102500.0,1335000.0,,1630000.0,,1925000.0,2270000.0,2615000.0,,3115000.0,3615000.0,,4205000.0,4795000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,,,,,,,,,, +GE130/3200,,,,,,,56000.0,128000.0,215000.0,,321000.0,449000.0,,606000.0,791000.0,,1010000.0,1263000.0,1547000.0,1857000.0,,2175000.0,,2473000.0,2737000.0,2933000.0,,3067000.0,3164000.0,,3202000.0,3221000.0,3229000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,,,,,,,,,,,,,,,,,,,, +GE120/2750,0.0,0.0,0.0,0.0,0.0,0.0,25000.0,89000.0,171000.0,,269000.0,389000.0,,533000.0,704000.0,,906000.0,1136000.0,1400000.0,1674000.0,,1945000.0,,2173000.0,2373000.0,2518000.0,,2619000.0,2696000.0,,2739000.0,2766000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,,,,,,,,,,,,,,,,,,,, +GE103/2750,0.0,0.0,0.0,0.0,0.0,0.0,17000.0,55000.0,104000.0,,169000.0,251000.0,,352000.0,470000.0,,610000.0,772000.0,959000.0,1170000.0,,1405000.0,,1656000.0,1899000.0,2120000.0,,2291000.0,2441000.0,,2567000.0,2661000.0,2730000.0,2768000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,,,,,,,,,,,,,,,,,,,, +GE120/2500,0.0,0.0,0.0,0.0,0.0,0.0,25000.0,89000.0,171000.0,,269000.0,389000.0,,533000.0,704000.0,,906000.0,1136000.0,1400000.0,1674000.0,,1934000.0,,2160000.0,2316000.0,2416000.0,,2477000.0,2514000.0,,2528000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +GE100/2500,0.0,0.0,0.0,0.0,0.0,0.0,0.0,30000.0,63000.0,,129000.0,194000.0,,295000.0,395000.0,,527000.0,658000.0,809000.0,959000.0,,1152000.0,,1345000.0,1604000.0,1862000.0,,2060000.0,2248000.0,,2340000.0,2426000.0,2475000.0,2495000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0 +ENO126/3500,,,,,,,32000.0,,205000.0,,,424000.0,,,729000.0,,,1168000.0,,1760000.0,,,,2334000.0,,2981000.0,,,3362000.0,,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,,,,,,,,,,,,,,,,,,, +ENO114/3500,,,,,,,23600.0,,,180800.0,,,380300.0,,,648500.0,,917500.0,,,1440500.0,,1818500.0,,,,2722100.0,,,3287200.0,,3457700.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,,,,,,,,,,,,,,,,,,, +ENO100/2200,,,,,,,38000.0,,127000.0,,,262000.0,,,465000.0,,,741000.0,,1100000.0,,,,1515000.0,,1883000.0,,,2100000.0,,,2200000.0,,2200000.0,,2200000.0,,2200000.0,,2200000.0,,2200000.0,,2200000.0,,2200000.0,,2200000.0,,2200000.0,,2200000.0,,2200000.0,,2200000.0,,2200000.0,,,,,,,,,,,,,,,,,,,, +E-126/7580,0.0,0.0,0.0,0.0,0.0,25000.0,55000.0,110000.0,175000.0,,293000.0,410000.0,,585000.0,760000.0,,1005000.0,1250000.0,1575000.0,1900000.0,,2300000.0,,2700000.0,3240000.0,3750000.0,,4310000.0,4850000.0,,5310000.0,5750000.0,6135000.0,6500000.0,6770000.0,7000000.0,7195000.0,7350000.0,7440000.0,7500000.0,7550000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0 +E-141/4200,,,0.0,,22000.0,,104000.0,,260000.0,,,523000.0,,,920000.0,,,1471000.0,,2151000.0,,,,2867000.0,,3481000.0,,,3903000.0,,,4119000.0,,4196000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,,,,,,,,,,,,,,,,,,, +MM92/2050,0.0,,0.0,,0.0,,22000.0,,93100.0,,,207200.0,,,388200.0,,,642700.0,,991200.0,,,,1355700.0,,1780000.0,,,2012600.0,,,2048000.0,,2055000.0,,2055000.0,,2055000.0,,2055000.0,,2055000.0,,2055000.0,,2055000.0,,2055000.0,,2055000.0,,2055000.0,,2055000.0,,2055000.0,,2055000.0,,,,,,,,,,,,,,,,,,,, +SCD168/8000,,,0.0,,0.0,,0.0,,100000.0,,,500000.0,,,1000000.0,,,2000000.0,,3000000.0,,,,4000000.0,,5000000.0,,,6000000.0,,,7500000.0,,8000000.0,,8000000.0,,8000000.0,,8000000.0,,8000000.0,,8000000.0,,8000000.0,,8000000.0,,8000000.0,,8000000.0,,8000000.0,,8000000.0,,,,,,,,,,,,,,,,,,,,,, +E-126/7500,0.0,0.0,0.0,0.0,0.0,25000.0,55000.0,110000.0,175000.0,,290000.0,410000.0,,580000.0,760000.0,,1005000.0,1250000.0,1575000.0,1900000.0,,2300000.0,,2700000.0,3225000.0,3750000.0,,4300000.0,4850000.0,,5300000.0,5750000.0,6125000.0,6500000.0,6780000.0,7000000.0,7200000.0,7350000.0,7450000.0,7500000.0,7560000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,7580000.0,,,,,,,,,,,,,,,,,,,, +N131/3600,0.0,0.0,0.0,0.0,0.0,0.0,15000.0,90000.0,184000.0,,301000.0,443000.0,,610000.0,805000.0,,1034000.0,1298000.0,1602000.0,1946000.0,,2323000.0,,2727000.0,3076000.0,3327000.0,,3491000.0,3580000.0,,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +N131/3300,,,,,,,33000.0,106000.0,197000.0,,311000.0,447000.0,,610000.0,804000.0,,1032000.0,1298000.0,1601000.0,1936000.0,,2292000.0,,2635000.0,2901000.0,3091000.0,,3215000.0,3281000.0,,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +N131/3000,,,,,,,33000.0,104000.0,194000.0,,306000.0,442000.0,,607000.0,802000.0,,1032000.0,1298000.0,1595000.0,1915000.0,,2250000.0,,2533000.0,2740000.0,2881000.0,,2965000.0,2997000.0,,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +N117/2400,0.0,0.0,0.0,0.0,0.0,0.0,23000.0,81000.0,154000.0,,245000.0,356000.0,,488000.0,644000.0,,826000.0,1037000.0,1273000.0,1528000.0,,1797000.0,,2039000.0,2212000.0,2325000.0,,2385000.0,2400000.0,,2400000.0,2400000.0,2400000.0,2400000.0,2400000.0,2400000.0,2400000.0,2400000.0,2400000.0,2400000.0,2400000.0,2400000.0,2400000.0,2400000.0,2400000.0,2400000.0,2400000.0,2400000.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +N100/2500,,,,,,,3000.0,46000.0,101000.0,,171000.0,256000.0,,356000.0,472000.0,,608000.0,765000.0,945000.0,1148000.0,,1372000.0,,1615000.0,1877000.0,2108000.0,,2282000.0,2401000.0,,2473000.0,2498000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,,,,,,,,,,,,,,,,,,,, +N90/2500,,,,,,,1000.0,37000.0,84000.0,,142000.0,212000.0,,294000.0,391000.0,,504000.0,635000.0,785000.0,951000.0,,1131000.0,,1321000.0,1520000.0,1722000.0,,1924000.0,2122000.0,,2280000.0,2389000.0,2459000.0,2495000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,2500000.0,,2500000.0,,,,,,,,,,,,,,,,,, +S114/3200,0.0,,0.0,,0.0,,23000.0,,139000.0,,,330000.0,,,604000.0,,,990000.0,,1502000.0,,,,2102000.0,,2697000.0,,,3098000.0,,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,,,,,,,,,,,,,,,,,,,,,,,,, +S152/6330,0.0,,0.0,,0.0,,82000.0,,411000.0,,,873000.0,,,1550000.0,,,2524000.0,,3695000.0,,,,5082000.0,,5974000.0,,,6150000.0,,,6150000.0,,6150000.0,,6150000.0,,6150000.0,,6150000.0,,6150000.0,,6150000.0,,6150000.0,,6150000.0,,6150000.0,,6150000.0,,6150000.0,,6150000.0,,6150000.0,,6150000.0,,6150000.0,,6150000.0,,6150000.0,,6150000.0,,6150000.0,,6150000.0,,,,,, +S126/6150,0.0,0.0,0.0,0.0,0.0,0.0,0.0,12000.0,75000.0,,166900.0,288300.0,,448300.0,638100.0,,874200.0,1121400.0,1396100.0,1731300.0,,2099500.0,,2481200.0,2968500.0,3431000.0,,3929000.0,4423800.0,,4956400.0,5469000.0,5850400.0,6106200.0,6167500.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,6168820.0,,,,,,,,,, +S114/3400,0.0,,0.0,,0.0,,23000.0,,140000.0,,,327000.0,,,601000.0,,,988000.0,,1502000.0,,,,2105000.0,,2721000.0,,,3208000.0,,,3400000.0,,3400000.0,,3400000.0,,3400000.0,,3400000.0,,3400000.0,,3400000.0,,3400000.0,,3400000.0,,3400000.0,,3400000.0,,,,,,,,,,,,,,,,,,,,,,,,,, +S104/3400,0.0,0.0,0.0,0.0,0.0,0.0,0.0,19000.0,94500.0,,161400.0,251400.0,,353100.0,477800.0,,618400.0,788800.0,975000.0,1212900.0,,1467300.0,,1730900.0,2010500.0,2290800.0,,2578000.0,2850300.0,,3106400.0,3287300.0,3376800.0,3373300.0,3397700.0,3400000.0,3400000.0,3400000.0,3400000.0,3400000.0,3400000.0,3400000.0,3400000.0,3400000.0,3400000.0,3400000.0,3400000.0,3400000.0,3400000.0,3400000.0,3400000.0,3400000.0,3400000.0,3400000.0,3400000.0,3400000.0,3400000.0,3400000.0,,,,,,,,,,,,,,,,,,,, +S122/3000,,,,,,,36000.0,,164000.0,,,371000.0,,,683000.0,,,1130000.0,,1662000.0,,,,2247000.0,,2769000.0,,,2970000.0,,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,,,,,,,,,,,,,,,,,,,,,,,,, +MM100/2000,0.0,,0.0,,0.0,,20000.0,,102000.0,,,239000.0,,,452000.0,,,746000.0,,1126000.0,,,,1559000.0,,1901000.0,,,2000000.0,,,2000000.0,,2000000.0,,2000000.0,,2000000.0,,2000000.0,,2000000.0,,2000000.0,,2000000.0,,2000000.0,,2000000.0,,2000000.0,,,,,,,,,,,,,,,,,,,,,,,,,, +S122/3200,,,,,,,55000.0,,184000.0,,,391000.0,,,695000.0,,,1121000.0,,1627000.0,,,,2219000.0,,2810000.0,,,3106000.0,,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,,,,,,,,,,,,,,,,,,,,,,,,, +SWT130/3300,,,,,,,42000.0,,180000.0,,,412000.0,,,760000.0,,,1241000.0,,1864000.0,,,,2588000.0,,3122000.0,,,3278000.0,,,3298000.0,,3300000.0,,3300000.0,,3300000.0,,3300000.0,,3300000.0,,3300000.0,,3300000.0,,3300000.0,,3300000.0,,3300000.0,,3300000.0,,3300000.0,,3300000.0,,,,,,,,,,,,,,,,,,,, +SWT113/3200,,,,,,,64000.0,,169000.0,,,350000.0,,,623000.0,,,1004000.0,,1506000.0,,,,2115000.0,,2712000.0,,,3083000.0,,,3187000.0,,3199000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,,,,,,,,,,,,,,,,,,, +SWT142/3150,,,,,,,55000.0,,239000.0,,,549000.0,,,968000.0,,,1522000.0,,2202000.0,,,,2816000.0,,3090000.0,,,3145000.0,,,3150000.0,,3150000.0,,3150000.0,,3150000.0,,3150000.0,,3150000.0,,3150000.0,,3150000.0,,3150000.0,,3150000.0,,3150000.0,,3150000.0,,,,,,,,,,,,,,,,,,,,,,,, +SWT130/3600,,,,,,,43000.0,,184000.0,,,421000.0,,,778000.0,,,1269000.0,,1901000.0,,,,2630000.0,,3261000.0,,,3534000.0,,,3593000.0,,3600000.0,,3600000.0,,3600000.0,,3600000.0,,3600000.0,,3600000.0,,3600000.0,,3600000.0,,3600000.0,,3600000.0,,3600000.0,,3600000.0,,3600000.0,,,,,,,,,,,,,,,,,,,, +SWT120/3600,,,,,,,0.0,,174000.0,,,379000.0,,,686000.0,,,1108000.0,,1667000.0,,,,2378000.0,,3094000.0,,,3487000.0,,,3588000.0,,3599000.0,,3600000.0,,3600000.0,,3600000.0,,3600000.0,,3600000.0,,3600000.0,,3600000.0,,3600000.0,,3600000.0,,3600000.0,,3600000.0,,3600000.0,,,,,,,,,,,,,,,,,,,, +V80/2000,0.0,0.0,0.0,0.0,0.0,0.0,0.0,35000.0,70000.0,,117000.0,165000.0,,225000.0,285000.0,,372000.0,459000.0,580000.0,701000.0,,832000.0,,964000.0,1127000.0,1289000.0,,1428000.0,1567000.0,,1678000.0,1788000.0,1865000.0,1941000.0,1966000.0,1990000.0,2000000.0,2000000.0,2000000.0,2000000.0,2000000.0,2000000.0,2000000.0,2000000.0,2000000.0,2000000.0,2000000.0,2000000.0,2000000.0,2000000.0,2000000.0,2000000.0,2000000.0,2000000.0,2000000.0,2000000.0,2000000.0,2000000.0,,,,,,,,,,,,,,,,,,,, +SWT113/2300,,,,,,,66000.0,,171000.0,,,352000.0,,,623000.0,,,1002000.0,,1497000.0,,,,2005000.0,,2246000.0,,,2296000.0,,,2300000.0,,2300000.0,,2300000.0,,2300000.0,,2300000.0,,2300000.0,,2300000.0,,2300000.0,,2300000.0,,2300000.0,,2300000.0,,2300000.0,,2300000.0,,2300000.0,,,,,,,,,,,,,,,,,,,, +V164/8000,0.0,,0.0,,0.0,,91800.0,,526700.0,,,1123100.0,,,2043900.0,,,3134600.0,,4486400.0,,,,6393200.0,,7363800.0,,,7834400.0,,,8026400.0,,8077200.0,,8077200.0,,8077200.0,,8077200.0,,8077200.0,,8077200.0,,8077200.0,,8077200.0,,8077200.0,,8077200.0,,8077200.0,,8077200.0,,8077200.0,,,,,,,,,,,,,,,,,,,, +V126/3450,0.0,0.0,0.0,0.0,0.0,0.0,35000.0,101000.0,184000.0,,283000.0,404000.0,,550000.0,725000.0,,932000.0,1172000.0,1446000.0,1760000.0,,2104000.0,,2482000.0,2865000.0,3187000.0,,3366000.0,3433000.0,,3448000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,,,,,,,,,,,,,,,,,,,,,,,,, +V126/3300,0.0,0.0,0.0,0.0,0.0,0.0,30000.0,97000.0,179000.0,,278000.0,397000.0,,539000.0,711000.0,,913000.0,1150000.0,1420000.0,1723000.0,,2060000.0,,2434000.0,2804000.0,3090000.0,,3238000.0,3290000.0,,3299000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,,,,,,,,,,,,,,,,,,,,,,,,, +VS112/2500,0.0,,0.0,,0.0,,0.0,,154200.0,,,315900.0,,,548500.0,,,871100.0,,1290100.0,,,,1808800.0,,2269500.0,,,2465100.0,,,2500000.0,,2500000.0,,2500000.0,,2500000.0,,2500000.0,,2500000.0,,2500000.0,,2500000.0,,2500000.0,,2500000.0,,2500000.0,,2500000.0,,2500000.0,,2500000.0,,0.0,,0.0,,0.0,,0.0,,0.0,,,,,,,,,, +V126/3000,,,,,,,20000.0,88000.0,173000.0,,276000.0,397000.0,,540000.0,712000.0,,914000.0,1151000.0,1420000.0,1723000.0,,2063000.0,,2433000.0,2738000.0,2920000.0,,2985000.0,2999000.0,,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,,,,,,,,,,,,,,,,,,,,,,,,, +V117/3450,,,,,,,22000.0,78000.0,150000.0,,237000.0,340000.0,,466000.0,617000.0,,796000.0,1006000.0,1247000.0,1522000.0,,1831000.0,,2178000.0,2544000.0,2905000.0,,3201000.0,3374000.0,,3435000.0,3448000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,,,,,,,,,,,,,,,,,,,, +V117/3300,,,,,,,24000.0,80000.0,147000.0,,228000.0,327000.0,,449000.0,597000.0,,772000.0,978000.0,1214000.0,1482000.0,,1783000.0,,2114000.0,2463000.0,2803000.0,,3063000.0,3216000.0,,3281000.0,3297000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,,,,,,,,,,,,,,,,,,,, +V112/3450,0.0,0.0,0.0,0.0,0.0,0.0,7000.0,53000.0,123000.0,,208000.0,309000.0,,427000.0,567000.0,,732000.0,927000.0,1149000.0,1401000.0,,1688000.0,,2006000.0,2348000.0,2693000.0,,3011000.0,3252000.0,,3388000.0,3436000.0,3448000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,3450000.0,,,,,,,,,,,,,,,,,,,, +V112/3300,0.0,0.0,0.0,0.0,0.0,0.0,22000.0,73000.0,134000.0,,209000.0,302000.0,,415000.0,552000.0,,714000.0,906000.0,1123000.0,1370000.0,,1648000.0,,1950000.0,2268000.0,2586000.0,,2868000.0,3071000.0,,3201000.0,3266000.0,3291000.0,3298000.0,3299000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,3300000.0,,,,,,,,,,,,,,,,,,,, +V112/3075,0.0,0.0,0.0,0.0,0.0,0.0,26000.0,73000.0,133000.0,,207000.0,302000.0,,416000.0,554000.0,,717000.0,907000.0,1126000.0,1375000.0,,1652000.0,,1958000.0,2282000.0,2585000.0,,2821000.0,2997000.0,,3050000.0,3067000.0,3074000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,,,,,,,,,,,,,,,,,,,, +V112/3000,,,,,,,23000.0,68000.0,130000.0,,206000.0,301000.0,,418000.0,557000.0,,720000.0,912000.0,1130000.0,1377000.0,,1654000.0,,1954000.0,2272000.0,2572000.0,,2808000.0,2988000.0,,3046000.0,3065000.0,3073000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,3075000.0,,,,,,,,,,,,,,,,,,,, +V90/3000,,,0.0,,0.0,,0.0,,77000.0,,,190000.0,,,353000.0,,,581000.0,,886000.0,,,,1273000.0,,1710000.0,,,2145000.0,,,2544000.0,,2837000.0,,2965000.0,,2995000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,,,,,,,,,,,,,,,,,,, +V90/2000,0.0,0.0,0.0,0.0,0.0,0.0,0.0,42200.0,93300.0,,145200.0,211300.0,,284200.0,390900.0,,491500.0,601100.0,731800.0,884500.0,,1087600.0,,1247100.0,1429600.0,1594300.0,,1742900.0,1861200.0,,1948100.0,1993300.0,2003500.0,2007000.0,2007700.0,2007300.0,2007400.0,2007000.0,2006800.0,2006700.0,2006500.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +V164/9500,0.0,0.0,0.0,0.0,0.0,0.0,0.0,115000.0,249000.0,,430000.0,613000.0,,900000.0,1226000.0,,1600000.0,2030000.0,2570000.0,3123000.0,,3784000.0,,4444000.0,5170000.0,5900000.0,,6600000.0,7299000.0,,7960000.0,8601000.0,9080000.0,9272000.0,9410000.0,9500000.0,,9500000.0,9500000.0,9500000.0,9500000.0,9500000.0,9500000.0,9500000.0,9500000.0,9500000.0,9500000.0,9500000.0,9500000.0,9500000.0,9500000.0,9500000.0,9500000.0,9500000.0,9500000.0,9500000.0,9500000.0,,,,,,,,,,,,,,,,,,,,, +V90/2000/GS,,,,,,,,,75000.0,,128000.0,190000.0,,265000.0,354000.0,,459000.0,582000.0,723000.0,883000.0,,1058000.0,,1240000.0,1427000.0,1604000.0,,1762000.0,1893000.0,,1968000.0,2005000.0,2021000.0,2027000.0,2029000.0,2030000.0,2030000.0,2030000.0,2030000.0,2030000.0,2030000.0,2030000.0,2030000.0,2030000.0,2030000.0,2030000.0,2030000.0,2030000.0,2030000.0,2030000.0,2030000.0,2030000.0,2030000.0,2030000.0,2030000.0,2030000.0,2030000.0,2030000.0,,,,,,,,,,,,,,,,,,,, +V100/1800,,,,,,,13000.0,52000.0,108000.0,,177000.0,256000.0,,350000.0,458000.0,,589000.0,744000.0,916000.0,1106000.0,,1312000.0,,1510000.0,1663000.0,1749000.0,,1784000.0,1796000.0,,1799000.0,1800000.0,,1800000.0,,1800000.0,,1800000.0,,1800000.0,,1800000.0,,1800000.0,,1800000.0,,1800000.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +V100/1800/GS,,,,,,,12000.0,40000.0,93000.0,,161000.0,241000.0,,336000.0,446000.0,,575000.0,727000.0,900000.0,1094000.0,,1304000.0,,1510000.0,1673000.0,1771000.0,,1814000.0,1829000.0,,1834000.0,1835000.0,1835000.0,1835000.0,1835000.0,1835000.0,1835000.0,1835000.0,1835000.0,1835000.0,1835000.0,1835000.0,1835000.0,1835000.0,1835000.0,1835000.0,1835000.0,1835000.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +V117/3600,,,,,,,22000.0,78000.0,150000.0,,237000.0,340000.0,,466000.0,617000.0,,796000.0,1006000.0,1247000.0,1522000.0,,1830000.0,,2176000.0,2541000.0,2903000.0,,3209000.0,3418000.0,,3543000.0,3589000.0,3599000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,3600000.0,,,,,,,,,,,,,,,,,,,, diff --git a/tests/oedb/power_curves_broken.csv b/tests/oedb/power_curves_broken.csv new file mode 100644 index 00000000..3e03b30b --- /dev/null +++ b/tests/oedb/power_curves_broken.csv @@ -0,0 +1,20 @@ +turbine_type,0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.2,4.5,5.0,5.2,5.5,6.0,6.2,6.5,7.0,7.5,8.0,8.1,8.5,8.8,9.0,9.5,10.0,10.2,10.5,11.0,11.1,11.5,12.0,12.5,13.0,13.5,14.0,14.5,15.0,15.0,15.0,15.0,15.0,17.5,18.0,18.5,19.0,19.5,20.0,20.5,21.0,21.5,22.0,22.5,23.0,23.5,24.0,24.5,25.0,25.5,26.0,26.5,27.0,27.5,28.0,28.5,29.0,29.5,30.0,30.5,31.0,31.5,32.0,32.5,33.0,33.5,34.0,34.5,35.0 +E48/800,,,0.0,,0.0,,5000.0,,25000.0,,,60000.0,,,110000.0,,,180000.0,,275000.0,,,,400000.0,,555000.0,,,671000.0,,,750000.0,,790000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,,,,,,,,,,,,,,,,,,, +E-115/3200,,,0.0,,3000.0,,49000.0,,155000.0,,,339000.0,,,628000.0,,,1036000.0,,1522000.0,,,,2215000.0,,2677000.0,,,3030000.0,,,3177000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,3200000.0,,,,,,,,,,,,,,,,,,,, +E-101/3500,,,0.0,,3000.0,,37000.0,,116000.0,,,253000.0,,,469000.0,,,775000.0,,1175000.0,,,,1680000.0,,2280000.0,,,2810000.0,,,3200000.0,,3400000.0,,3465000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,3500000.0,,,,,,,,,,,,,,,,,,,, +E-126/4200,,,0.0,,0.0,,58000.0,,185000.0,,,400000.0,,,745000.0,,,1200000.0,,1790000.0,,,,2450000.0,,3120000.0,,,3660000.0,,,4000000.0,,4150000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,4200000.0,,,,,,,,,,,,,,,,,,,, +E-101/3050,0.0,0.0,0.0,0.0,3000.0,22000.0,49000.0,92000.0,155000.0,,240000.0,339000.0,,480000.0,628000.0,,830000.0,1035000.0,1292000.0,1549000.0,,1820000.0,,2090000.0,2350000.0,2580000.0,,2775000.0,2900000.0,,2980000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,3000000.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0 +E-115/3000,,,0.0,,3000.0,,48500.0,,155000.0,,,339000.0,,,627500.0,,,1035500.0,,1549000.0,,,,2090000.0,,2580000.0,,,2900000.0,,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,3000000.0,,,,,,,,,,,,,,,,,,,, +E-82/3000,,,0.0,,0.0,,25000.0,,82000.0,,,174000.0,,,321000.0,,,525000.0,,800000.0,,,,1135000.0,,1510000.0,,,1880000.0,,,2200000.0,,2500000.0,,2770000.0,,2910000.0,,3000000.0,,3020000.0,,3020000.0,,3020000.0,,3020000.0,,3020000.0,,3020000.0,,3020000.0,,3020000.0,,3020000.0,,,,,,,,,,,,,,,,,,,, +E-92/2350,,,0.0,,3600.0,,29900.0,,98200.0,,,208300.0,,,384300.0,,,637000.0,,975800.0,,,,1403600.0,,1817800.0,,,2088699.9999999998,,,2237000.0,,2300000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,,,,,,,,,,,,,,,,,,, +E-82/2350,,,0.0,,3000.0,,25000.0,,82000.0,,,174000.0,,,321000.0,,,532000.0,,815000.0,,,,1180000.0,,1580000.0,,,1890000.0,,,2100000.0,,2250000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,,,,,,,,,,,,,,,,,,, +E-82/2300,,,0.0,,3000.0,,25000.0,,82000.0,,,174000.0,,,321000.0,,,532000.0,,815000.0,,,,1180000.0,,1580000.0,,,1890000.0,,,2100000.0,,2250000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,2350000.0,,,,,,,,,,,,,,,,,,,, +E-70/2300,,,0.0,,2000.0,,18000.0,,56000.0,,,127000.0,,,240000.0,,,400000.0,,626000.0,,,,892000.0,,1223000.0,,,1590000.0,,,1900000.0,,2080000.0,,2230000.0,,2300000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,2310000.0,,,,,,,,,,,,,,,,,,,, +E-82/2000,,,0.0,,3000.0,,25000.0,,82000.0,,,174000.0,,,321000.0,,,532000.0,,815000.0,,,,1180000.0,,1580000.0,,,1810000.0,,,1980000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,2050000.0,,,,,,,,,,,,,,,,,,,, +E-70/2000,0.0,0.0,0.0,0.0,0.0,10000.0,18000.0,37000.0,56000.0,,92000.0,127000.0,,184000.0,240000.0,,320000.0,400000.0,513000.0,626000.0,,759000.0,,892000.0,1058000.0,1223000.0,,1407000.0,1590000.0,,1710000.0,1830000.0,1890000.0,1950000.0,2010000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,2050000.0,,,,,,,,,,,,,,,,,,,, +E-53/800,,,0.0,,2000.0,,14000.0,,38000.0,,,77000.0,,,141000.0,,,228000.0,,336000.0,,,,480000.0,,645000.0,,,744000.0,,,780000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,810000.0,,,,,,,,,,,,,,,,,,,, +AD116/5000,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,50000.0,,165000.0,280000.0,,410000.0,540000.0,,705000.0,870000.0,1102500.0,1335000.0,,1630000.0,,1925000.0,2270000.0,2615000.0,,3115000.0,3615000.0,,4205000.0,4795000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,,,,,,,,,, +GE130/3200,,,,,,,56000.0,128000.0,215000.0,,321000.0,449000.0,,606000.0,791000.0,,1010000.0,1263000.0,1547000.0,1857000.0,,2175000.0,,2473000.0,2737000.0,2933000.0,,3067000.0,3164000.0,,3202000.0,3221000.0,3229000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,3230000.0,,,,,,,,,,,,,,,,,,,, +GE120/2750,0.0,0.0,0.0,0.0,0.0,0.0,25000.0,89000.0,171000.0,,269000.0,389000.0,,533000.0,704000.0,,906000.0,1136000.0,1400000.0,1674000.0,,1945000.0,,2173000.0,2373000.0,2518000.0,,2619000.0,2696000.0,,2739000.0,2766000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,,,,,,,,,,,,,,,,,,,, +GE103/2750,0.0,0.0,0.0,0.0,0.0,0.0,17000.0,55000.0,104000.0,,169000.0,251000.0,,352000.0,470000.0,,610000.0,772000.0,959000.0,1170000.0,,1405000.0,,1656000.0,1899000.0,2120000.0,,2291000.0,2441000.0,,2567000.0,2661000.0,2730000.0,2768000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,2780000.0,,,,,,,,,,,,,,,,,,,, +GE120/2500,0.0,0.0,0.0,0.0,0.0,0.0,25000.0,89000.0,171000.0,,269000.0,389000.0,,533000.0,704000.0,,906000.0,1136000.0,1400000.0,1674000.0,,1934000.0,,2160000.0,2316000.0,2416000.0,,2477000.0,2514000.0,,2528000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,2530000.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, diff --git a/tests/oedb/turbine_data.csv b/tests/oedb/turbine_data.csv new file mode 100644 index 00000000..1ca2ce89 --- /dev/null +++ b/tests/oedb/turbine_data.csv @@ -0,0 +1,20 @@ +turbine_type,calculated,has_cp_curve,has_ct_curve,has_power_curve,hub_height,id,manufacturer,max_speed_drive,name,nominal_power,power_density,power_density_2,rotor_area,rotor_diameter,source,turbine_id,turbine_type_v2,wind_class_iec,wind_zone_dibt +AD135/5050,,False,False,False,,80,Adwen/Areva,14,AD 5-135,5050000,353,3,14312,135,https://www.wind-turbine-models.com/turbines/1122-adwen-ad-5-135,86,AD-135_5050,IEC I (GL-TK 1 & GL-TK S), +GE158/4800,,False,False,False,101;120.9;149;169,111,GE Wind,,GE 4.8-158,4800000,,,19604,158,https://www.gerenewableenergy.com/wind-energy/turbines/4mw-platform; https://www.wind-turbine-models.com/turbines/1719-general-electric-ge-4.8-158,120,GE-158_4800,, +GE137/3400,True,False,False,False,85;110;131;134;155,113,GE Wind,,GE 3.4-137,3400000,,,14739,137,https://www.wind-turbine-models.com/turbines/1339-general-electric-ge-3.4-137,122,GE-137_3400,, +GE137/3600,,False,False,False,85;110;131.4;164.5,112,GE Wind,,GE 3.6-137,3600000,,,14739,137,https://www.wind-turbine-models.com/turbines/1551-general-electric-ge-3.6-137,121,GE-137_3600,IIIb, +ENO92/2200,,False,False,False,,129,Eno,,ENO 92,2200000,,,6647,92,https://www.wind-turbine-models.com/turbines/652-eno-energy-eno-92,140,ENO-92_2200,, +GE103/2500,True,False,False,False,85; 110; 139,120,GE Wind,,GE 2.5-103,2500000,243,4,8331,103,https://www.wind-turbine-models.com/turbines/1293-general-electric-ge-2.5-103,129,GE-103_2500,IIIa,WZ 2 +ENO114/4000,,False,False,False,,126,Eno,,ENO 114 4.0,4000000,,,10206,114,https://www.wind-turbine-models.com/turbines/1473-eno-energy-eno-114-4.0,137,ENO-114_4000,, +E48/800,,True,False,True,50;55; 60;65;76,132,Enercon,,E-48 800,800000,,,1809,48,http://www.windenergie-im-binnenland.de/powercurve.php,144,E48_800,, +E-115/3200,True,True,False,True,92; 122; 135; 149,3,Enercon,13,E-115/3200,3200000,304,3,10512,116,https://www.enercon.de/fileadmin/Redakteur/Medien-Portal/broschueren/pdf/ENERCON_Produkt_de_042017.pdf; https://www.wind-turbine-models.com/turbines/,4,E-115_3200,IEC/EN IIA,WZ 4 GKI; WZ 4 GK II +AD132/5000,,False,False,False,80; 94,81,Adwen/Areva,12,AD 5-132,5000000,365,3,13683,132,https://www.wind-turbine-models.com/turbines/1123-adwen-ad-5-132,87,AD-132_5000,IEC IIA/IEC S, +GE103/2850,,False,False,False,75;85;98.3,115,GE Wind,,GE 2.85-103,3850000,,,8331,103,https://www.wind-turbine-models.com/turbines/750-general-electric-ge-2.85-103,124,GE-103_2850,, +ENO126/4800,,False,False,False,,122,Eno,,ENO 126 4.8,4800000,,,12467,126,https://www.wind-turbine-models.com/turbines/1741-eno-energy-eno-126-4.8,133,ENO-126_4800,, +ENO126/4000,,False,False,False,,123,Eno,,ENO 126 4.0,4000000,,,12467,126,https://www.wind-turbine-models.com/turbines/1484-eno-energy-eno-126-4.0,134,ENO-126_4000,, +ENO114/4800,,False,False,False,,125,Eno,,ENO 114 4.8,4800000,,,10206,114,https://www.wind-turbine-models.com/turbines/1742-eno-energy-eno-114-4.8,136,ENO-114_4800,, +ENO82/2050,True,False,False,False,,130,Eno,,ENO 82,2050000,,,5280,82,http://www.eno-energy.com/produkte-leistungen/windenergieanlagen/eno-82-205-mw/#c86; https://www.wind-turbine-models.com/turbines/108-eno-energy-eno-82,141,ENO-82_2050,, +GE100/2750,,False,False,False, 75;85;98.3;123.5,118,GE Wind,,GE 2.75-100,2750000,,,7853,100,https://www.wind-turbine-models.com/turbines/748-general-electric-ge-2.75-100,127,GE-100_2750,, +E-101/3500,True,True,False,True,74; 99,2,Enercon,15,E-101/3500 E2,3500000,437,2,8011,101,https://www.enercon.de/fileadmin/Redakteur/Medien-Portal/broschueren/pdf/ENERCON_Produkt_de_042017.pdf; https://www.wind-turbine-models.com/turbines/,3,E-101_3500,IEC/EN IA,WZ 4 GK I; WZ 4 GK II +E-126/4200,True,True,False,True,99; 135; 159,1,Enercon,12,E-126/4200 EP4,4200000,331,3,12666,127,https://www.enercon.de/fileadmin/Redakteur/Medien-Portal/broschueren/pdf/ENERCON_Produkt_de_042017.pdf; https://www.wind-turbine-models.com/turbines/,2,E-126_4200,IEC/EN IA; IEC/EN IIA,WZ4 GK I; WZ4 GK II; WZ3 GK I; WZ3 GK II +E-101/3050,True,True,False,True,99; 124; 135; 149,4,Enercon,15,E-101/3050 E2,3050000,381,3,8011,101,https://www.enercon.de/fileadmin/Redakteur/Medien-Portal/broschueren/pdf/ENERCON_Produkt_de_042017.pdf; https://www.wind-turbine-models.com/turbines/,5,E-101_3050,IEC/EN IIA,WZ III; WZ 4 GK I \ No newline at end of file From 6647a5a3e49b616f2a0d208242fc8a95d37503f3 Mon Sep 17 00:00:00 2001 From: uvchik Date: Fri, 22 May 2020 23:16:46 +0200 Subject: [PATCH 11/19] Add new tests --- tests/test_data_handling.py | 70 +++++++++++++++++++++++++++++++++++-- windpowerlib/data.py | 15 +++----- 2 files changed, 73 insertions(+), 12 deletions(-) diff --git a/tests/test_data_handling.py b/tests/test_data_handling.py index 31d8f8ba..e737754f 100644 --- a/tests/test_data_handling.py +++ b/tests/test_data_handling.py @@ -3,6 +3,72 @@ SPDX-License-Identifier: MIT """ +import os +from datetime import datetime +from shutil import copyfile + +import pandas as pd +import pytest + +from windpowerlib.data import check_imported_data, check_data_integretiy + + +class TestDataCheck: + @classmethod + def setup_class(cls): + cls.path = os.path.join(os.path.dirname(__file__), "oedb") + cls.filename = os.path.join(cls.path, "{0}.csv") + cls.df = pd.read_csv(cls.filename.format("turbine_data"), index_col=0) + cls.time_stamp = datetime.now().strftime("%Y%m%d%H%M%S") + cls.broken_fn = os.path.join(cls.path, "power_curves_broken.csv") + cls.backup_fn = os.path.join(cls.path, "power_curves_backup.csv") + cls.orig_path = os.path.join(os.path.dirname(__file__), os.pardir, + "windpowerlib", "oedb") + cls.orig_fn = os.path.join(cls.orig_path, "power_curves.csv") + + @classmethod + def teardown_class(cls): + cls.path = os.path.join(os.path.dirname(__file__), "oedb") + cls.backup_fn = os.path.join(cls.path, "power_curves_backup.csv") + orig_path = os.path.join(os.path.dirname(__file__), os.pardir, + "windpowerlib", "oedb") + cls.orig_fn = os.path.join(orig_path, "power_curves.csv") + copyfile(cls.backup_fn, cls.orig_fn) + for f in os.listdir(cls.path): + if "error" in f: + os.remove(os.path.join(cls.path, f)) + + def test_normal_data_check(self): + copyfile( + self.filename.format("turbine_data"), + self.filename.format("turbine_data_{0}".format(self.time_stamp)), + ) + for curve_type in ["power_curve", "power_coefficient_curve"]: + copyfile( + self.filename.format("{}s".format(curve_type)), + self.filename.format("{0}s_{1}".format(curve_type, + self.time_stamp)), + ) + check_imported_data(self.df, self.filename, self.time_stamp) + + def test_data_check_logging_warnings(self, caplog): + self.df.loc["GE158/4800", "has_power_curve"] = True + self.df.loc["GE100/2750", "has_cp_curve"] = True + check_data_integretiy(self.df, min_pc_length=26) + assert "E48/800: power_curve is to short (25 values)" in caplog.text + assert "GE158/4800: No power curve" in caplog.text + assert "GE100/2750: No cp-curve but has_cp_curve" in caplog.text + + def test_global_error(self): + msg = "Must have equal len keys" + with pytest.raises(ValueError, match=msg): + self.df.loc["GE158/4800", "has_cp_curve"] = [5, 3] + check_imported_data(self.df, self.filename, self.time_stamp) + + def test_broken_pwr_curve(self): + copyfile(self.orig_fn, self.backup_fn) + copyfile(self.broken_fn, self.orig_fn) + msg = "could not convert string to float" + with pytest.raises(ValueError, match=msg): + check_imported_data(self.df, self.filename, self.time_stamp) -def test_integretiy_check(): - pass diff --git a/windpowerlib/data.py b/windpowerlib/data.py index 580422a6..5aa7b6c2 100644 --- a/windpowerlib/data.py +++ b/windpowerlib/data.py @@ -5,9 +5,9 @@ SPDX-License-Identifier: MIT """ +import logging import os import warnings -import logging from datetime import datetime from shutil import copyfile @@ -184,7 +184,7 @@ def store_turbine_data_from_oedb( """ turbine_data = fetch_turbine_data_from_oedb(schema=schema, table=table) # standard file name for saving data - filename = os.path.join(os.path.dirname(__file__), "oedb", "{}.csv") + filename = os.path.join(os.path.dirname(__file__), "oedb", "{0}.csv") time_stamp = datetime.now().strftime("%Y%m%d%H%M%S") # get all power (coefficient) curves and save to file @@ -260,15 +260,10 @@ def store_turbine_data_from_oedb( def remove_tmp_file(filename, time_stamp): os.remove(filename.format("turbine_data_{0}".format(time_stamp))) for curve_type in ["power_curve", "power_coefficient_curve"]: - copyfile( - filename.format("{0}s_{1}".format(curve_type, time_stamp)), - filename.format("{}s".format(curve_type)), - ) os.remove(filename.format("{0}s_{1}".format(curve_type, time_stamp))) def check_imported_data(data, filename, time_stamp): - data.to_csv(filename.format("turbine_data")) try: data = check_data_integretiy(data) except Exception as e: @@ -296,7 +291,7 @@ def check_imported_data(data, filename, time_stamp): return data -def check_data_integretiy(data): +def check_data_integretiy(data, min_pc_length=5): for dataset in data.iterrows(): ttype = dataset[0] enercon_e126 = {"turbine_type": "{0}".format(ttype), "hub_height": 135} @@ -316,8 +311,8 @@ def check_data_integretiy(data): logging.warning( "{0}: No cp-curve but has_cp_curve=True.".format(ttype) ) - if dataset[1].has_power_curve is True: - if len(wt.power_curve) < 5: + if wt.power_curve is not None: + if len(wt.power_curve) < min_pc_length: logging.warning( "{0}: power_curve is to short ({1} values),".format( ttype, len(wt.power_curve) From 7a3e3a05cb59f3f8350c9ec50d9b2c61d7c86b2c Mon Sep 17 00:00:00 2001 From: uvchik Date: Fri, 22 May 2020 23:16:54 +0200 Subject: [PATCH 12/19] Fix docstring --- windpowerlib/wind_turbine.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/windpowerlib/wind_turbine.py b/windpowerlib/wind_turbine.py index f600de70..388016f4 100644 --- a/windpowerlib/wind_turbine.py +++ b/windpowerlib/wind_turbine.py @@ -351,9 +351,7 @@ def get_turbine_data_from_file(turbine_type, path): r""" Fetches turbine data from a csv file. - See `example_power_curves.csv', `example_power_coefficient_curves.csv` and - `example_turbine_data.csv` in example/data for the required format of - a csv file. Make sure to provide wind speeds in m/s and power in W or + Make sure to provide wind speeds in m/s and power in W or convert units after loading the data. Parameters From 483ce55e8b61fee33aeb656ded872ce1c23bd800 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 22 May 2020 21:18:32 +0000 Subject: [PATCH 13/19] Fixing style errors. --- tests/test_data_handling.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/test_data_handling.py b/tests/test_data_handling.py index e737754f..4d4a78b0 100644 --- a/tests/test_data_handling.py +++ b/tests/test_data_handling.py @@ -22,16 +22,18 @@ def setup_class(cls): cls.time_stamp = datetime.now().strftime("%Y%m%d%H%M%S") cls.broken_fn = os.path.join(cls.path, "power_curves_broken.csv") cls.backup_fn = os.path.join(cls.path, "power_curves_backup.csv") - cls.orig_path = os.path.join(os.path.dirname(__file__), os.pardir, - "windpowerlib", "oedb") + cls.orig_path = os.path.join( + os.path.dirname(__file__), os.pardir, "windpowerlib", "oedb" + ) cls.orig_fn = os.path.join(cls.orig_path, "power_curves.csv") @classmethod def teardown_class(cls): cls.path = os.path.join(os.path.dirname(__file__), "oedb") cls.backup_fn = os.path.join(cls.path, "power_curves_backup.csv") - orig_path = os.path.join(os.path.dirname(__file__), os.pardir, - "windpowerlib", "oedb") + orig_path = os.path.join( + os.path.dirname(__file__), os.pardir, "windpowerlib", "oedb" + ) cls.orig_fn = os.path.join(orig_path, "power_curves.csv") copyfile(cls.backup_fn, cls.orig_fn) for f in os.listdir(cls.path): @@ -46,8 +48,9 @@ def test_normal_data_check(self): for curve_type in ["power_curve", "power_coefficient_curve"]: copyfile( self.filename.format("{}s".format(curve_type)), - self.filename.format("{0}s_{1}".format(curve_type, - self.time_stamp)), + self.filename.format( + "{0}s_{1}".format(curve_type, self.time_stamp) + ), ) check_imported_data(self.df, self.filename, self.time_stamp) @@ -71,4 +74,3 @@ def test_broken_pwr_curve(self): msg = "could not convert string to float" with pytest.raises(ValueError, match=msg): check_imported_data(self.df, self.filename, self.time_stamp) - From 9446ed1c1e656c5f1ecd68a17402e95081c56772 Mon Sep 17 00:00:00 2001 From: uvchik Date: Fri, 22 May 2020 23:23:13 +0200 Subject: [PATCH 14/19] Fix error --- windpowerlib/wind_turbine.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windpowerlib/wind_turbine.py b/windpowerlib/wind_turbine.py index 388016f4..20b46446 100644 --- a/windpowerlib/wind_turbine.py +++ b/windpowerlib/wind_turbine.py @@ -412,4 +412,4 @@ def get_turbine_types(turbine_library="local", print_out=True, filter_=True): "\nUse >>from windpowerlib import get_turbine_types<< not" ">>from windpowerlib.turbine import get_turbine_types<< not " ) - raise (ImportError, msg) + raise ImportError(msg) From 97973e7002bf147511cfd14cb566c43272dbb377 Mon Sep 17 00:00:00 2001 From: uvchik Date: Fri, 22 May 2020 23:38:34 +0200 Subject: [PATCH 15/19] Add deprecated tests --- tests/test_deprecated.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/test_deprecated.py diff --git a/tests/test_deprecated.py b/tests/test_deprecated.py new file mode 100644 index 00000000..e7d9c99e --- /dev/null +++ b/tests/test_deprecated.py @@ -0,0 +1,25 @@ +""" +SPDX-FileCopyrightText: 2019 oemof developer group +SPDX-License-Identifier: MIT +""" + +import warnings + +import pytest + +from windpowerlib.data import load_turbine_data_from_oedb +from windpowerlib.wind_turbine import get_turbine_types + + +def test_old_import(): + msg = "Use >>from windpowerlib import get_turbine_types" + with pytest.raises(ImportError, match=msg): + get_turbine_types() + + +def test_old_name_load_data_from_oedb(): + with warnings.catch_warnings(): + warnings.simplefilter("error") + msg = "store_turbine_data_from_oedb" + with pytest.raises(FutureWarning, match=msg): + load_turbine_data_from_oedb() From e80c537fc932f7f6de9c838378f897c0dce93c68 Mon Sep 17 00:00:00 2001 From: uvchik Date: Fri, 22 May 2020 23:38:45 +0200 Subject: [PATCH 16/19] Fix messages --- tests/test_data_handling.py | 1 + windpowerlib/data.py | 2 +- windpowerlib/wind_turbine.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_data_handling.py b/tests/test_data_handling.py index 4d4a78b0..73cb086f 100644 --- a/tests/test_data_handling.py +++ b/tests/test_data_handling.py @@ -5,6 +5,7 @@ import os from datetime import datetime + from shutil import copyfile import pandas as pd diff --git a/windpowerlib/data.py b/windpowerlib/data.py index 5aa7b6c2..884404d7 100644 --- a/windpowerlib/data.py +++ b/windpowerlib/data.py @@ -152,7 +152,7 @@ def fetch_turbine_data_from_oedb( def load_turbine_data_from_oedb(schema="supply", table="wind_turbine_library"): msg = ( "\nUse >>store_turbine_data_from_oedb<< and not" - " >>load_turbine_data_from_oedb<<" + " >>load_turbine_data_from_oedb<< in the future." ) warnings.warn(msg, FutureWarning) return store_turbine_data_from_oedb(schema=schema, table=table) diff --git a/windpowerlib/wind_turbine.py b/windpowerlib/wind_turbine.py index 20b46446..d617a5e5 100644 --- a/windpowerlib/wind_turbine.py +++ b/windpowerlib/wind_turbine.py @@ -410,6 +410,6 @@ def get_turbine_types(turbine_library="local", print_out=True, filter_=True): print(turbine_library, print_out, filter_) msg = ( "\nUse >>from windpowerlib import get_turbine_types<< not" - ">>from windpowerlib.turbine import get_turbine_types<< not " + ">>from windpowerlib.wind_turbine import get_turbine_types<< not " ) raise ImportError(msg) From 0d825461c5c28ce451092783937fe95171c243bd Mon Sep 17 00:00:00 2001 From: uvchik Date: Fri, 22 May 2020 23:43:18 +0200 Subject: [PATCH 17/19] Add full deprecated test --- tests/test_deprecated.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/test_deprecated.py b/tests/test_deprecated.py index e7d9c99e..37356d37 100644 --- a/tests/test_deprecated.py +++ b/tests/test_deprecated.py @@ -17,9 +17,6 @@ def test_old_import(): get_turbine_types() -def test_old_name_load_data_from_oedb(): - with warnings.catch_warnings(): - warnings.simplefilter("error") - msg = "store_turbine_data_from_oedb" - with pytest.raises(FutureWarning, match=msg): - load_turbine_data_from_oedb() +def test_old_name_load_data_from_oedb(recwarn): + load_turbine_data_from_oedb() + assert recwarn.pop(FutureWarning) \ No newline at end of file From 1ac748964e84a2dfe23aabdbb4a97242d1c23f97 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 22 May 2020 21:43:31 +0000 Subject: [PATCH 18/19] Fixing style errors. --- tests/test_deprecated.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_deprecated.py b/tests/test_deprecated.py index 37356d37..a248391e 100644 --- a/tests/test_deprecated.py +++ b/tests/test_deprecated.py @@ -19,4 +19,4 @@ def test_old_import(): def test_old_name_load_data_from_oedb(recwarn): load_turbine_data_from_oedb() - assert recwarn.pop(FutureWarning) \ No newline at end of file + assert recwarn.pop(FutureWarning) From 137514e0b2120ca0503a8303247c4b39deffe6e2 Mon Sep 17 00:00:00 2001 From: uvchik Date: Fri, 22 May 2020 23:45:19 +0200 Subject: [PATCH 19/19] Remove unused import --- tests/test_deprecated.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/test_deprecated.py b/tests/test_deprecated.py index 37356d37..5e0a1b67 100644 --- a/tests/test_deprecated.py +++ b/tests/test_deprecated.py @@ -3,8 +3,6 @@ SPDX-License-Identifier: MIT """ -import warnings - import pytest from windpowerlib.data import load_turbine_data_from_oedb @@ -19,4 +17,4 @@ def test_old_import(): def test_old_name_load_data_from_oedb(recwarn): load_turbine_data_from_oedb() - assert recwarn.pop(FutureWarning) \ No newline at end of file + assert recwarn.pop(FutureWarning)