Online Data Service
Within windPRO you can download a vast amount of online data ranging from mesoscale wind data to terrain information. The OnlineDataService gives access to downloading online data in windPRO. You need to have an internet connection to use these service as data is accessed from EMD’s servers. The example code below activates the online data service and prints all DataTypes that are available from this service. A data type refers to the type of data, e.g. “ODSClimate” for mesoscale climate data, “ODSRoughnessGridToLine” for roughness maps derived from gridded data, translated to roughness lines.
import os
from windproapi.utils import get_windpro_sample_path
from windproapi import WindProApi
_windproapi = WindProApi()
_windproapi.start_windpro_random_port()
online_data_service = _windproapi.get_service('OnlineDataService')
print(online_data_service.GetDataTypes())
A full list of data types with their description is given below, including the method used for downloading the data.
Name of data type |
Download method |
Description |
---|---|---|
ODSRoughnessArea |
|
Roughness data |
ODSRoughnessGridToLine |
|
Roughness data generated from gridded data. |
ODSHeightsLine |
|
Elevation data as lines |
ODSTerrainGrid |
|
Digital Terrain Model data as grids |
ODSSurfaceGrid |
|
Digital Surface Model data as grids |
ODSObjHeightsGrid |
|
Forest data |
ODSDepthsGrid |
|
Bathymetry data |
ODSMaps |
|
Background maps |
ODSWTG |
|
Catalogue of existing wind turbines |
ODSClimate |
|
Meteorological data e.g. from meteorological models or publically available weather stations. |
ODSGasp |
|
Global Atlas for Siting Parameter data |
Note that unlike in windPRO data needs to be downloaded as it is on the server. This is most important if you want elevations as a line object. You need to download gridded data and do the conversion to lines yourself afterwads (see Elevation Grid Object Service) Be also aware that there is a difference between digital terrain (ODSTerrainGrid) and digitial surface (ODSSurfaceGrid) models.
This service needs a location to be prepared, i.e. the data service needs to know which data type to look for and where that is.
You need to prepare the service with PrepareService
.
This tells windPRO to file all data at that location.
For getting a list of all available data use OnlineDataService.GetServices
.
The output is a list of dictionary-like objects that contain information about the available data.
The ServiceId is the unique identifier to download the data.
import os
project_service = _windproapi.get_service('ProjectService')
working_dir = os.path.join(get_windpro_sample_path("4.0"), "Online_Service")
os.makedirs(working_dir, exist_ok=True)
project_service.NewProject(11., 55., os.path.join(working_dir, 'test.w40p'))
dataType = 'ODSClimate'
online_data_service.PrepareService(dataType, 55., 11.)
meteoServices = online_data_service.GetServices(dataType)
From the list of all available data sets we can select one by its “ServiceId” and download data into a new object.
If not done already for using GetServices
, PrepareService
needs to be run before dowloading data.
online_data_service.PrepareService('ODSClimate', 55., 11.)
meteoHandles = online_data_service.DownloadMeteoData("siERABasic", 55., 11., 30000, 1, 2014, 2020)
DownloadMeteoData
returns a list of handles, as in principle there could be multiple objects created from downloading online data.
Find below an example how to use the OnlineDataService
"""
Copyright 2024 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.utils import get_windpro_sample_path
from windproapi import WindProApi
from windproapi import nan_to_skipvalue
# Opening windPRO
_windproapi = WindProApi()
_windproapi.start_windpro_random_port()
# Paths for running project
working_dir = os.path.join(get_windpro_sample_path('4.1'), 'Online_Service')
os.makedirs(working_dir, exist_ok=True)
# Services
project_service = _windproapi.get_service('ProjectService')
objects_service = _windproapi.get_service('ObjectsService')
obj_elevation_grid_service = _windproapi.get_service('ObjElevationGridService')
online_data_service = _windproapi.get_service('OnlineDataService')
# Project path and location
project_path = os.path.join(working_dir, 'test.w41p')
lng = 9.85
lat = 56.8
# Making a new empty project
project_service.NewProject(lng=lng, lat=lat, filename=project_path)
# The available online data services can be found here in the SOAP reference xml file
for dataType in online_data_service.GetDataTypes():
print(dataType)
# Getting data for an observed wind climate. This is form the list of above
dataType = 'ODSClimate'
online_data_service.PrepareService(dataType=dataType, lat=lat, lon=lng)
# The GetService returns a list with dertails about all available data.
meteo_services = online_data_service.GetServices(dataType=dataType)
# Use the service ID to download the data
print(meteo_services)
meteo_handles = online_data_service.DownloadMeteoData(implId='siEra5Basic',
lat=lat,
lon=lng,
maxDist=30000,
numPoints=1,
fromYear=2014,
toYear=2020)
# Downloading roughness and terrain data
terrain_layer = objects_service.AddLayer(layerName='Terrain data', parentFolderHandle=0)
objects_service.SetEditLayer(handle=terrain_layer)
terrain_data_type = 'ODSSurfaceGrid'
online_data_service.PrepareService(dataType=terrain_data_type, lat=lat, lon=lng)
terrain_services = online_data_service.GetServices(dataType=terrain_data_type)
print(terrain_services)
terrain_service_id = 'Global_TandemX90_Grid'
terrain_handle = online_data_service.DownloadHeightData(dataType=terrain_data_type,
implId=terrain_service_id,
userDesc='Terrain data grid',
lat=lat,
lon=lng,
width=10000,
height=10000,
useAsTin=True)
# Downloading Line data. It is also possible to download data that is stored as grids and convert them to lines directly.
terrain_data_type = 'ODSHeightsLine'
online_data_service.PrepareService(dataType=terrain_data_type, lat=lat, lon=lng)
terrain_services = online_data_service.GetServices(dataType=terrain_data_type)
print(terrain_services)
terrain_service_id = 'Global_TandemX90_Grid'
terrain_handle = online_data_service.DownloadHeightData(dataType=terrain_data_type,
implId=terrain_service_id,
userDesc='Line Terrain data (from grid)',
lat=lat,
lon=lng,
width=10000,
height=10000,
useAsTin=True)
roughness_data_type = 'ODSRoughnessGridToLine'
online_data_service.PrepareService(dataType=roughness_data_type, lat=lat, lon=lng)
roughness_service = online_data_service.GetServices(dataType=roughness_data_type)
print(roughness_service)
roughness_service_id = 'DataService_Rou_grid_GlobCover'
roughness_handle = online_data_service.DownloadRoughnessData(dataType=roughness_data_type,
implId=roughness_service_id,
userDesc='Roughness data',
lat=lat,
lon=lng,
width=10000,
height=10000)
# Adding forest layers
forest_layer = objects_service.AddLayer(layerName='Forest data', parentFolderHandle=0)
terrain_data_type = 'ODSObjHeightsGrid'
online_data_service.PrepareService(dataType=terrain_data_type, lat=lat, lon=lng)
available_data = online_data_service.GetServices(dataType=terrain_data_type)
handle_forest = online_data_service.DownloadHeightData(dataType=terrain_data_type,
implId='GLOB_Sentinel2_Canopy_Grid',
userDesc='Forest Data',
lat=lat,
lon=lng,
width=10000,
height=10000,
useAsTin=False)