reVX.wind_dirs.mean_wind_dirs.MeanWindDirections

class MeanWindDirections(excl_fpath, wdir_dsets, tm_dset='techmap_wtk', excl_dict=None, area_filter_kernel='queen', min_area=None, resolution=128, excl_area=None)[source]

Bases: Aggregation

Average the wind direction via the wind vectors. Then convert to equivalent sc_point_gid

Parameters:
  • excl_fpath (str) – Filepath to exclusions h5 with techmap dataset.

  • wdir_dsets (str | list) – Wind direction dataset to average

  • tm_dset (str, optional) – Dataset name in the techmap file containing the exclusions-to-resource mapping data, by default ‘techmap_wtk’

  • excl_dict (dict | None, optional) – Dictionary of exclusion LayerMask arugments {layer: {kwarg: value}} by default None

  • area_filter_kernel (str, optional) – Contiguous area filter method to use on final exclusions mask, by default ‘queen’

  • min_area (float | None, optional) – Minimum required contiguous area filter in sq-km, by default None

  • resolution (int | None, optional) – SC resolution, must be input in combination with gid, by default 128

  • excl_area (float | None, optional) – Area of an exclusion pixel in km2. None will try to infer the area from the profile transform attribute in excl_fpath, by default None

Methods

aggregate(res_h5_fpath[, max_workers, ...])

Average wind directions to sc_points

run(res_h5_fpath, excl_fpath, wdir_dsets[, ...])

Aggregate powerrose to supply curve points, find neighboring supply curve point gids and rank them based on prominent powerrose direction

run_parallel(h5_fpath[, agg_method, ...])

Aggregate in parallel

run_serial(excl_fpath, h5_fpath, tm_dset, ...)

Standalone method to aggregate - can be parallelized.

save_agg_to_h5(h5_fpath, out_fpath, aggregation)

Save aggregated data to disc in .h5 format

Attributes

gids

1D array of supply curve point gids to aggregate

shape

Get the shape of the full exclusions raster.

classmethod run_serial(excl_fpath, h5_fpath, tm_dset, *wind_dir_dset, excl_dict=None, inclusion_mask=None, area_filter_kernel='queen', min_area=None, resolution=128, excl_area=0.0081, gids=None, gen_index=None, **kwargs)[source]

Standalone method to aggregate - can be parallelized.

Parameters:
  • excl_fpath (str | list | tuple) – Filepath to exclusions h5 with techmap dataset (can be one or more filepaths).

  • h5_fpath (str) – Filepath to .h5 file to aggregate

  • tm_dset (str) – Dataset name in the techmap file containing the exclusions-to-resource mapping data.

  • wind_dir_dset (str) – Wind directions to aggreate, can supply multiple datasets

  • excl_dict (dict, optional) – Dictionary of exclusion LayerMask arugments {layer: {kwarg: value}} by default None

  • area_filter_kernel (str, optional) – Contiguous area filter method to use on final exclusions mask, by default “queen”

  • min_area (float, optional) – Minimum required contiguous area filter in sq-km, by default None

  • resolution (int, optional) – SC resolution, must be input in combination with gid. Prefered option is to use the row/col slices to define the SC point instead, by default 0.0081

  • excl_area (float, optional) – Area of an exclusion pixel in km2. None will try to infer the area from the profile transform attribute in excl_fpath, by default None

  • gids (list, optional) – List of gids to get summary for (can use to subset if running in parallel), or None for all gids in the SC extent, by default None

  • gen_index (np.ndarray, optional) – Array of generation gids with array index equal to resource gid. Array value is -1 if the resource index was not used in the generation run, by default None

  • kwargs (dict) – Unused kwargs from Aggregation.run_serial method, namely agg_method

Returns:

agg_out (dict) – Aggregated values for each aggregation dataset

aggregate(res_h5_fpath, max_workers=None, sites_per_worker=1000)[source]

Average wind directions to sc_points

Parameters:
  • res_h5_fpath (str) – Filepath to .h5 file containing wind direction data

  • max_workers (int | None) – Number of cores to run summary on. None is all available cpus.

  • sites_per_worker (int, optional) – Number of SC points to process on a single parallel worker, by default 1000

Returns:

agg (dict) – Aggregated values for each aggregation dataset

classmethod run(res_h5_fpath, excl_fpath, wdir_dsets, tm_dset='techmap_wtk', excl_dict=None, area_filter_kernel='queen', min_area=None, resolution=128, excl_area=None, max_workers=None, sites_per_worker=1000, out_fpath=None)[source]

Aggregate powerrose to supply curve points, find neighboring supply curve point gids and rank them based on prominent powerrose direction

Parameters:
  • res_h5_fpath (str) – Filepath to .h5 file containing wind direction data

  • excl_fpath (str) – Filepath to exclusions h5 with techmap dataset.

  • wdir_dsets (str | list) – Wind direction dataset to average

  • tm_dset (str, optional) – Dataset name in the techmap file containing the exclusions-to-resource mapping data, by default ‘techmap_wtk’

  • excl_dict (dict | None, optional) – Dictionary of exclusion LayerMask arugments {layer: {kwarg: value}} by default None

  • area_filter_kernel (str, optional) – Contiguous area filter method to use on final exclusions mask, by default ‘queen’

  • min_area (float | None, optional) – Minimum required contiguous area filter in sq-km, by default None

  • resolution (int | None, optional) – SC resolution, must be input in combination with gid, by default 128

  • excl_area (float | None, optional) – Area of an exclusion pixel in km2. None will try to infer the area from the profile transform attribute in excl_fpath, by default None

  • max_workers (int | None, optional) – Number of cores to run summary on. None is all available cpus, by default None

  • sites_per_worker (int, optional) – Number of SC points to process on a single parallel worker, by default 1000

  • out_fpath (str) – Path to .h5 file to save aggregated data too

Returns:

agg (dict) – Aggregated values for each aggregation dataset

property gids

1D array of supply curve point gids to aggregate

Returns:

ndarray

run_parallel(h5_fpath, agg_method='mean', excl_area=None, max_workers=None, sites_per_worker=100)

Aggregate in parallel

Parameters:
  • h5_fpath (str) – Filepath to .h5 file to aggregate

  • agg_method (str, optional) – Aggregation method, either mean or sum/aggregate, by default “mean”

  • excl_area (float, optional) – Area of an exclusion cell (square km), by default None

  • max_workers (int, optional) – Number of cores to run summary on. None is all available cpus, by default None

  • sites_per_worker (int, optional) – Number of SC points to process on a single parallel worker, by default 100

Returns:

agg_out (dict) – Aggregated values for each aggregation dataset

static save_agg_to_h5(h5_fpath, out_fpath, aggregation)

Save aggregated data to disc in .h5 format

Parameters:
  • out_fpath (str) – Output .h5 file path

  • aggregation (dict) – Aggregated values for each aggregation dataset

property shape

Get the shape of the full exclusions raster.

Returns:

tuple