Components

Datasets

National Renewable Energy Laboratory (“NREL”) data source

class windml.datasets.nrel.NREL[source]

The National Renewable Energy Laboratory (“NREL”) data source contains measurements of more than 32,000 turbines. The data set allows the access of wind speeds and wind power measurements of a turbine at a specified time based on the id. For an easier startup, we provide a dictionary with pre-defined turbines, containing ids of:

  • tehachapi
  • cheyenne
  • palmsprings
  • reno
  • lasvegas
  • hesperia
  • lancaster
  • yuccavalley
  • vantage
  • casper

One can access those ids via the dictionary, e.g. NREL.park_id[‘tehachapi’].

Detailed information about the data set can be found at: http://www.nrel.gov/electricity/transmission/about_datasets.html GUI: http://wind.nrel.gov/Web_nrel/

Methods

bytes_to_string
download_with_progress_bar
fetch_nrel_data
fetch_nrel_meta_data
fetch_nrel_meta_data_all
get_turbine
get_windpark
get_windpark_nearest
bytes_to_string(nbytes)[source]

Byte representation for progress bar.

Parameters:

nbytes : int

Amount of bytes.

Returns:

str :

Representation of bytes.

download_with_progress_bar(data_url, return_buffer=False)[source]

Download a file, showing progress.

Parameters:

data_url : string

web address.

return_buffer : boolean (optional)

if true, return a StringIO buffer rather than a string.

Returns:

str :

Content of the file.

fetch_nrel_data(turbine_id, year, columns=['date', 'speed', 'power_output', 'score', 'corrected_score'], data_home=None)[source]

Loader for NREL wind measurements.

Parameters:

turbine_id : id of the turbine that shall be fetched.

Number between 1 and 32043

year : year for that the data shall be fetched. can be 2004, 2005, 2006

columns : optional, default=[‘date’,’speed’,’power_output’,’score’,’corrected_score’]

Specify the columns to be selected, see code above.

data_home : optional, default=None

Specify another download and cache folder for the datasets. By default, data is stored in ~/nrel_data on Unix systems.

Returns :

——- :

numpy.array :

Includes all values of given attributes (columns) for a given year.

fetch_nrel_meta_data(turbine_id, columns=['id', 'latitude', 'longitude', 'power_density', 'power_capacity', 'speed', 'elevation'], data_home=None)[source]

Loader for NREL meta data, gets one entry by id.

Parameters:

turbine_id : specifies the id of the WEA to be used.

columns : optional, default=[‘id’,’latitude’,’longitude’,’power_density’,’power_capacity’,’speed’,’elevation’]

Specify the columns to be selected, see code above.

data_home : optional, default=None

Specify another download and cache folder for the datasets. By default, data is stored in ~/nrel_data on Unix systems.

Returns :

——- :

numpy.array :

array of meta data for a turbine.

fetch_nrel_meta_data_all(columns=['id', 'latitude', 'longitude', 'power_density', 'power_capacity', 'speed', 'elevation'], data_home=None)[source]

Loader for NREL meta data (all entries).

Parameters:

columns : optional, default=[‘id’,’latitude’,’longitude’,’power_density’,’power_capacity’,’speed’,’elevation’]

Specify the columns to be selected, see code above.

data_home : optional, default=None

Specify another download and cache folder for the datasets. By default, data is stored in ~/nrel_data on Unix systems.

Returns :

——- :

numpy.array :

Array of meta data for a turbines.

get_turbine(target_idx, year_from, year_to=0)[source]

This method fetches and returns a single turbine object.

Parameters:

target_idx : int

see windml.datasets.nrel.park_id for example ids.

year_from : int

2004 - 2006

year_to : int

2004 - 2006

Returns:

Turbine :

An according turbine for target id and time span.

get_windpark(target_idx, radius, year_from=0, year_to=0)[source]

This method fetches and returns a windpark from NREL, which consists of the target turbine with the given target_idx and the surrounding turbine within a given radius around the target turbine. When called, the wind measurements for a given range of years are downloaded for every turbine in the park.

Parameters:

target_idx : int

see windml.datasets.nrel.park_id for example ids.

year_from : int

2004 - 2006

year_to : int

2004 - 2006

Returns:

Windpark :

An according windpark for target id, radius, and time span.

get_windpark_nearest(target_idx, n_nearest, year_from=0, year_to=0)[source]

This method fetches and returns a windpark from NREL, which consists of the target turbine with the given target_idx and the surrounding n-nearest turbines around the target turbine. When called, the wind measurements for a given range of years are downloaded for every turbine in the park.

Parameters:

target_idx : int

see windml.datasets.nrel.park_id for example ids.

year_from : int

2004 - 2006

year_to : int

2004 - 2006

Returns:

Windpark :

An according windpark for target id, n-nearest, and time span.

Model

When using windml, you need to know the two basic types of objects.

  • Turbine
  • Windpark

See below for a detailed description of the concepts behind those. Enjoy.

Turbine

class windml.model.turbine.Turbine(idx, latitude, longitude, power_density, power_capacity, speed, elevation)[source]

The class Turbine represents a single turbine. It contains the properties of the turbine, including the index of the turbine, its coordinates, the average power density and capacity, the mean wind speed and the elevation of the hub.

Methods

add_measurements
get_measurements
get_measurements_between
add_measurements(measurements)[source]

Set measurements of the turbine.

Parameters:measurements : np.array
get_measurements()[source]

Get measurements of the turbine.

Returns:

np.array :

Numpy array of measurements.

get_measurements_between(start, end)[source]

Get measurements between certain timestamp

Parameters:

start : start timestmap

end : end timestmap

Returns:

np.array :

Numpy array of measurements.

Wind Park

class windml.model.windpark.Windpark(target_idx, radius)[source]

The class Windpark represents a park, which consists of one or more turbines.

Methods

add_turbine
get_powermatrix
get_radius
get_target
get_target_idx
get_turbines
add_turbine(turbine)[source]

Adds a turbine to the windpark.

Parameters:

turbine : Turbine

Turbine to add.

get_powermatrix()[source]

Get the power matrix of all turbines. A power matrix consists of all corrected_scores.

Returns:

numpy.matrix :

Matrix, rows are time steps, columns are correct_scores of each turbine.

get_radius()[source]

Get radius of windpark relative to the target turbine.

Returns:

int :

Radius in km.

get_target()[source]

Get target.

Returns:

Turbine :

Target turbine.

get_target_idx()[source]

Get target id.

Returns:

target_idx : int

A user-defined id.

get_turbines()[source]

Get all turbines from park.

Returns:

array :

Array of all turbines.

Mapping

Power Mapping

class windml.mapping.power_mapping.PowerMapping[source]

Maps time series to feature-label pairs, use power

Methods

get_features_park
get_features_turbine
get_labels_park
get_labels_turbine
get_features_park(windpark, feature_window, horizon, padding=0)[source]

Get features for a given windpark, consisting of the values of the corrected score for all turbines in the park dependend on feature_window size and time horizon and optionally a certain padding.

Parameters:

windpark : Windpark

Features of the given windpark.

feature_window : int

The amount of time steps of the feature window.

horizon: int :

The amount of time steps of the horizon.

Returns:

numpy.matrix :

Pattern matrix for regression.

get_features_turbine(turbine, feature_window, horizon, padding=0)[source]

Get features from a given turbine, consisting of the values of the corrected score for one turbine dependend on feature_window size and time horizon and optionally a certain padding.

Parameters:

turbine : Turbine

Features of the given turbine.

feature_window : int

The amount of time steps of the feature window.

horizon: int :

The amount of time steps of the horizon.

Returns:

numpy.matrix :

Pattern matrix for regression.

get_labels_park(windpark, feature_window, horizon, padding=0)[source]

Get labels for a given windpark, consisting of the values of the corrected score for all turbines in the park dependend on feature window, horizon and optionally a certain padding. The labels are the sums of the corrected score of all turbines in the park.

Parameters:

windpark : Windpark

Features of the given windpark.

feature_window : int

The amount of time steps of the feature window.

horizon: int :

The amount of time steps of the horizon.

Returns:

numpy.array :

Label array for regression.

get_labels_turbine(turbine, feature_window, horizon, padding=0)[source]

Get labels for a given turbine, consisting of the values of the corrected score for one turbine dependend on feature window, horizon and optionally a certain padding.

Parameters:

turbine : Turbine

Features of the given turbine.

feature_window : int

The amount of time steps of the feature window.

horizon: int :

The amount of time steps of the horizon.

Returns:

numpy.array :

Label array for regression.

Power Diff Mapping

class windml.mapping.power_diff_mapping.PowerDiffMapping[source]

Maps time series to feature-label pairs, use power and differences

Methods

get_features_park
get_features_turbine
get_labels_park
get_labels_turbine
get_features_park(windpark, feature_window, horizon, padding=0)[source]

Get features for a given windpark, consisting of the values of the corrected score and their corresponding changes for all turbines in the park dependend on feature_window size and time horizon and optionally a certain padding.

Parameters:

windpark : Windpark

Features of the given windpark.

feature_window : int

The amount of time steps of the feature window.

horizon: int :

The amount of time steps of the horizon.

Returns:

numpy.matrix :

Pattern matrix for regression.

get_features_turbine(turbine, feature_window, horizon, padding=0)[source]

Get features from a given turbine, consisting of the values of the corrected score and their corresponding changes for one turbine dependend on feature_window size and time horizon and optionally a certain padding.

Parameters:

turbine : Turbine

Features of the given turbine.

feature_window : int

The amount of time steps of the feature window.

horizon: int :

The amount of time steps of the horizon.

Returns:

numpy.matrix :

Pattern matrix for regression.

get_labels_park(windpark, feature_window, horizon, padding=0)[source]

Get labels for a given windpark, consisting of the values of the corrected score for all turbines in the park dependend on feature window, horizon and optionally a certain padding. The labels are the sums of the corrected score of all turbines in the park.

Parameters:

windpark : Windpark

Features of the given windpark.

feature_window : int

The amount of time steps of the feature window.

horizon: int :

The amount of time steps of the horizon.

Returns:

numpy.array :

Label array for regression.

get_labels_turbine(turbine, feature_window, horizon, padding=0)[source]

Get labels for a given turbine, consisting of the values of the corrected score for one turbine dependend on feature window, horizon and optionally a certain padding.

Parameters:

turbine : Turbine

Features of the given turbine.

feature_window : int

The amount of time steps of the feature window.

horizon: int :

The amount of time steps of the horizon.

Returns:

numpy.array :

Label array for regression.

Contents

This Page

Fork me on GitHub