WakeBlaster

Examples

Submit Multiple Measurements for Different Flow Cases - Python

Submits multiple measurements to the API covering different flow cases, then gets the results.

A flow case ID is specified to determine which measurements should be run together.

Written and tested using Python 3.5.

# Import some modules from the standard python distribution
from datetime import datetime  # datetime for generating timestamps for the measurements
import time                    # time for sleeping between API request attempts
from pprint import pprint      # pprint for pretty-printing data
import requests                # use the `requests` library (install using `pip install requests`).
                               # More info: http://docs.python-requests.org

api_base_url = 'https://app.wakeblaster.net/api'

measurements = []

# Create the measurements to submit - 12 direction sectors
for direction in range(0, 360, 30):
    # Create a flow case ID with the format flow_case_X_degrees
    flow_case_id = 'flow_case_{}_degrees'.format(direction)
    wind_speed_measurement = {
        'signal_id': 'WMET_WindSpeed1_avg',     # Signal ID for this measurement
        'instance_id': 'Lidar',                 # Instance ID for this measurement
        'value': 8,                             # Value for this measurement
        'flow_case_id': flow_case_id            # Flow case ID for this measurement
    }
    wind_direction_measurement = {
        'signal_id': 'WMET_WindDirection1_avg', # Signal ID for this measurement
        'instance_id': 'Lidar',                 # Instance ID for this measurement
        'value': direction,                     # Value for this measurement
        'flow_case_id': flow_case_id            # Flow case ID for this measurement
    }
    measurements += [
        wind_speed_measurement,
        wind_direction_measurement
    ]

# Specify the farm that the measurement belongs to
farm_id = 'DemoFarm_SingleTurbine'

# Create the measurement data object
measurement_data = {
    'farm_id': farm_id,
    'measurements': measurements                # This is an array of measurements
}

# Call the measurements endpoint to submit the measurements
print('Submitting measurements...')
response = requests.post(
    api_base_url + '/measurement-sets',
    json=measurement_data,
    headers={'x-api-key': ''}
)
print(response.text)

# Store the ID of the measurement set
measurement_set_id = response.json()['id']
print('Measurement submitted: ', measurement_set_id)

# Start the simulation
simulation_start_data = {
    'simulation_config': {
        'measurements': {
            'wind_conditions_inference': 'ReferenceBased'
        },
        'wake_model': {
            'type': 'Park'
        }
    },
    'measurement_set_ids': [measurement_set_id]
}

print('Starting simulation...')
response = requests.post(
    api_base_url + '/simulations',
    json=simulation_start_data,
    headers={'x-api-key': ''}
)

# Store the ID of the result set
simulation_id = response.json()['id']
print('Simulation started: ', simulation_id)

# Get simulation results
# Ensure that the correct number of results are returned
# We should get a result for every timestep we submitted measurements for
simulation_state_url = api_base_url + '/simulations/' + simulation_id
simulation_results_url = api_base_url + '/results?simulation_id=' + simulation_id

results = None
attempts = 0
while attempts < 10:
    # Get the results
    # First get the simulation state, to see the result count
    print('Getting simulation state...')
    simulation_state = requests.get(
        simulation_state_url,
        headers={'x-api-key': ''}
    )
    n_results = simulation_state.json()['result_count']
    if n_results == 12:
        # We have our results - get the results and break out of the loop
        print('Results ready - getting results')
        get_result = requests.get(
            simulation_results_url,
            headers={'x-api-key': ''}
        )
        results = get_result.json()
        break

    # The results aren't ready yet - sleep for 0.1 seconds and try again
    attempts += 1
    print('Attempts made: ', attempts)
    time.sleep(5)

# Raise an exception if the results were not returned from the API
if results is None:
    raise Exception('Error loading WakeBlaster results')

# Print the results
pprint(results)
    

Submit Measurement - Python

Submits a measurement to the API, then gets the result.

A clean measurement is submitted, so no processing needs to take place before the measurement is submitted to the simulation.

A timestamp is specified in order to ensure that only the data we want to retrieve is returned.

Written and tested using Python 3.5.

# Import some modules from the standard python distribution
from datetime import datetime  # datetime for generating timestamps for the measurements
import time                    # time for sleeping between API request attempts
from pprint import pprint      # pprint for pretty-printing data
import requests                # use the `requests` library (install using `pip install requests`).
                               # More info: http://docs.python-requests.org

api_base_url = 'https://app.wakeblaster.net/api'

# Create a measurement to submit
# Initialise the timestamp in ISO 8601 format
timestamp = datetime.now().isoformat()
wind_speed_measurement = {
    'signal_id': 'WMET_WindSpeed1_avg', # Signal ID for this measurement
    'instance_id': 'Lidar',             # Instance ID for this measurement
    'value': 8,                         # Value for this measurement
    'timestamp': timestamp              # Timestamp for this measurement
}
wind_direction_measurement = {
    'signal_id': 'WMET_WindDirection1_avg',   # Signal ID for this measurement
    'instance_id': 'Lidar',             # Instance ID for this measurement
    'value': 60,                        # Value for this measurement
    'timestamp': timestamp              # Timestamp for this measurement
}

# Specify the farm that the measurement belongs to
farm_id = 'DemoFarm_SingleTurbine'

# Create the measurement data object
measurement_data = {
    'farm_id': farm_id,
    'measurements': [
        wind_speed_measurement,
        wind_direction_measurement
    ]                                   # This is an array of measurements
}

# Call the measurements endpoint to submit the measurements
print('Submitting measurements...')
response = requests.post(
    api_base_url + '/measurement-sets',
    json=measurement_data,
    headers={'x-api-key': ''}
)

# Store the ID of the measurement set
measurement_set_id = response.json()['id']
print('Measurement submitted: ', measurement_set_id)

# Start the simulation
simulation_start_data = {
    'simulation_config': {
        'measurements': {
            'wind_conditions_inference': 'ReferenceBased'
        },
        'wake_model': {
            'type': 'Park'
        }
    },
    'measurement_set_ids': [measurement_set_id]
}

print('Starting simulation...')
response = requests.post(
    api_base_url + '/simulations',
    json=simulation_start_data,
    headers={'x-api-key': ''}
)

# Store the ID of the result set
simulation_id = response.json()['id']
print('Simulation started: ', simulation_id)

# Get simulation results
# Ensure that the correct number of results are returned
# We should get a result for every timestep we submitted measurements for
simulation_state_url = api_base_url + '/simulations/' + simulation_id
simulation_results_url = api_base_url + '/results?simulation_id=' + simulation_id

results = None
attempts = 0
while attempts < 10:
    # Get the results
    # First get the simulation state, to see the result count
    print('Getting simulation state...')
    simulation_state = requests.get(
        simulation_state_url,
        headers={'x-api-key': ''}
    )
    n_results = simulation_state.json()['result_count']
    if n_results == 1:
        # We have our result - get the results and break out of the loop
        print('Results ready - getting results')
        get_result = requests.get(
            simulation_results_url,
            headers={'x-api-key': ''}
        )
        results = get_result.json()
        break

    # The results aren't ready yet - sleep for 0.1 seconds and try again
    attempts += 1
    print('Attempts made: ', attempts)
    time.sleep(5)

# Raise an exception if the results were not returned from the API
if results is None:
    raise Exception('Error loading WakeBlaster results')

# Print the results
pprint(results)
    

Submit Measurement in CSV Format - Python

Submits a measurement to the API in CSV format, then gets the result.

A clean measurement is submitted, so no processing needs to take place before the measurement is submitted to the simulation.

A timestamp is specified in order to ensure that only the data we want to retrieve is returned.

Written and tested using Python 3.5.

# Import some modules from the standard python distribution
from datetime import datetime  # datetime for generating timestamps for the measurements
import time                    # time for sleeping between API request attempts
from pprint import pprint      # pprint for pretty-printing data
import requests                # use the `requests` library (install using `pip install requests`).
                               # More info: http://docs.python-requests.org

api_base_url = 'https://app.wakeblaster.net/api'

# Create some csv text to submit - this can be read from a file
measurements_csv = 'signal_id,instance_id,value,flow_case_id\n'
measurements_csv += 'WMET_WindSpeed1_avg,Lidar,8,flow_case_1\n'
measurements_csv += 'WMET_WindDirection1_avg,Lidar,60,flow_case_1\n'

# Specify the farm that the measurement belongs to
farm_id = 'DemoFarm_SingleTurbine'

# Create the measurement data object
measurement_data = {
    'farm_id': farm_id,
    'measurements_csv': measurements_csv
}

# Call the measurements endpoint to submit the measurements
print('Submitting measurements...')
response = requests.post(
    api_base_url + '/measurement-sets',
    json=measurement_data,
    headers={'x-api-key': ''}
)

# Store the ID of the measurement set
measurement_set_id = response.json()['id']
print('Measurement submitted: ', measurement_set_id)

# Start the simulation
simulation_start_data = {
    'simulation_config': {
        'measurements': {
            'wind_conditions_inference': 'ReferenceBased'
        },
        'wake_model': {
            'type': 'Park'
        }
    },
    'measurement_set_ids': [measurement_set_id]
}

print('Starting simulation...')
response = requests.post(
    api_base_url + '/simulations',
    json=simulation_start_data,
    headers={'x-api-key': ''}
)

# Store the ID of the result set
simulation_id = response.json()['id']
print('Simulation started: ', simulation_id)

# Get simulation results
# Ensure that the correct number of results are returned
# We should get a result for every timestep we submitted measurements for
simulation_state_url = api_base_url + '/simulations/' + simulation_id
simulation_results_url = api_base_url + '/results?simulation_id=' + simulation_id

results = None
attempts = 0
while attempts < 10:
    # Get the results
    # First get the simulation state, to see the result count
    print('Getting simulation state...')
    simulation_state = requests.get(
        simulation_state_url,
        headers={'x-api-key': ''}
    )
    n_results = simulation_state.json()['result_count']
    if n_results == 1:
        # We have our result - get the results and break out of the loop
        print('Results ready - getting results')
        get_result = requests.get(
            simulation_results_url,
            headers={'x-api-key': ''}
        )
        results = get_result.json()
        break

    # The results aren't ready yet - sleep for 0.1 seconds and try again
    attempts += 1
    print('Attempts made: ', attempts)
    time.sleep(5)

# Raise an exception if the results were not returned from the API
if results is None:
    raise Exception('Error loading WakeBlaster results')

# Print the results
pprint(results)
    

Upload Wind Farm Description in CSV Format - Python

Uploads an asset (a wind farm description) to the WakeBlaster application.

Performs the following steps:

1) Confirms that the wind farm description is not already present

2) Uploads the wind farm description

3) Confirms that the wind farm description was correctly uploaded

Written and tested using Python 3.5.

# Import some modules from the standard python distribution
import json                    # json for creating json-formatted data
from pprint import pprint      # pprint for pretty-printing data
import requests                # use the `requests` library (install using `pip install requests`).
                               # More info: http://docs.python-requests.org

api_base_url = 'https://app.wakeblaster.net/api'
asset_id = 'DemoFarm_SingleTurbine_CSV'

# Upload the wind farm description
wind_farm_description = "id,type,design_id,northing,easting,elevation\n"
wind_farm_description += "A01,turbine,demo_turbine_design,6157991.0,411582.5,0\n"
wind_farm_description += "Lidar,met_mast,demo_met_mast_design,6162408.5,413210.3,0\n"

print('Uploading wind farm description...')
response = requests.put(
    api_base_url + '/assets/' + asset_id,
    json={'wind_farm_description_csv': wind_farm_description},
    headers={'x-api-key': ''}
)

# If we don't get a 201 CREATED response, something has gone wrong
if response.status_code != 201:
    raise Exception('Something went wrong uploading the wind farm description, error code: %d', response.status_code)

print('Wind farm description uploaded!')

# Our wind farm description has been loaded - check that it is now accessible

print('Getting assets...')
response = requests.get(
    api_base_url + '/assets',
    headers={'x-api-key': ''}
)
assets = response.json()

# Confirm that our wind farm description is now present
if not any(map(lambda a: a['asset_id'] == 'DemoFarm_SingleTurbine_CSV', assets)):
    raise Exception('Asset has not been uploaded!')

# Our wind farm description has been uploaded now - great!
print('Wind farm description has been uploaded successfully!')
pprint(assets)

    

Upload Wind Farm Description - Python

Uploads an asset (a wind farm description) to the WakeBlaster application.

Performs the following steps:

1) Confirms that the wind farm description is not already present

2) Uploads the wind farm description

3) Confirms that the wind farm description was correctly uploaded

Written and tested using Python 3.5.

# Import some modules from the standard python distribution
import json                    # json for creating json-formatted data
from pprint import pprint      # pprint for pretty-printing data
import requests                # use the `requests` library (install using `pip install requests`).
                               # More info: http://docs.python-requests.org

api_base_url = 'https://app.wakeblaster.net/api'
asset_id = 'DemoFarm_SingleTurbine'

# Upload the wind farm description
wind_farm_description = {
    "turbine_instances": [
        {
            "id": "A01",
            "northing": 6157991.0,
            "elevation": 0,
            "design_id": "demo_turbine_design",
            "easting": 411582.5
        }
    ],
    "met_mast_instances": [
        {
            "elevation": 0,
            "easting": 413210.3,
            "design_id": "demo_met_mast_design",
            "id": "Lidar",
            "northing": 6162408.5
        }
    ]
}

print('Uploading wind farm description...')
response = requests.put(
    api_base_url + '/assets/' + asset_id,
    json={'wind_farm_description': wind_farm_description},
    headers={'x-api-key': ''}
)

# If we don't get a 201 CREATED response, something has gone wrong
if response.status_code != 201:
    raise Exception('Something went wrong uploading the wind farm description, error code: %d', response.status_code)

print('Wind farm description uploaded!')

# Our wind farm description has been loaded - check that it is now accessible

print('Getting assets...')
response = requests.get(
    api_base_url + '/assets',
    headers={'x-api-key': ''}
)
assets = response.json()

# Confirm that our wind farm description is now present
if not any(map(lambda a: a['asset_id'] == 'DemoFarm_SingleTurbine', assets)):
    raise Exception('Asset has not been uploaded!')

# Our wind farm description has been uploaded now - great!
print('Wind farm description has been uploaded successfully!')
pprint(assets)

    

Submit a Measurement, Errors In Setup - Python

Uploads a wind resource grid description to the API for the demo farm.

The wind resource grid file has errors in so the simulation will produce errors when a measurement is submitted. Get these errors from the API and return.

Written and tested using Python 3.5.

# Import some modules from the standard python distribution
from datetime import datetime  # datetime for generating timestamps for the measurements
import time                    # time for sleeping between API request attempts
from pprint import pprint      # pprint for pretty-printing data
import requests                # use the `requests` library (install using `pip install requests`).
                               # More info: http://docs.python-requests.org

api_base_url = 'https://app.wakeblaster.net/api'

# Specify the farm that the measurement belongs to
asset_id = 'DemoFarm_SingleTurbine_Invalid'

# Specify the wind farm description
wind_farm_description = {
    "turbine_instances": [
        {
            "id": "A01",
            "northing": 6157991.0,
            "elevation": 0,
            "design_id": "demo_turbine_design",
            "easting": 411582.5
        }
    ],
    "met_mast_instances": [
        {
            "elevation": 0,
            "easting": 413210.3,
            "design_id": "demo_met_mast_design",
            "id": "Lidar",
            "northing": 6162408.5
        }
    ]
}

# Specify a wind resource grid with only one site that doesn't match either of the instances
wind_resource_grid_file = ' site 001   431250.0 6149500.0       0 70.0 9.91 2.240        713.132 12  86  87  219  46  74  183  78  93  204  76  97  234  82  99  241  57  92  217  76  99  207  94 109  242 127 110  262  95 105  235 111  96  222  73 107  238'

print('Uploading wind farm description...')
response = requests.put(
    api_base_url + '/assets/' + asset_id,
    json={
        'wind_farm_description': wind_farm_description,
        'wind_resource_grid_file': wind_resource_grid_file
    },
    headers={'x-api-key': ''}
)

# Create a measurement to submit
# Initialise the timestamp in ISO 8601 format
timestamp = datetime.now().isoformat()
wind_speed_measurement = {
    'signal_id': 'WMET_WindSpeed1_avg', # Signal ID for this measurement
    'instance_id': 'Lidar',             # Instance ID for this measurement
    'value': 8,                         # Value for this measurement
    'timestamp': timestamp              # Timestamp for this measurement
}
wind_direction_measurement = {
    'signal_id': 'WMET_WindDirection1_avg',   # Signal ID for this measurement
    'instance_id': 'Lidar',             # Instance ID for this measurement
    'value': 60,                        # Value for this measurement
    'timestamp': timestamp              # Timestamp for this measurement
}

# Create the measurement data object
measurement_data = {
    'farm_id': asset_id,
    'measurements': [
        wind_speed_measurement,
        wind_direction_measurement
    ]                                   # This is an array of measurements
}

# Call the measurements endpoint to submit the measurements
print('Submitting measurements...')
response = requests.post(
    api_base_url + '/measurement-sets',
    json=measurement_data,
    headers={'x-api-key': ''}
)

# Store the ID of the measurement set
measurement_set_id = response.json()['id']
print('Measurement submitted: ', measurement_set_id)

# Start the simulation
simulation_start_data = {
    'simulation_config': {
        'measurements': {
            'wind_conditions_inference': 'ReferenceBased'
        },
        'wake_model': {
            'type': 'Park'
        }
    },
    'measurement_set_ids': [measurement_set_id]
}
print('Starting simulation...')
response = requests.post(
    api_base_url + '/simulations',
    json=simulation_start_data,
    headers={'x-api-key': ''}
)

# Store the ID of the result set
simulation_id = response.json()['id']
print('Simulation started: ', simulation_id)

# Get simulation results
# Ensure that the correct number of results are returned
# We should get a result for every timestep we submitted measurements for
simulation_state_url = api_base_url + '/simulations/' + simulation_id
simulation_errors_url = api_base_url + '/errors?simulation_id=' + simulation_id

errors = None
attempts = 0
while attempts < 10:
    # Get the results
    # First get the simulation state, to see the error count
    print('Getting simulation state...')
    simulation_state = requests.get(
        simulation_state_url,
        headers={'x-api-key': ''}
    )
    n_errors = simulation_state.json()['error_count']
    if n_errors == 1:
        # We have our error - get the errors and break out of the loop
        print('Errors ready - getting results')
        get_error = requests.get(
            simulation_errors_url,
            headers={'x-api-key': ''}
        )
        errors = get_error.json()
        break

    # The results aren't ready yet - sleep for 0.1 seconds and try again
    attempts += 1
    print('Attempts made: ', attempts)
    time.sleep(5)

# Raise an exception if the results were not returned from the API
if errors is None:
    raise Exception('Error loading WakeBlaster results')

# Print the results
pprint(errors)
    

Upload Turbine Design - Python

Uploads a turbine design to the WakeBlaster application.

Performs the following steps:

1) Confirms that the turbine and met mast designs are not already present

2) Uploads the turbine design

3) Uploads the met mast design

4) Confirms that the turbine and met mast designs were correctly uploaded

Written and tested using Python 3.5.

# Import some modules from the standard python distribution
import json                    # json for creating json-formatted data
from pprint import pprint      # pprint for pretty-printing data
import requests                # use the `requests` library (install using `pip install requests`).
                               # More info: http://docs.python-requests.org

api_base_url = 'https://app.wakeblaster.net/api'
turbine_design_id = 'demo_turbine_design'
met_mast_design_id = 'demo_met_mast_design'

# Upload the turbine design
print('Uploading turbine design...')

with open('/files/demo_turbine_design.wtg') as fp:
    turbine_design = fp.read()

response = requests.put(
    api_base_url + '/designs/' + turbine_design_id,
    json={'wtg_file': turbine_design},
    headers={'x-api-key': ''}
)

# If we don't get a 201 CREATED response, something has gone wrong
if response.status_code != 201:
    raise Exception('Something went wrong uploading the turbine design, error code: %d', response.status_code)

# Upload the met mast design
print('Uploading met_mast design...')

with open('/files/demo_met_mast_design.json') as fp:
    met_mast_design = json.load(fp)

response = requests.put(
    api_base_url + '/designs/' + met_mast_design_id,
    json={'met_mast_design': met_mast_design},
    headers={'x-api-key': ''}
)

# If we don't get a 201 CREATED response, something has gone wrong
if response.status_code != 201:
    raise Exception('Something went wrong uploading the turbine design, error code: %d', response.status_code)

print('Designs uploaded!')

# Our wind farm description has been loaded - check that it is now accessible
print('Getting designs...')
response = requests.get(
    api_base_url + '/designs',
    headers={'x-api-key': ''}
)
designs = response.json()

# Confirm that our designs are now present
if not any(map(lambda d: d['design_id'] == 'demo_turbine_design', designs)):
    raise Exception('Turbine design has not uploaded successfully!')

if not any(map(lambda d: d['design_id'] == 'demo_met_mast_design', designs)):
    raise Exception('Metmast design has not uploaded successfully!')

# Our wind farm description has been uploaded now - great!
print('Designs have been uploaded successfully!')
pprint(designs)

    

Assets

getAsset

Gets and asset


/api/assets/{asset_id}

Usage Examples

from urllib import request
import json
import requests

# Gets and asset
url = 'https://app.wakeblaster.net/api/assets/{asset_id}'
response = requests.get(url)
status_code = response.status_code

Parameters

Responses

Status: 200 - Asset found

Status: 404 - Asset not found


getAssets

Returns the assets


/api/assets

Usage Examples

from urllib import request
import json
import requests

# Returns the assets
url = 'https://app.wakeblaster.net/api/assets'
response = requests.get(url)
status_code = response.status_code
result = response.json()

Parameters

Responses

Status: 200 - Assets found and returned successfully


getAssociatedWindSpeeds

Returns the wind speeds for the specified asset


/api/assets/{asset_id}/associated-wind-speeds

Usage Examples

from urllib import request
import json
import requests

# Returns the wind speeds for the specified asset
url = 'https://app.wakeblaster.net/api/assets/{asset_id}/associated-wind-speeds'
response = requests.get(url)
status_code = response.status_code

Parameters

Responses

Status: 200 - Wind speeds found and returned successfully

Status: 404 - Could not find wind speeds


getWindFarmDescription

Returns the wind farm description for the specified asset


/api/assets/{asset_id}/wind-farm-description

Usage Examples

from urllib import request
import json
import requests

# Returns the wind farm description for the specified asset
url = 'https://app.wakeblaster.net/api/assets/{asset_id}/wind-farm-description'
response = requests.get(url)
status_code = response.status_code

Parameters

Responses

Status: 200 - Wind farm description found and returned successfully

Status: 404 - Could not find wind farm description


getWindResourceGrid

Returns the wind resource grid for the specified asset


/api/assets/{asset_id}/wind-resource-grid

Usage Examples

from urllib import request
import json
import requests

# Returns the wind resource grid for the specified asset
url = 'https://app.wakeblaster.net/api/assets/{asset_id}/wind-resource-grid'
response = requests.get(url)
status_code = response.status_code

Parameters

Responses

Status: 200 - Wind resource grid found and returned successfully

Status: 404 - Could not find wind resource grid


updateAsset

Updates an asset


/api/assets/{asset_id}

Usage Examples

from urllib import request
import json
import requests

# Updates an asset
url = 'https://app.wakeblaster.net/api/assets/{asset_id}'
body = 

response = requests.put(
    url,
    headers={'x-api-key': 'API_KEY'},
    json=body
)
status_code = response.status_code

Parameters

Body parameters
Name Description
body

Responses

Status: 201 - Asset created


DataProcessing

getState

Gets the current state of the data processing node.


/api/data_processing/state

Usage Examples

from urllib import request
import json
import requests

# Gets the current state of the data processing node.
url = 'https://app.wakeblaster.net/api/data_processing/state'
response = requests.get(url)
status_code = response.status_code
result = response.json()

Parameters

Responses

Status: 200 - Successfully returned current state


getTestConfiguration

Gets the Test Configuration for the specified farm


/api/data_processing/test_configuration/{farm_id}

Usage Examples

from urllib import request
import json
import requests

# Gets the Test Configuration for the specified farm
url = 'https://app.wakeblaster.net/api/data_processing/test_configuration/{farm_id}'
response = requests.get(url)
status_code = response.status_code
result = response.json()

Parameters

Path parameters
Name Description
farm_id*

Responses

Status: 200 - Successfully returned test configuration for the specified farm


Designs

getDesignDetail

Returns the design detail for the specified id


/api/designs/{design_id}/design

Usage Examples

from urllib import request
import json
import requests

# Returns the design detail for the specified id
url = 'https://app.wakeblaster.net/api/designs/{design_id}/design'
response = requests.get(url)
status_code = response.status_code

Parameters

Responses

Status: 200 - Design detail found and returned successfully

Status: 404 - Could not find design detail


getDesigns

Returns the designs


/api/designs

Usage Examples

from urllib import request
import json
import requests

# Returns the designs
url = 'https://app.wakeblaster.net/api/designs'
response = requests.get(url)
status_code = response.status_code
result = response.json()

Parameters

Responses

Status: 200 - Designs found and returned successfully


updateDesign

Updates a design


/api/designs/{design_id}

Usage Examples

from urllib import request
import json
import requests

# Updates a design
url = 'https://app.wakeblaster.net/api/designs/{design_id}'
body = 

response = requests.put(
    url,
    headers={'x-api-key': 'API_KEY'},
    json=body
)
status_code = response.status_code

Parameters

Body parameters
Name Description
body

Responses

Status: 201 - Design created


Measurements

addMeasurementSet

Uploads a measurement set for processing


/api/measurement-sets

Usage Examples

from urllib import request
import json
import requests

# Uploads a measurement set for processing
url = 'https://app.wakeblaster.net/api/measurement-sets'
body = 

response = requests.post(
    url,
    headers={'x-api-key': 'API_KEY'},
    json=body
)
status_code = response.status_code
result = response.json()

Parameters

Body parameters
Name Description
body

Responses

Status: 201 - Measurements created

Status: 400 - Validation error in measurement data


getMeasurementSets

Returns the measurement sets


/api/measurement-sets

Usage Examples

from urllib import request
import json
import requests

# Returns the measurement sets
url = 'https://app.wakeblaster.net/api/measurement-sets'
response = requests.get(url)
status_code = response.status_code
result = response.json()

Parameters

Responses

Status: 200 - Measurement sets found and returned successfully


getMeasurements

Returns the measurements


/api/measurements

Usage Examples

from urllib import request
import json
import requests

# Returns the measurements
query_string = '?'
query_string += 'set_id=<set_id>' # String | Retrieve measurements for this set_id. (optional)
query_string += '&'
query_string += 'timestamp=<timestamp>' # String | Retrieve measurements for this time only. ISO 8601 format. (optional)
query_string += '&'
query_string += 'signal_id=<signal_id>' # String | Retrieve measurements for this signal only. (optional)
query_string += '&'
query_string += 'orderby=<orderby>' # String | Field to order results by (only currently supports timestamp) (optional)
query_string += '&'
query_string += 'orderdir=asc' # String | Order results ascending (default) or descending (optional) (default to asc)
query_string += '&'
query_string += 'timestamp_from=<timestamp_from>' # String | Return results from this timestamp onwards (inclusive). ISO 8601 format (optional)
query_string += '&'
query_string += 'timestamp_to=<timestamp_to>' # String | Return results up until this timestamp (inclusive). ISO 8601 format (optional)
query_string += '&'
query_string += 'submitted_from=<submitted_from>' # String | Return results submitted from this time. ISO 8601 format (optional)
query_string += '&'
query_string += 'submitted_to=<submitted_to>' # String | Return results submitted to this time. ISO 8601 format (optional)
query_string += '&'
query_string += 'processing_state=<processing_state>' # String | Retrieve measurements with this processing state only (optional)
query_string += '&'
query_string += 'offset=<offset>' # BigDecimal | Offset from 0 (first result) to retrieve results from (optional)
query_string += '&'
query_string += 'limit=<limit>' # BigDecimal | Maximum number of results to retrieve (optional)

url = 'https://app.wakeblaster.net/api/measurements' + query_string
response = requests.get(url)
status_code = response.status_code
result = response.json()

Parameters

Query parameters
Name Description
set_id
timestamp
signal_id
orderby
orderdir
timestamp_from
timestamp_to
submitted_from
submitted_to
processing_state
offset
limit

Responses

Status: 200 - Measurements found and returned successfully

Status: 400 - Client error. Invalid orderby parameter supplied.


Results

getErrors

Returns the errors


/api/errors

Usage Examples

from urllib import request
import json
import requests

# Returns the errors
query_string = '?'
query_string += 'timestamp=<timestamp>' # String | Retrieve errors for this time only. ISO 8601 format. (optional)
query_string += '&'
query_string += 'simulation_id=<simulation_id>' # String | Retrieve errors for this simulation id. See startSimulation.
query_string += '&'
query_string += 'measurement_set_id=<measurement_set_id>' # String | Retrieve errors for this measurement set id. See addMeasurementSet. (optional)
query_string += '&'
query_string += 'timestamp_from=<timestamp_from>' # String | Retrieve errors from this timestamp. ISO 8601 format. (optional)
query_string += '&'
query_string += 'timestamp_to=<timestamp_to>' # String | Retrieve errors to this timestamp. ISO 8601 format. (optional)

url = 'https://app.wakeblaster.net/api/errors' + query_string
response = requests.get(url)
status_code = response.status_code
result = response.json()

Parameters

Query parameters
Name Description
timestamp
simulation_id*
measurement_set_id
timestamp_from
timestamp_to

Responses

Status: 200 - Errors retrieved

Name Type Format Description
X-Count Integer Number of errors for this query.

getFlowPlaneUrl

Returns a url for the flow plane of the requested simulation


/api/flow-plane/{simulation_id}

Usage Examples

from urllib import request
import json
import requests

# Returns a url for the flow plane of the requested simulation
url = 'https://app.wakeblaster.net/api/flow-plane/{simulation_id}'
response = requests.get(url)
status_code = response.status_code

Parameters

Path parameters
Name Description
simulation_id*

Responses

Status: 302 - Redirect to flow plane url for simulation data


getResults

Returns the results


/api/results

Usage Examples

from urllib import request
import json
import requests

# Returns the results
query_string = '?'
query_string += 'timestamp=<timestamp>' # String | Retrieve results for this time only. ISO 8601 format. (optional)
query_string += '&'
query_string += 'simulation_id=<simulation_id>' # String | Retrieve results for this simulation id. See startSimulation.
query_string += '&'
query_string += 'measurement_set_id=<measurement_set_id>' # String | Retrieve results for this measurement set id. See addMeasurementSet. (optional)
query_string += '&'
query_string += 'timestamp_from=<timestamp_from>' # String | Retrieve results from this timestamp. ISO 8601 format. (optional)
query_string += '&'
query_string += 'timestamp_to=<timestamp_to>' # String | Retrieve results to this timestamp. ISO 8601 format. (optional)
query_string += '&'
query_string += 'offset=<offset>' # BigDecimal | Offset from 0 (first result) to retrieve results from (optional)
query_string += '&'
query_string += 'limit=<limit>' # BigDecimal | Maximum number of results to retrieve (optional)

url = 'https://app.wakeblaster.net/api/results' + query_string
response = requests.get(url)
status_code = response.status_code
result = response.json()

Parameters

Query parameters
Name Description
timestamp
simulation_id*
measurement_set_id
timestamp_from
timestamp_to
offset
limit

Responses

Status: 200 - Results retrieved

Name Type Format Description
X-Count Integer Number of results for this query.

getResultsCsv

Returns the results in csv format


/api/results-csv

Usage Examples

from urllib import request
import json
import requests

# Returns the results in csv format
query_string = '?'
query_string += 'timestamp=<timestamp>' # String | Retrieve results for this time only. ISO 8601 format. (optional)
query_string += '&'
query_string += 'simulation_id=<simulation_id>' # String | Retrieve results for this simulation id. See startSimulation.
query_string += '&'
query_string += 'measurement_set_id=<measurement_set_id>' # String | Retrieve results for this measurement set id. See addMeasurementSet. (optional)
query_string += '&'
query_string += 'timestamp_from=<timestamp_from>' # String | Retrieve results from this timestamp. ISO 8601 format. (optional)
query_string += '&'
query_string += 'timestamp_to=<timestamp_to>' # String | Retrieve results to this timestamp. ISO 8601 format. (optional)
query_string += '&'
query_string += 'offset=<offset>' # BigDecimal | Offset from 0 (first result) to retrieve results from (optional)
query_string += '&'
query_string += 'limit=<limit>' # BigDecimal | Maximum number of results to retrieve (optional)
query_string += '&'
query_string += 'property=<property>' # String | The property to retrieve [power|unwaked_power|rotor_wind_speed|wake_speed_factor|air_density|turbulence_intensity]. Defaults to power (optional)

url = 'https://app.wakeblaster.net/api/results-csv' + query_string
response = requests.get(url)
status_code = response.status_code
result = response.json()

Parameters

Query parameters
Name Description
timestamp
simulation_id*
measurement_set_id
timestamp_from
timestamp_to
offset
limit
property

Responses

Status: 200 - Results retrieved

Name Type Format Description
X-Count Integer Number of results for this query.

Shutdown

shutdownApi

Shuts down the API (local use only)


/api/shutdown/

Usage Examples

from urllib import request
import json
import requests

# Shuts down the API (local use only)
url = 'https://app.wakeblaster.net/api/shutdown/'
response = requests.post(url)
status_code = response.status_code

Parameters

Responses

Status: 200 - Server shutdown successfully


Simulations

addSimulation

Adds a simulation


/api/simulations

Usage Examples

from urllib import request
import json
import requests

# Adds a simulation
url = 'https://app.wakeblaster.net/api/simulations'
body = 

response = requests.post(
    url,
    headers={'x-api-key': 'API_KEY'},
    json=body
)
status_code = response.status_code
result = response.json()

Parameters

Body parameters
Name Description
body

Responses

Status: 201 - Simulation created


getSimulation

Returns the requested simulation


/api/simulations/{simulation_id}

Usage Examples

from urllib import request
import json
import requests

# Returns the requested simulation
url = 'https://app.wakeblaster.net/api/simulations/{simulation_id}'
response = requests.get(url)
status_code = response.status_code
result = response.json()

Parameters

Path parameters
Name Description
simulation_id*

Responses

Status: 200 - Successfully returned simulation data


getSimulationConfig

Returns the requested simulation config


/api/simulations/{simulation_id}/simulation-config

Usage Examples

from urllib import request
import json
import requests

# Returns the requested simulation config
url = 'https://app.wakeblaster.net/api/simulations/{simulation_id}/simulation-config'
response = requests.get(url)
status_code = response.status_code

Parameters

Path parameters
Name Description
simulation_id*

Responses

Status: 200 - Successfully found and returned simulation config


getSimulations

Returns the simulations


/api/simulations

Usage Examples

from urllib import request
import json
import requests

# Returns the simulations
query_string = '?'
query_string += 'submitted_from=<submitted_from>' # String | Retrieve simulations submitted from this time. ISO 8601 format. (optional)
query_string += '&'
query_string += 'submitted_to=<submitted_to>' # String | Retrieve simulations submitted to this time. ISO 8601 format. (optional)
query_string += '&'
query_string += 'current_period=<current_period>' # Boolean | Retrieve simulations for the current period (optional)

url = 'https://app.wakeblaster.net/api/simulations' + query_string
response = requests.get(url)
status_code = response.status_code
result = response.json()

Parameters

Query parameters
Name Description
submitted_from
submitted_to
current_period

Responses

Status: 200 - Successfully returned simulation data


Spec

getSpec

Get the swagger-formatted spec.


/api/spec

Usage Examples

from urllib import request
import json
import requests

# Get the swagger-formatted spec.
url = 'https://app.wakeblaster.net/api/spec'
response = requests.get(url)
status_code = response.status_code

Parameters

Responses

Status: 200 - Swagger-formatted spec.


Stats

getStats

Returns the stats


/api/stats

Usage Examples

from urllib import request
import json
import requests

# Returns the stats
url = 'https://app.wakeblaster.net/api/stats'
response = requests.get(url)
status_code = response.status_code

Parameters

Responses

Status: 200 - Stats found ok


getStats_1

Returns the stats


/api/stats/{period}

Usage Examples

from urllib import request
import json
import requests

# Returns the stats
url = 'https://app.wakeblaster.net/api/stats/{period}'
response = requests.get(url)
status_code = response.status_code
result = response.json()

Parameters

Path parameters
Name Description
period*

Responses

Status: 200 - Stats found ok


Generated 2021-01-15T12:58:24.597+01:00