reVX.wind_dirs.prominent_wind_dirs.ProminentWindDirections
- class ProminentWindDirections(power_rose_h5_fpath, excl_fpath, agg_dset='powerrose_100m', tm_dset='techmap_wtk', resolution=128, excl_area=None)[source]
Bases:
Aggregation
Aggregate PowerRose to Supply Curve points and sort directions in order of prominence. Then convert to equivalent sc_point_gid
- Parameters:
power_rose_h5_fpath (str) – Filepath to .h5 file containing powerrose data
excl_fpath (str) – Filepath to exclusions h5 with techmap dataset.
agg_dset (str, optional) – Powerrose dataset to aggreate, by default ‘powerrose_100m’
tm_dset (str, optional) – Dataset name in the techmap file containing the exclusions-to-resource mapping data, by default ‘techmap_wtk’
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 128
excl_area (float | None) – Area of an exclusion pixel in km2. None will try to infer the area from the profile transform attribute in excl_fpath.
Methods
aggregate
(h5_fpath[, agg_method, ...])Aggregate with given agg_method
prominent_directions
([max_workers, ...])Aggregate power rose data to supply curve points, find all neighboring supply curve points, sort neighbors in order of prominent powerrose directions
run
(power_rose_h5_fpath, excl_fpath[, ...])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
DIR_ORDER
1D array of supply curve point gids to aggregate
Get the shape of the full exclusions raster.
- prominent_directions(max_workers=None, sites_per_worker=1000)[source]
Aggregate power rose data to supply curve points, find all neighboring supply curve points, sort neighbors in order of prominent powerrose directions
- Parameters:
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
- Returns:
sc_pr (pandas.DataFrame) – Update meta data table with neighboring supply curve point gids and power-rose value at each cardinal direction
- classmethod run(power_rose_h5_fpath, excl_fpath, agg_dset='powerrose_100m', tm_dset='techmap_wtk', 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:
power_rose_h5_fpath (str) – Filepath to .h5 file containing power rose data, of same format as WTK data with directions on axis 0 (rows) and sites on axis 1 (columns)
excl_fpath (str) – Filepath to exclusions h5 with techmap dataset.
agg_dset (str, optional) – Powerrose dataset to aggreate, by default ‘powerrose_100m’
tm_dset (str, optional) – Dataset name in the techmap file containing the exclusions-to-resource mapping data, by default ‘techmap_wtk’
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 128
excl_area (float | None) – Area of an exclusion pixel in km2. None will try to infer the area from the profile transform attribute in excl_fpath.
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 .csv file to save output table to
- Returns:
sc_pr (pandas.DataFrame) – Update meta data table with neighboring supply curve point gids and power-rose value at each cardinal direction
- aggregate(h5_fpath, agg_method='mean', max_workers=None, sites_per_worker=100)
Aggregate with given agg_method
- Parameters:
h5_fpath (str) – Filepath to .h5 file to aggregate
agg_method (str, optional) – Aggregation method, either mean or sum/aggregate, by default “mean”
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 (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
- classmethod run_serial(excl_fpath, h5_fpath, tm_dset, *agg_dset, agg_method='mean', excl_dict=None, inclusion_mask=None, area_filter_kernel='queen', min_area=None, resolution=64, excl_area=0.0081, gids=None, gen_index=None)
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.
agg_dset (str) – Dataset to aggreate, can supply multiple datasets. The datasets should be scalar values for each site. This method cannot aggregate timeseries data.
agg_method (str, optional) – Aggregation method, either mean or sum/aggregate, by default “mean”
excl_dict (dict | None) – Dictionary of exclusion keyword arugments of the format {layer_dset_name: {kwarg: value}} where layer_dset_name is a dataset in the exclusion h5 file and kwarg is a keyword argument to the reV.supply_curve.exclusions.LayerMask class. by default None
inclusion_mask (np.ndarray, optional) – 2D array pre-extracted inclusion mask where 1 is included and 0 is excluded. This must be either match the full exclusion shape or be a list of single-sc-point exclusion masks corresponding to the gids input, 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 supply curve point 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
- 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