h2integrate.resource.solar.nrel_developer_api_base#
Classes
|
- class h2integrate.resource.solar.nrel_developer_api_base.NRELDeveloperAPISolarResourceBase(**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}_{config.dataset_desc}_{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:
follows naming convention described in SolarResourceBaseAPIModel.
is converted to standardized units described in SolarResourceBaseAPIModel.
This method does the following steps:
load the data, separate out scalar data and timeseries data
remove unused data
- Rename the data columns to standardized naming convention and create dictionary of
OpenMDAO compatible units for the data. Calls format_timeseries_data() method.
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.
- 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.