prereise.gather.winddata.rap package

Subpackages

Submodules

prereise.gather.winddata.rap.helpers module

prereise.gather.winddata.rap.helpers.to_reise(data)[source]

Format data for REISE.

Parameters:

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

Returns:

(pandas.DataFrame) – data frame formatted for REISE.

prereise.gather.winddata.rap.noaa_api module

class prereise.gather.winddata.rap.noaa_api.NoaaApi(box)[source]

Bases: object

API client for downloading rap-130 data from NOAA.

Parameters:

box (dict) – geographic area

Raises:
  • TypeError – if box None or not a dict

  • ValueError – if box is missing keys or contains unknown keys

base_url = 'https://www.ncei.noaa.gov/thredds/ncss/model-rap130/'
build_url(time_slice, fallback=False)[source]

Build the url for the given time slice

Parameters:
  • time_slice (str) – url path segment specifying the time range

  • fallback (bool) – whether to use the fallback url for older data

Returns:

(str) – the url to download

fallback_url = 'https://www.ncei.noaa.gov/thredds/ncss/model-rap130-old/'
get_hourly_data(start, end)[source]

Iterate responses over the given time range

Parameters:
  • start (datetime) – the start date

  • end (datetime) – the end date

Returns:

(Generator[requests.Response]) – yield the next http response

get_path_list(start, end)[source]

Enable calculating the final result size prior to download. Used for initializing data frames to the correct size.

Parameters:
  • start (datetime) – the start date

  • end (datetime) – the end date

Returns:

(list) – a list of url paths that span the date range

iter_hours(start, end)[source]

Iterate over the hours in the given range, yielding a path segment matching the structure of NOAA’s server

Parameters:
  • start (datetime) – the start date

  • end (datetime) – the end date

Returns:

(Generator[str]) – path part of the url pertaining to time range

var_u = 'u-component_of_wind_height_above_ground'
var_v = 'v-component_of_wind_height_above_ground'

prereise.gather.winddata.rap.rap module

prereise.gather.winddata.rap.rap.retrieve_data(wind_farm, start_date='2016-01-01', end_date='2016-12-31')[source]

Retrieve wind speed data from NOAA’s server.

Parameters:
  • wind_farm (pandas.DataFrame) – plant data frame.

  • start_date (str) – start date.

  • end_date (str) – end date (inclusive).

Returns:

(tuple) – First element is a pandas data frame with ‘plant_id’, ‘U’, ‘V’, ‘Pout’, ‘ts’ and ‘ts_id’ as columns. The power output is given for a 1MW generator and the U and V component of the wind speed 80-m above ground level are in m/s. Second element is a list of missing files.

Module contents