Windpro Service

The WindPro Service provides access to functionality related to general windPRO meta data and coordinate system conversions. You can get the windPRO version, information about your licence and the WAsP version that you are using. Additionally, there is the possibility to convert coordinate systems. This can be useful, if you have data in different coordinate systems, e.g. wind turbine positions in a local country specific coordinate system, but you are working in a project where all data is in UTM. These coordinate transformations are not related to a specific projects and are available regardless of what projection is set in a project.

"""
Copyright 2023 EMD International
License for this script: MIT https://opensource.org/license/mit/
License for windPRO commercial software: https://www.emd-international.com/contact-us/general-terms-conditions-sale/
"""

import os
from windproapi import WindProApi
import time

# WindProApi instance for interacting with windPRO scripting
_windproapi = WindProApi()

# Starting windPRO
_windproapi.start_windpro_random_port()

# open a windPRO service to interact with windPRO
windpro_service = _windproapi.get_service('WindproService')

# Accessing meta information about the windPRO version etc.
version = windpro_service.GetVersion()
print(version)

in_demo = windpro_service.GetIsInDemo()
print(in_demo)

act_lines = windpro_service.GetActivationLines()
print(act_lines)

# Coordinate system operations like changing between coordinate systems of different EPSG numbers
utm_coords = windpro_service.ConvertCoorEPSG(x=10.,
                                             y=55.,
                                             inEpsg=4326,
                                             toEpsg=32632)
print('Easting: {:.1f}m, Northing: {:.1f}m'.format(utm_coords.X, utm_coords.Y))

# Getting more coordinate system information from the EPSG number
coord_sys_4326 = windpro_service.GetCoorSysFromEPSG(epsg=4326)
coord_sys_32632 = windpro_service.GetCoorSysFromEPSG(epsg=32632)

# Converting from latitude/longitude  using this for coordinate transformations
converted_coords = windpro_service.ConvertCoor(x=10., y=55., fromCoorSys=coord_sys_4326, toCoorSys=coord_sys_32632)
# Converted coordinates are equivalent to result from ConvertCoorEPSG
print('Easting: {:.1f}m, Northing: {:.1f}m'.format(utm_coords.X, utm_coords.Y))

time.sleep(10)

# Closing windPRO
_windproapi.close_windpro()