reV.SAM.SAM.RevPySam

class RevPySam(meta, sam_sys_inputs, output_request, site_sys_inputs=None)[source]

Bases: Sam

Base class for reV-SAM simulations (generation and econ).

Initialize a SAM object.

Parameters:
  • meta (pd.DataFrame | pd.Series | None) – Meta data corresponding to the resource input for the single location. Should include values for latitude, longitude, elevation, and timezone. Can be None for econ runs.

  • sam_sys_inputs (dict) – Site-agnostic SAM system model inputs arguments.

  • output_request (list) – Requested SAM outputs (e.g., ‘cf_mean’, ‘annual_energy’, ‘cf_profile’, ‘gen_profile’, ‘energy_yield’, ‘ppa_price’, ‘lcoe_fcr’).

  • site_sys_inputs (dict) – Optional set of site-specific SAM system inputs to complement the site-agnostic inputs.

Methods

assign_inputs()

Assign the self.sam_sys_inputs attribute to the PySAM object.

collect_outputs(output_lookup)

Collect SAM output_request, convert timeseries outputs to UTC, and save outputs to self.outputs property.

default()

Get the executed default pysam object.

drop_leap(resource)

Drop Feb 29th from resource df with time index.

ensure_res_len(arr, time_index)

Ensure time_index has a constant time-step and only covers 365 days (no leap days).

execute()

Call the PySAM execute method.

get_sam_res(*args, **kwargs)

Get the SAM resource iterator object (single year, single file).

get_time_interval(time_index)

Get the time interval.

make_datetime(series)

Ensure that pd series is a datetime series with dt accessor

outputs_to_utc_arr()

Convert array-like SAM outputs to UTC np.ndarrays

Attributes

DIR

IGNORE_ATTRS

MODULE

attr_dict

Get the heirarchical PySAM object attribute dictionary.

input_list

Get the list of lowest level input attribute/variable names.

meta

Get meta data property.

module

Get module property.

pysam

Get the pysam object.

site

Get the site number for this SAM simulation.

property meta

Get meta data property.

property module

Get module property.

property site

Get the site number for this SAM simulation.

static get_sam_res(*args, **kwargs)[source]

Get the SAM resource iterator object (single year, single file).

static drop_leap(resource)[source]

Drop Feb 29th from resource df with time index.

Parameters:

resource (pd.DataFrame) – Resource dataframe with an index containing a pandas time index object with month and day attributes.

Returns:

resource (pd.DataFrame) – Resource dataframe with all February 29th timesteps removed.

static ensure_res_len(arr, time_index)[source]

Ensure time_index has a constant time-step and only covers 365 days (no leap days). If not remove last day

Parameters:
  • arr (ndarray) – Array to truncate if time_index has a leap day

  • time_index (pandas.DatatimeIndex) – Time index associated with arr, used to check time-series frequency and number of days

Returns:

arr (ndarray) – Truncated array of data such that there are 365 days

static make_datetime(series)[source]

Ensure that pd series is a datetime series with dt accessor

classmethod get_time_interval(time_index)[source]

Get the time interval.

Parameters:

time_index (pd.series) – Datetime series. Must have a dt attribute to access datetime properties (added using make_datetime method).

Returns:

time_interval (int:) – This value is the number of indices over which an hour is counted. So if the timestep is 0.5 hours, time_interval is 2.

outputs_to_utc_arr()[source]

Convert array-like SAM outputs to UTC np.ndarrays

collect_outputs(output_lookup)[source]

Collect SAM output_request, convert timeseries outputs to UTC, and save outputs to self.outputs property.

Parameters:

output_lookup (dict) – Lookup dictionary mapping output keys to special output methods.

assign_inputs()[source]

Assign the self.sam_sys_inputs attribute to the PySAM object.

PYSAM = <module 'PySAM.GenericSystem' from '/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/PySAM/GenericSystem.cpython-38-x86_64-linux-gnu.so'>
property attr_dict

Get the heirarchical PySAM object attribute dictionary.

Returns:

_attr_dict (dict) –

Dictionary with:

keys: variable groups values: lowest level attribute/variable names

classmethod default()

Get the executed default pysam object.

Returns:

PySAM.GenericSystem

execute()[source]

Call the PySAM execute method. Raise SAMExecutionError if error. Include the site index if available.

property input_list

Get the list of lowest level input attribute/variable names.

Returns:

_inputs (list) – List of lowest level input attributes.

property pysam

Get the pysam object.