reV.rep_profiles.rep_profiles.RepProfilesBase

class RepProfilesBase(gen_fpath, rev_summary, reg_cols=None, cf_dset='cf_profile', rep_method='meanoid', err_method='rmse', weight='gid_counts', n_profiles=1)[source]

Bases: ABC

Abstract utility framework for representative profile run classes.

Parameters:
  • gen_fpath (str) – Filepath to reV gen output file to extract “cf_profile” from.

  • rev_summary (str | pd.DataFrame) – Aggregated rev supply curve summary file. Str filepath or full df. Must include “res_gids”, “gen_gids”, and the “weight” column (if weight is not None)

  • reg_cols (str | list | None) – Label(s) for a categorical region column(s) to extract profiles for. e.g. “state” will extract a rep profile for each unique entry in the “state” column in rev_summary.

  • cf_dset (str) – Dataset name to pull generation profiles from.

  • rep_method (str) – Method identifier for calculation of the representative profile.

  • err_method (str | None) – Method identifier for calculation of error from the representative profile (e.g. “rmse”, “mae”, “mbe”). If this is None, the representative meanoid / medianoid profile will be returned directly

  • weight (str | None) – Column in rev_summary used to apply weighted mean to profiles. The supply curve table data in the weight column should have weight values corresponding to the res_gids in the same row.

  • n_profiles (int) – Number of representative profiles to save to fout.

Methods

run()

Abstract method for generic run method.

save_profiles(fout[, save_rev_summary, ...])

Initialize fout and save profiles.

Attributes

meta

Meta data for the representative profiles.

profiles

Get the arrays of representative CF profiles corresponding to meta.

time_index

Get the time index for the rep profiles.

property time_index

Get the time index for the rep profiles.

Returns:

time_index (pd.datetimeindex) – Time index sourced from the reV gen file.

property meta

Meta data for the representative profiles.

Returns:

meta (pd.DataFrame) – Meta data for the representative profiles. At the very least, this has columns for the region and res class.

property profiles

Get the arrays of representative CF profiles corresponding to meta.

Returns:

profiles (dict) – dict of n_profile-keyed arrays with shape (time, n) for the representative profiles for each region.

save_profiles(fout, save_rev_summary=True, scaled_precision=False)[source]

Initialize fout and save profiles.

Parameters:
  • fout (str) – None or filepath to output h5 file.

  • save_rev_summary (bool) – Flag to save full reV SC table to rep profile output.

  • scaled_precision (bool) – Flag to scale cf_profiles by 1000 and save as uint16.

abstract run()[source]

Abstract method for generic run method.