time_series.py

lib.time_series.calc_TS_solar(hours, args)

This function computes the hourly PV and CSP capacity factor for the desired quantiles.

Parameters
  • hours (numpy array) – Hour ranks of the year (from 0 to 8759).

  • args (list) –

    List of arguments:

    • param (dict): Dictionary including multiple parameters such as the status bar limit, the name of the region, and others for calculating the hourly capacity factors.

    • tech (str): Name of the technology.

    • rasterData (dict): Dictionary of numpy arrays containing land use types, Ross coefficients, albedo coefficients, and wind speed correction for every point in reg_ind.

    • merraData (dict): Dictionary of numpy arrays containing the weather data for every point in reg_ind.

Return TS

Array of time series for the desired quantiles for each subregion.

Return type

numpy array

lib.time_series.calc_TS_windoff(hours, args)

This function computes the hourly onshore and offshore wind capacity factor for desired quantiles.

Parameters
  • hours (numpy array) – Hour ranks of the year (from 0 to 8759).

  • args (list) –

    List of arguments:

    • param (dict): Dictionary including multiple parameters such as the status bar limit, the name of the region, and others for calculating the hourly capacity factors.

    • tech (str): Name of the technology.

    • rasterData (dict): Dictionary of numpy arrays containing the wind speed correction for every point in reg_ind.

    • merraData (dict): Dictionary of numpy arrays containing the weather data for every point in reg_ind.

Return TS

Array of time series for the desired quantiles for each subregion.

Return type

numpy array

lib.time_series.calc_TS_windon(point, args)

This function computes the hourly onshore and offshore wind capacity factor for desired quantiles.

Parameters
  • hours (numpy array) – Hour ranks of the year (from 0 to 8759).

  • args (list) –

    List of arguments:

    • param (dict): Dictionary including multiple parameters such as the status bar limit, the name of the region, and others for calculating the hourly capacity factors.

    • tech (str): Name of the technology.

    • rasterData (dict): Dictionary of numpy arrays containing the wind speed correction for every point in reg_ind.

    • merraData (dict): Dictionary of numpy arrays containing the weather data for every point in reg_ind.

Return TS

Array of time series for the desired quantiles for each subregion.

Return type

numpy array

lib.time_series.combinations_for_time_series(paths, param, tech)

This function reads the list of generated regression coefficients for different hub heights and orientations, compares it to the user-defined modes and combos and returns a list of lists containing all the available combinations. The function will return a warning if the user input and the available time series are not congruent.

Parameters
  • paths (dict) – Dictionary of dictionaries containing the paths to the regression output folder.

  • param (dict) – Dictionary of dictionaries containing the year, the user defined combos, and subregions name.

  • tech (str) – Technology under study.

Return combinations

List of combinations of settings to be used in stratified time series.

Return inputfiles

List of regression outputs to be used in generating the stratified time series.

Return type

tuple (list, list)

Raises
  • No coefficients – If regression coefficients are not available, a warning is raised.

  • Missing coefficients – If regression coefficients are missing based on user-defined combos and mode, a warning is raised.

lib.time_series.find_representative_locations(paths, param, tech)

This function reads the masked FLH raster and finds the coordinates and indices of the pixels for the user-defined quantiles for each region. It creates a shapefile containing the position of those points for each region, and two MAT files with their coordinates and indices.

Parameters
  • paths (dict) – Dictionary of dictionaries containing path values for FLH MAT files, region statistics, and output paths.

  • param (dict) – Dictionary of dictionaries containing the user-defined quantiles, FLH resolution, and spatial scope.

  • tech (str) – Technology under study.

Returns

The shapefile with the locations and the two MAT files for the coordinates and the indices are saved directly in the given paths, along with their corresponding metadata in JSON files.

Return type

None

lib.time_series.generate_time_series_for_regions(paths, param, tech)

This function reads the coefficients obtained from the regression function as well as the generated time series for the combinations of hub heights / orientations and quantiles, to combine them according to user-defined modes (quantile combination) and combos (hub heights / orientation combinations) and saves the results (time series) in a CSV file.

Parameters
  • paths (dict) – Dictionary of dictionaries containing the paths to the regression coefficients and the time series.

  • param (dict) – Dictionary of dictionaries containing the list of subregions, the modes, and the combos.

  • tech (str) – Technology under study.

Returns

The stratified time series for each region, mode, and combo are saved directly in the given path, along with the metadata in a JSON file.

Return type

None

lib.time_series.generate_time_series_for_representative_locations(paths, param, tech)

This function generates yearly capacity factor time-series for the technology of choice at quantile locations generated in find_locations_quantiles. The timeseries are saved in CSV files.

Parameters
  • paths (dict) – Dictionary of dictionaries containing paths to coordinate and indices of the quantile locations.

  • param (dict) – Dictionary of dictionaries containing processing parameters.

  • tech (str) – Technology under study.

Returns

The CSV file with the time series for all subregions and quantiles is saved directly in the given path, along with the corresponding metadata in a JSON file.

Return type

None

lib.time_series.generate_time_series_for_specific_locations(paths, param, tech)

This function generates yearly capacity factor time-series for the technology of choice at user defined locations. The timeseries are saved in CSV files.

Parameters
  • paths (dict) – Dictionary of dictionaries containing paths output desired locations.

  • param (dict) – Dictionary of dictionaries containing processing parameters, and user-defined locations.

  • tech (str) – Technology under study.

Returns

The CSV file with the time series for all subregions and quantiles is saved directly in the given path, along with the corresponding metadata in a JSON file.

Return type

None

Raises
  • Point locations not found – Is raised when the dictionary containing the points names and locations is empty.

  • Points outside spatial scope – Some points are not located inside of the spatial scope, therefore no input maps are available for the calculations