diff --git a/example/modelchain_example.ipynb b/example/modelchain_example.ipynb index f4b1f748..1b4dfa9e 100644 --- a/example/modelchain_example.ipynb +++ b/example/modelchain_example.ipynb @@ -288,7 +288,7 @@ "source": [ "# specification of wind turbine where power coefficient curve and nominal\n", "# power is provided in an own csv file\n", - "csv_path = 'data'\n", + "csv_path = ''\n", "dummy_turbine = {\n", " 'turbine_type': 'DUMMY 1', # turbine type as in file\n", " 'hub_height': 100, # in m\n", diff --git a/example/modelchain_example.py b/example/modelchain_example.py index 7a73a222..b1d68c7b 100644 --- a/example/modelchain_example.py +++ b/example/modelchain_example.py @@ -144,12 +144,11 @@ def initialize_wind_turbines(): # ************************************************************************ # **** Specification of wind turbine with data in own file *************** - csv_path = os.path.join(os.path.dirname(__file__), "data") dummy_turbine = { "turbine_type": "DUMMY 1", "hub_height": 100, # in m "rotor_diameter": 70, # in m - "path": csv_path, + "path": os.path.dirname(__file__), } dummy_turbine = WindTurbine(**dummy_turbine) diff --git a/example/data/power_coefficient_curves.csv b/example/power_coefficient_curves.csv similarity index 100% rename from example/data/power_coefficient_curves.csv rename to example/power_coefficient_curves.csv diff --git a/example/data/power_curves.csv b/example/power_curves.csv similarity index 100% rename from example/data/power_curves.csv rename to example/power_curves.csv diff --git a/example/data/turbine_data.csv b/example/turbine_data.csv similarity index 100% rename from example/data/turbine_data.csv rename to example/turbine_data.csv diff --git a/tests/data/power_coefficient_curves.csv b/tests/data/power_coefficient_curves.csv new file mode 100755 index 00000000..a3c70cc1 --- /dev/null +++ b/tests/data/power_coefficient_curves.csv @@ -0,0 +1,3 @@ +turbine_type,0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12,12.5,13,13.5,14,14.5,15,15.5,16,16.5,17,17.5,18,18.5,19,19.5,20,20.5,21,21.5,22,22.5,23,23.5,24,24.5,25,25.5,26 +DUMMY 1,0,,0,,0,,0,0,0.13,,0.38,,0.46,,0.48,,0.47,,0.44,,0.4,,0.36,,0.31,,0.26,,0.23,,0.2,,0.18,,0.14,,0.11,,0.1,,0.09,,0.07,,0.05,,0.04,,0.04,,0.03,,0 +DUMMY 2,0,,0,,0,,0.16,0.29,0.35,0.38,0.4,0.41,0.42,0.43,0.43,0.44,0.44,0.44,0.44,0.43,0.42,0.39,0.36,0.32,0.29,0.26,0.23,0.2,0.18,0.16,0.15,0.14,0.12,0.11,0.1,0.09,0.09,0.08,0.07,0.07,0.06,0.06,0.05,0.05,0.05,0.04,0.04,0.04,0.04,0.03,0.03,0,0 diff --git a/tests/data/power_curves.csv b/tests/data/power_curves.csv new file mode 100755 index 00000000..85890d50 --- /dev/null +++ b/tests/data/power_curves.csv @@ -0,0 +1,3 @@ +turbine_type,0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12,12.5,13,13.5,14,14.5,15,15.5,16,16.5,17,17.5,18,18.5,19,19.5,20,20.5,21,21.5,22,22.5,23,23.5,24,24.5,25,25.5,26 +DUMMY 3,0,0,0,0,0,0,0,18000,34000,70000,10000,150000,190000,260000,330000,420000,510000,620000,740000,880000,1020000,1180000,1330000,1420000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,0, +DUMMY 4,0,,0,,0,,0,,4000,,22000,,46000,,76000,,111000,,147000,,184000,,219000,,249000,,274000,,290000,,297000,,302000,,307000,,307000,,305000,,295000,,280000,,260000,,240000,,230000,,225000,0, diff --git a/tests/data/turbine_data.csv b/tests/data/turbine_data.csv new file mode 100644 index 00000000..0e9b9f9f --- /dev/null +++ b/tests/data/turbine_data.csv @@ -0,0 +1,5 @@ +turbine_type,nominal_power +DUMMY 1,4200000 +DUMMY 2,4200000 +DUMMY 3,1500000 +DUMMY 4,225000 diff --git a/tests/test_wind_turbine.py b/tests/test_wind_turbine.py index 4140911f..fb23f084 100644 --- a/tests/test_wind_turbine.py +++ b/tests/test_wind_turbine.py @@ -22,7 +22,7 @@ class TestWindTurbine: @classmethod def setup_class(cls): """Setup default values""" - cls.source = os.path.join(os.path.dirname(__file__), "../example/data") + cls.source = os.path.join(os.path.dirname(__file__), "data") def test_warning(self, recwarn): test_turbine_data = { diff --git a/windpowerlib/wind_turbine.py b/windpowerlib/wind_turbine.py index 6ab1c52a..0b4fb2fb 100644 --- a/windpowerlib/wind_turbine.py +++ b/windpowerlib/wind_turbine.py @@ -101,7 +101,7 @@ class WindTurbine(object): >>> print(e126.nominal_power) 4200000.0 >>> # Example with own path - >>> path=os.path.join(os.path.dirname(__file__), '../example/data') + >>> path=os.path.join(os.path.dirname(__file__), '../tests/data') >>> example_turbine={ ... 'hub_height': 100, ... 'rotor_diameter': 70, @@ -378,7 +378,7 @@ def get_turbine_data_from_file(turbine_type, path): -------- >>> from windpowerlib import wind_turbine >>> import os - >>> path=os.path.join(os.path.dirname(__file__), '../example/data', + >>> path=os.path.join(os.path.dirname(__file__), '../tests/data', ... 'power_curves.csv') >>> d3=get_turbine_data_from_file('DUMMY 3', path) >>> print(d3['value'][7])