prereise.gather.winddata package

Subpackages

Submodules

prereise.gather.winddata.const module

prereise.gather.winddata.impute module

prereise.gather.winddata.impute.gaussian(data, wind_farm, inplace=True, curve='state')[source]

Impute missing data using gaussian distributions of U & V. For each missing entry, sample U & V based on mean and covariance of non-missing entries that have the same location, same month, and same hour.

Parameters:
  • data (pandas.DataFrame) – data frame as returned by prereise.gather.winddata.rap.rap.retrieve_data().

  • wind_farm (pandas.DataFrame) – data frame of wind farms.

  • inplace (bool) – should the imputation be done in place.

  • curve (str) – ‘state’ to use the state average, otherwise named curve.

Returns:

(pandas.DataFrame) – data frame with missing entries imputed.

prereise.gather.winddata.impute.linear(data, inplace=True)[source]

Given a 2D array, linearly interpolate any missing values column-wise.

Parameters:
  • data (numpy.array/pandas.DataFrame) – data to interpolate.

  • inplace (bool) – whether to modify the data inplace or return a modified copy.

Returns:

(None/pandas.DataFrame) – if inplace is False, data frame with missing entries imputed.

prereise.gather.winddata.impute.simple(data, wind_farm, inplace=True, curve='state')[source]

Impute missing data using a simple procedure. For each missing entry, the extrema of the U and V components of the wind speed of all non missing entries that have the same location, same month, same hour are first found for each missing entry. Then, a U and V value are randomly generated between the respective derived ranges.

Parameters:
  • data (pandas.DataFrame) – data frame as returned by prereise.gather.winddata.rap.rap.retrieve_data().

  • wind_farm (pandas.DataFrame) – data frame of wind farms.

  • inplace (bool) – should the imputation be done in place.

  • curve (str) – ‘state’ to use the state average, otherwise named curve.

Returns:

(pandas.DataFrame) – data frame with missing entries imputed.

prereise.gather.winddata.power_curves module

prereise.gather.winddata.power_curves.build_state_curves(form_860, power_curves, maxspd=30, default='IEC class 2', rsd=0)[source]

Parse Form 860 and turbine curves to obtain average state curves.

Parameters:
  • form_860 (pandas.DataFrame) – EIA Form 860 data.

  • power_curves (pandas.DataFrame) – turbine power curves.

  • maxspd (float) – maximum x value for state curves.

  • default (str) – turbine curve name for turbines not in power_curves.

  • rsd (float) – relative standard deviation for spatiotemporal smoothing.

Returns:

(pandas.DataFrame) - DataFrame of state curves.

prereise.gather.winddata.power_curves.get_form_860(data_dir, year=2016)[source]

Read data for EIA Form 860.

Parameters:
  • data_dir (str) – data directory.

  • year (int) – EIA data year to get.

Returns:

(pandas.DataFrame) – dataframe with Form 860 data.

prereise.gather.winddata.power_curves.get_power(power_curves, state_power_curves, wspd, turbine, default='IEC class 2')[source]

Convert wind speed to power using NREL turbine power curves.

Parameters:
  • power_curves (pandas.DataFrame) – turbine power curves data.

  • state_power_curves (pandas.DataFrame) – state average power curves data.

  • wspd (float) – wind speed (in m/s).

  • turbine (str) – turbine name, IEC class, or state code for average.

  • default (str) – default turbine name.

Returns:

(float) – normalized power.

prereise.gather.winddata.power_curves.get_state_power_curves(filename='StatePowerCurves.csv', rsd=0.4)[source]

Load state power curves from csv, if the csv is present. Otherwise, construct them from EIA form 860 data and turbine curves.

Parameters:
  • filename (str) – filename (not path) of csv file to read from.

  • rsd (float) – relative standard deviation, for wind speed distribution.

Returns:

(pandas.DataFrame) – normalized state power curves.

prereise.gather.winddata.power_curves.get_turbine_power_curves(filename='PowerCurves.csv')[source]

Load turbine power curves from csv.

Parameters:

filename (str) – filename (not path) of csv file to read from.

Returns:

(pandas.DataFrame) – normalized turbine power curves.

prereise.gather.winddata.power_curves.shift_turbine_curve(turbine_curve, hub_height, maxspd, new_curve_res)[source]

Shift a turbine curve based on a given hub height.

Parameters:
  • turbine_curve (pandas.Series) – power curve data, wind speed index.

  • hub_height (float) – height to shift power curve to.

  • maxspd (float) – Extent of new curve (m/s).

  • new_curve_res (float) – Resolution of new curve (m/s).

Module contents