Title: Add Data from wind-turbine-models.com · Issue #120 · wind-python/windpowerlib · GitHub
Open Graph Title: Add Data from wind-turbine-models.com · Issue #120 · wind-python/windpowerlib
X Title: Add Data from wind-turbine-models.com · Issue #120 · wind-python/windpowerlib
Description: Hello everybody, I wrote a small script to parse the data from wind-turbine-models.com. As the Turbine-data already contains records from wind-turbine-models.com (https://github.com/wind-python/windpowerlib/blob/master/windpowerlib/oedb/...
Open Graph Description: Hello everybody, I wrote a small script to parse the data from wind-turbine-models.com. As the Turbine-data already contains records from wind-turbine-models.com (https://github.com/wind-python/win...
X Description: Hello everybody, I wrote a small script to parse the data from wind-turbine-models.com. As the Turbine-data already contains records from wind-turbine-models.com (https://github.com/wind-python/win...
Opengraph URL: https://github.com/wind-python/windpowerlib/issues/120
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add Data from wind-turbine-models.com","articleBody":"Hello everybody,\r\n\r\nI wrote a small script to parse the data from wind-turbine-models.com.\r\nAs the Turbine-data already contains records from wind-turbine-models.com (https://github.com/wind-python/windpowerlib/blob/master/windpowerlib/oedb/turbine_data.csv) I hope that the legal issues discussed in https://github.com/OpenEnergyPlatform/data-preprocessing/issues/28#issuecomment-808275889 are cleared and the data can be used.\r\n\r\nIt would be very good if the power curves could be additionally integrated into the OEP-Database.\r\n\r\nThe below code is available under the MIT License and free for anyone to use:\r\n```\r\nfrom bs4 import BeautifulSoup # parse html\r\nimport requests\r\nimport json5 # parse js-dict to python\r\nimport json\r\nimport pandas as pd\r\nfrom tqdm import tqdm # fancy for loop\r\n\r\n# create list of turbines with available powercurves\r\npage = requests.get('https://www.wind-turbine-models.com/powercurves')\r\nsoup = BeautifulSoup(page.text, 'html.parser')\r\n# pull all text from the div\r\nname_list = soup.find(class_ ='chosen-select')\r\n\r\nwind_turbines_with_curve = []\r\nfor i in name_list.find_all('option'): \r\n wind_turbines_with_curve.append(i.get('value'))\r\n\r\ndef downloadTurbineCurve(turbine_id,start = 0, stop=25):\r\n url = \"https://www.wind-turbine-models.com/powercurves\"\r\n headers = dict()\r\n headers[\"Content-Type\"] = \"application/x-www-form-urlencoded\"\r\n data = {'_action': 'compare', 'turbines[]': turbine_id, 'windrange[]': [start, stop]}\r\n\r\n resp = requests.post(url, headers=headers, data=data)\r\n strings = resp.json()['result']\r\n begin = strings.find('data:')\r\n end = strings.find('\"}]', begin)\r\n relevant_js = '{'+strings[begin:end+3]+'}}'\r\n curve_as_dict = json5.loads(relevant_js)\r\n x = curve_as_dict['data']['labels']\r\n y = curve_as_dict['data']['datasets'][0]['data']\r\n label = curve_as_dict['data']['datasets'][0]['label']\r\n url = curve_as_dict['data']['datasets'][0]['url']\r\n df = pd.DataFrame(y, index=x, columns=[label])\r\n df.index.name = 'wind_speed'\r\n return df\r\n\r\ncurves = []\r\nfor turbine_id in tqdm(wind_turbines_with_curve):\r\n curve = downloadTurbineCurve(turbine_id)\r\n curves.append(curve)\r\nc = pd.concat(curves,axis=1)\r\nd = c[c.any(axis=1)]\r\n \r\nwith open('down.csv','w') as f: \r\n d.to_csv(f)\r\n```","author":{"url":"https://github.com/maurerle","@type":"Person","name":"maurerle"},"datePublished":"2021-11-26T15:50:11.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/120/windpowerlib/issues/120"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:48663105-b324-23a8-68b1-e4498ec92b4c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 95CE:B8255:89E4CD1:B9C4764:698CFB68 |
| html-safe-nonce | 8a08fe53a324725814f9c4fed24f3212ae29a2815a59dd14d689831937d6da21 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NUNFOkI4MjU1Ojg5RTRDRDE6QjlDNDc2NDo2OThDRkI2OCIsInZpc2l0b3JfaWQiOiI3MzEzODk0MjUyNDQxNTY2MDU2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 38f3a255b7e6a42be6f06e1505d4de4d7bfc26d44bbcea0624ebc01a8f683c03 |
| hovercard-subject-tag | issue:1064642669 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/wind-python/windpowerlib/120/issue_layout |
| twitter:image | https://opengraph.githubassets.com/56e9737b40bcbd65511ee1840061890faca8768f6dee60d633f02bb49b4b2c67/wind-python/windpowerlib/issues/120 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/56e9737b40bcbd65511ee1840061890faca8768f6dee60d633f02bb49b4b2c67/wind-python/windpowerlib/issues/120 |
| og:image:alt | Hello everybody, I wrote a small script to parse the data from wind-turbine-models.com. As the Turbine-data already contains records from wind-turbine-models.com (https://github.com/wind-python/win... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | maurerle |
| hostname | github.com |
| expected-hostname | github.com |
| None | 09447bc7ef1f50c40a646f48e82dfbd31133c28c940bfee5a938619ac0191038 |
| turbo-cache-control | no-preview |
| go-import | github.com/wind-python/windpowerlib git https://github.com/wind-python/windpowerlib.git |
| octolytics-dimension-user_id | 21263042 |
| octolytics-dimension-user_login | wind-python |
| octolytics-dimension-repository_id | 66651306 |
| octolytics-dimension-repository_nwo | wind-python/windpowerlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 66651306 |
| octolytics-dimension-repository_network_root_nwo | wind-python/windpowerlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 02f0047575af3d968e1dea9cf0b6015a852cddfe |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width