prereise.gather.demanddata.nrel_efs package

Subpackages

Submodules

prereise.gather.demanddata.nrel_efs.aggregate_demand module

prereise.gather.demanddata.nrel_efs.aggregate_demand.access_non_efs_demand(dem_paths)[source]

Access any of the sectoral demand that the user intends to use that is external to NREL’s EFS studies. This function also ensures that each data set is formatted appropriately, so as to allow easy aggregation with the NREL EFS sectoral demand.

Parameters:

dem_paths (iterable) – The paths that point to the .csv files of sectoral demand data that is not associated with NREL’s EFS. Ordering within the iterable does not need to match that in local_sects.

Returns:

(list) – A list of pandas.DataFrame objects that contain sectoral demand data for each state and time step. This sectoral demand is not a part of NREL’s EFS.

Raises:
  • TypeError – if dem_paths are not input as an iterable or if the components of dem_paths are not input as strings.

  • ValueError – if the data located in each path in dem_path does not have the proper timestamps or the correct number of states.

prereise.gather.demanddata.nrel_efs.aggregate_demand.combine_efs_demand(efs_dem=None, non_efs_dem=None, save=None)[source]

Aggregate the sectoral demand data so that a single demand point is observed for each state and timestamp. This function can either access local copies of the sectoral demand data or can access the demand data from online.

Parameters:
  • efs_dem (dict) – A dict of pandas.DataFrame objects that contain sectoral demand data for each state and time step. This input is intended to be the output of partition_demand_by_sector(), which is associated with NREL’s EFS. Defaults to None.

  • non_efs_dem (list) – A list of pandas.DataFrame objects that contain sectoral demand data for each state and time step. This input is intended to be the output of access_non_efs_demand(), which is not associated with NREL’s EFS. Defaults to None.

  • save (str) – Saves a .csv if a string representing a valid file path and file name is provided. Defaults to None, indicating that a .csv file should not be saved.

Returns:

(pandas.DataFrame) – Aggregate demand data for all sectors (both EFS and non-EFS).

Raises:
  • TypeError – if efs_dem is not input as a dict, if non_efs_dem is not input as a list, if the components of efs_dem and non_efs_dem are not pandas.DataFrames, or if save is not input as a string.

  • ValueError – if both efs_dem and non_efs_dem are entered as None or if the components of efs_dem and non_efs_dem do not have the proper timestamps or the correct number of states.

prereise.gather.demanddata.nrel_efs.get_efs_annual_data module

prereise.gather.demanddata.nrel_efs.get_efs_annual_data.get_efs_annual_data(path, sector)[source]

Download the electric technology service demand file from the NREL Electrification Future Study (EFS) and return the electrification projection in each state for a given sector

Parameters:
  • path (str) – path to electric technology service demand file from NREL EFS (local or url)

  • sector (str) – sector to query in the file. Can be one of ‘RESIDENTIAL’, ‘COMMERCIAL’, ‘PRODUCTIVE’ (industrial) and ‘TRANSPORTATION’.

Returns:

(pandas.DataFrame) – Columns are ‘SCENARIO’ (range of electrification futures, e.g. ‘MEDIUM ELECTRIFICATION - MODERATE TECHNOLOGY ADVANCEMENT’, ‘DEMAND_TECHNOLOGY’ (technologies for a given sector, e.g. ‘ELECTRIC LIGHT- DUTY AUTO - 100 MILE RANGE’ for transportation sector), ‘STATE’ (50 United States and District of Columbia), ‘SUBSECTOR’ (a sub category of technology for any sector, e.g. ‘AVIATION’ of the transportation sector), ‘YEAR’ (year of projection), ‘FINAL_ENERGY’ (type of energy, e.g. ‘RESIDUAL FUEL OIL’), ‘UNIT’ (unit of ‘VALUE’, e.g. ‘MILE’), ‘VALUE’ (projected annual value).

Raises:

ValueError – if sector is invalid.

prereise.gather.demanddata.nrel_efs.get_efs_data module

prereise.gather.demanddata.nrel_efs.get_efs_data.account_for_leap_year(df)[source]

Creates an additional day’s worth of demand data to account for the additional day that occurs during leap years. This function takes an 8760-hour DataFrame as input and returns an 8784-hour DataFrame. To prevent the weekly structure of the input DataFrame from being disrupted, the additional 24 hours of demand are merely added to the end of the input 8760-hour DataFrame for each state. The additional 24 hours of demand are set equal to the demand profile for January 2nd because January 2nd and December 31st occur on the same day of the week during a leap year.

Parameters:

df (pandas.DataFrame) – DataFrame of sectoral demand data. Rows are each hour of the 8760 hours and Columns are the abbreviations of each state of the contiguous U.S.

Returns:

(pandas.DataFrame) – Sectoral demand data with 8784 hours and of a similar form to the input DataFrame.

Raises:

ValueError – if the dimensions of the input DataFrame do not reflect 8760 hours or 48 states.

prereise.gather.demanddata.nrel_efs.get_efs_data.download_demand_data(es=None, ta=None, fpath='', sz_path='C:/Program Files/7-Zip/7z.exe')[source]

Downloads the NREL EFS base demand data for the specified electrification scenarios and technology advancements.

Parameters:
  • es (set/list) – The electrification scenarios that will be downloaded. Can choose any of: ‘Reference’, ‘Medium’, ‘High’, or ‘All’. Defaults to None.

  • ta (set/list) – The technology advancements that will be downloaded. Can choose any of: ‘Slow’, ‘Moderate’, ‘Rapid’, or ‘All’. Defaults to None.

  • fpath (str) – The file path to which the NREL EFS data will be downloaded.

  • sz_path (str) – The file path on Windows machines that points to the 7-Zip tool. Defaults to ‘C:/Program Files/7-Zip/7z.exe’.

Raises:

TypeError – if sz_path is not input as a str.

prereise.gather.demanddata.nrel_efs.get_efs_data.download_flexibility_data(es=None, fpath='', sz_path='C:/Program Files/7-Zip/7z.exe')[source]

Downloads the NREL EFS flexibility data for the specified electrification scenarios.

Parameters:
  • es (set/list) – The electrification scenarios that will be downloaded. Can choose any of: ‘Reference’, ‘Medium’, ‘High’, or ‘All’. Defaults to None.

  • fpath (str) – The file path to which the NREL EFS data will be downloaded.

  • sz_path (str) – The file path on Windows machines that points to the 7-Zip tool. Defaults to ‘C:/Program Files/7-Zip/7z.exe’.

Raises:

TypeError – if sz_path is not input as a str.

prereise.gather.demanddata.nrel_efs.get_efs_data.partition_demand_by_sector(es, ta, year, sect=None, fpath='', save=False)[source]

Creates .csv files for each of the specified sectors given a specified electrification scenario and technology advancement.

Parameters:
  • es (str) – An electrification scenario. Can choose one of: ‘Reference’, ‘Medium’, or ‘High’.

  • ta (str) – A technology advancement. Can choose one of: ‘Slow’, ‘Moderate’, or ‘Rapid’.

  • year (int) – The selected year’s worth of demand data. Can choose one of: 2018, 2020, 2024, 2030, 2040, or 2050.

  • sect (set/list) – The sectors for which .csv files are to be created. Can choose any of: ‘Transportation’, ‘Residential’, ‘Commercial’, ‘Industrial’, or ‘All’. Defaults to None.

  • fpath (str) – The file path where the demand data might be saved and to where the sectoral data will be saved.

  • save (bool) – Determines whether or not the .csv file is saved. Defaults to False. If the file is saved, it is saved to the same location as fpath.

Returns:

(dict) – A dict of pandas.DataFrame objects that contain demand data for each state and time step in the specified sectors.

Raises:

TypeError – if save is not input as a bool.

prereise.gather.demanddata.nrel_efs.get_efs_data.partition_flexibility_by_sector(es, ta, flex, year, sect=None, fpath='', save=False)[source]

Creates .csv files for each of the specified sectors given a specified electrification scenario and technology advancement.

Parameters:
  • es (str) – An electrification scenario. Can choose one of: ‘Reference’, ‘Medium’, or ‘High’.

  • ta (str) – A technology advancement. Can choose one of: ‘Slow’, ‘Moderate’, or ‘Rapid’.

  • flex (str) – A flexibility scenario. Can choose one of: ‘Base’ or ‘Enhanced’.

  • year (int) – The selected year’s worth of demand data. Can choose one of: 2018, 2020, 2024, 2030, 2040, or 2050.

  • sect (set/list) – The sectors for which .csv files are to be created. Can choose any of: ‘Transportation’, ‘Residential’, ‘Commercial’, ‘Industrial’, or ‘All’. Defaults to None.

  • fpath (str) – The file path where the demand data might be saved and to where the sectoral data will be saved.

  • save (bool) – Determines whether or not the .csv file is saved. Defaults to False. If the file is saved, it is saved to the same location as fpath.

Returns:

(dict) – A dict of pandas.DataFrame objects that contain flexibility data for each state and time step in the specified sectors.

Raises:

TypeError – if save is not input as a bool.

prereise.gather.demanddata.nrel_efs.map_states module

prereise.gather.demanddata.nrel_efs.map_states.decompose_demand_profile_by_state_to_loadzone(df, profile_type, regions=None, save=None)[source]

Transforms the sectoral demand data so that it is separated by load zone rather than by state.

Parameters:
  • df (pandas.DataFrame) – DataFrame of the sectoral demand data, where the rows are time steps (in local time) and the columns are the states. This input is intended to be the output of combine_efs_demand() or the components that are output from partition_flexibility_by_sector().

  • profile_type (str) – A string that identifies the type of profile that is provided. Can be one of ‘demand’ or ‘demand_flexibility’.

  • regions (iterable) – The combination of interconnection names and state abbreviations that dictate the zone IDs to be included. Can choose any of: ‘Eastern’, ‘Western’, ‘Texas’, any state abbreviation in the contiguous United States, or ‘All’. Defaults to None.

  • save (str) – Saves a .csv if a string representing a valid file path and file name is provided. Defaults to None, indicating that a .csv file should not be saved.

Returns:

(pandas.DataFrame) – Sectoral demand, split by load zone ID.

Raises:
  • TypeError – if df is not a pandas.DataFrame, if profile_type is not a string, if regions is not an iterable, if the components of regions are not strings, or if save is not input as a string.

  • ValueError – if df does not have the proper timestamps or the correct number of states, if profile_type is not valid, or if the components of regions are not valid.

prereise.gather.demanddata.nrel_efs.map_states.shift_local_time_by_loadzone_to_utc(df)[source]

Maps the local time for each load zone to the corresponding UTC time.

Parameters:

df (pandas.DataFrame) – DataFrame of the demand data, where the rows are time steps (in local time) and the columns are load zone IDs.

Returns:

(pandas.DataFrame) – Demand, shifted to account for UTC time.

Raises:
  • TypeError – if df is not a pandas.DataFrame.

  • ValueError – if df does not have the proper timestamps or the correct number of states.

Module contents