h2integrate.resource.wind.nrel_developer_wtk_api#

Classes

WTKNRELDeveloperAPIConfig(*, latitude, ...)

Configuration class to download wind resource data from Wind Toolkit Data V2.

WTKNRELDeveloperAPIWindResource(**kwargs)

class h2integrate.resource.wind.nrel_developer_wtk_api.WTKNRELDeveloperAPIConfig(*, latitude, longitude, timezone, use_fixed_resource_location=True, resource_year, dataset_desc='wtk_v2', resource_type='wind', valid_intervals=NOTHING, resource_data={}, resource_filename='', resource_dir=None)#

Configuration class to download wind resource data from Wind Toolkit Data V2.

Parameters:
  • resource_year (int) -- Year to use for resource data. Must been between 2007 and 2014 (inclusive).

  • resource_data (dict | object, optional) -- Dictionary of user-input resource data. Defaults to an empty dictionary.

  • resource_dir (str | Path, optional) -- Folder to save resource files to or load resource files from. Defaults to "".

  • resource_filename (str, optional) -- Filename to save resource data to or load resource data from. Defaults to None.

  • latitude (float)

  • longitude (float)

  • timezone (int | float)

  • use_fixed_resource_location (bool)

  • dataset_desc (str)

  • resource_type (str)

  • valid_intervals (list[int])

dataset_desc#

description of the dataset, used in file naming. For this dataset, the dataset_desc is "wtk_v2".

Type:

str

resource_type#

type of resource data downloaded, used in folder naming. For this dataset, the resource_type is "wind".

Type:

str

valid_intervals#

time interval(s) in minutes that resource data can be downloaded in. For this dataset, valid_intervals are 5, 15, 30, and 60 minutes.

Type:

list[int]

resource_year: int#
dataset_desc: str#
resource_type: str#
valid_intervals: list[int]#
resource_data: dict | object#
resource_filename: Path | str#
resource_dir: Path | str | None#
class h2integrate.resource.wind.nrel_developer_wtk_api.WTKNRELDeveloperAPIWindResource(**kwargs)#
setup()#

Declare inputs and outputs.

Available attributes:

name pathname comm options

create_filename(latitude, longitude)#

Create default filename to save downloaded data to. Filename is formatted as "{latitude}_{longitude}_{resource_year}_wtk_v2_{interval}min_{tz_desc}_tz.csv" where "tz_desc" is "utc" if the timezone is zero, or "local" otherwise.

Parameters:
  • latitude (float) -- latitude corresponding to location for resource data

  • longitude (float) -- longitude corresponding to location for resource data

Returns:

str -- filename for resource data to be saved to or loaded from.

create_url(latitude, longitude)#

Create url for data download.

Parameters:
  • latitude (float) -- latitude corresponding to location for resource data

  • longitude (float) -- longitude corresponding to location for resource data

Returns:

str -- url to use for API call.

load_data(fpath)#

Load data from a file and format as a dictionary that:

  1. follows naming convention described in WindResourceBaseAPIModel.

  2. is converted to standardized units described in WindResourceBaseAPIModel.

This method does the following steps:

  1. load the data, separate out scalar data and timeseries data

  2. remove unused data

  3. Rename the data columns to standardized naming convention and create dictionary of

    OpenMDAO compatible units for the data. Calls format_timeseries_data() method.

  4. Convert data to standardized units. Calls compare_units_and_correct() method

Parameters:

fpath (str | Path) -- filepath to file containing the data

Returns:

dict -- dictionary of data in standardized units and naming convention. Time information is found in the 'time' key.

format_timeseries_data(data)#

Convert data to a dictionary with keys that follow the standardized naming convention and create a dictionary containing the units for the data.

Parameters:

data (pd.DataFrame) -- Dataframe of timeseries data.

Returns:

2-element tuple containing

  • data (dict): data dictionary with keys following the standardized naming

    convention.

  • data_units (dict): dictionary with same keys as data and values as the

    data units in OpenMDAO compatible format.