reVX.hybrid_stats.hybrid_stats.HybridStats

class HybridStats(solar_h5, wind_h5, statistics='pearson', res_cls=<class 'rex.resource.Resource'>, year=None)[source]

Bases: object

Compute comparitive correlations for co-located wind and solar generation

Parameters:
  • solar_h5 (str) – Path to solar h5 file(s)

  • wind_h5 (str) – Path to wind h5 file(s)

  • statistics (str | tuple | dict, optional) – Statistics to extract, either a key or tuple of keys in cls.STATS, or a dictionary of the form {‘stat_name’: {‘func’: , ‘kwargs: {*}}}, by default ‘pearson’

  • res_cls (Class, optional) – Resource class to use to access res_h5, by default Resource

  • year (str | int, optional) – Year to extract time-index for if running on a multi-year file, by default None

Methods

cf_profile(solar_h5, wind_h5[, statistics, ...])

Compute temporal stats on cf_profile dataset

compute_stats(dataset[, annual, diurnal, ...])

Compute correlations

run(solar_h5, wind_h5, dataset[, ...])

Compute temporal stats between solar and wind time-series at desired temporal scales

save_stats(out_stats, out_fpath)

Save correlations to disk

Attributes

STATS

lat_lon

Resource (lat, lon) coordinates

meta

Resource meta-data table

res_cls

Resource class to use to access res_h5

solar_h5

Path to solar h5 file(s)

statistics

Dictionary of statistic functions/kwargs to run

time_index

Resource Datetimes

wind_h5

Path to wind h5 file(s)

property solar_h5

Path to solar h5 file(s)

Returns:

str

property wind_h5

Path to wind h5 file(s)

Returns:

str

property statistics

Dictionary of statistic functions/kwargs to run

Returns:

dict

property res_cls

Resource class to use to access res_h5

Returns:

Class

property time_index

Resource Datetimes

Returns:

pandas.DatetimeIndex

property meta

Resource meta-data table

Returns:

pandas.DataFrame

property lat_lon

Resource (lat, lon) coordinates

Returns:

pandas.DataFrame

static save_stats(out_stats, out_fpath)[source]

Save correlations to disk

Parameters:
  • out_stats (pandas.DataFrame) – Table of correlations to save

  • out_path (str) – .csv, or .json path to save statistics too

compute_stats(dataset, annual=True, diurnal=False, doy=False, month=False, combinations=False, max_workers=None, sites_per_worker=1000, lat_lon_only=True)[source]

Compute correlations

Parameters:
  • dataset (tuple | str) – Dataset to compare, if a string, extract the same dataset for both with and solar, other wise a tuple of the form: (solar_dataset, wind_dataset)

  • annual (bool, optional,) – Extract stats annualy. To extract multi-year monthly stats set annual=False and month=True`, by default True

  • diurnal (bool, optional) – Extract diurnal stats, by default False

  • doy (bool, optional) – Extract doy-of-year stats, by default False

  • month (bool, optional) – Extract monthly stats, by default False

  • combinations (bool, optional) – Extract all combinations of temporal stats, by default False

  • max_workers (None | int, optional) – Number of workers to use, if 1 run in serial, if None use all available cores, by default None

  • sites_per_worker (int, optional) – Number of sites to extract on each worker, by default 1000

  • lat_lon_only (bool, optional) – Only append lat, lon coordinates to stats, by default True

Returns:

res_stats (pandas.DataFrame) – DataFrame of desired statistics at desired time intervals

classmethod run(solar_h5, wind_h5, dataset, statistics='pearson', annual=True, diurnal=False, doy=False, month=False, combinations=False, res_cls=<class 'rex.resource.Resource'>, year=None, max_workers=None, sites_per_worker=1000, lat_lon_only=True, out_path=None)[source]

Compute temporal stats between solar and wind time-series at desired temporal scales

Parameters:
  • solar_h5 (str) – Path to solar h5 file(s)

  • wind_h5 (str) – Path to wind h5 file(s)

  • dataset (tuple | str) – Dataset to compare, if a string, extract the same dataset for both with and solar, other wise a tuple of the form: (solar_dataset, wind_dataset)

  • statistics (str | tuple | dict, optional) – Statistics to extract, either a key or tuple of keys in cls.STATS, or a dictionary of the form {‘stat_name’: {‘func’: , ‘kwargs: {*}}}, by default ‘pearson’

  • annual (bool, optional,) – Extract stats annualy. To extract multi-year monthly stats set annual=False and month=True`, by default True

  • diurnal (bool, optional) – Extract diurnal stats, by default False

  • doy (bool, optional) – Extract doy-of-year stats, by default False

  • month (bool, optional) – Extract monthly stats, by default False

  • combinations (bool, optional) – Extract all combinations of temporal stats, by default False

  • res_cls (Class, optional) – Resource class to use to access res_h5, by default Resource

  • year (str | int, optional) – Year to extract time-index for if running on a multi-year file, by default None

  • max_workers (None | int, optional) – Number of workers to use, if 1 run in serial, if None use all available cores, by default None

  • sites_per_worker (int, optional) – Number of sites to extract on each worker, by default 1000

  • lat_lon_only (bool, optional) – Only append lat, lon coordinates to stats, by default True

  • out_path (str, optional) – .csv, or .json path to save statistics too, by default None

Returns:

out_stats (pandas.DataFrame) – DataFrame of resource statistics

classmethod cf_profile(solar_h5, wind_h5, statistics='pearson', annual=True, diurnal=False, doy=False, month=False, combinations=False, res_cls=<class 'rex.resource.Resource'>, max_workers=None, sites_per_worker=1000, lat_lon_only=True, out_path=None)[source]

Compute temporal stats on cf_profile dataset

Parameters:
  • solar_h5 (str) – Path to solar h5 file(s)

  • wind_h5 (str) – Path to wind h5 file(s)

  • statistics (str | tuple | dict, optional) – Statistics to extract, either a key or tuple of keys in cls.STATS, or a dictionary of the form {‘stat_name’: {‘func’: , ‘kwargs: {*}}}, by default ‘pearson’

  • annual (bool, optional,) – Extract stats annualy. To extract multi-year monthly stats set annual=False and month=True`, by default True

  • diurnal (bool, optional) – Extract diurnal stats, by default False

  • doy (bool, optional) – Extract doy-of-year stats, by default False

  • month (bool, optional) – Extract monthly stats, by default False

  • combinations (bool, optional) – Extract all combinations of temporal stats, by default False

  • res_cls (Class, optional) – Resource class to use to access res_h5, by default Resource

  • max_workers (None | int, optional) – Number of workers to use, if 1 run in serial, if None use all available cores, by default None

  • sites_per_worker (int, optional) – Number of sites to extract on each worker, by default 1000

  • lat_lon_only (bool, optional) – Only append lat, lon coordinates to stats, by default True

  • out_path (str, optional) – .csv, or .json path to save statistics too, by default None

Returns:

out_stats (pandas.DataFrame) – DataFrame of resource statistics