reV.SAM.SAM.SamResourceRetriever

class SamResourceRetriever[source]

Bases: object

Factory utility to get the SAM resource handler.

Methods

get(res_file, project_points, module[, ...])

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

Attributes

RESOURCE_TYPES

classmethod get(res_file, project_points, module, output_request=('cf_mean',), gid_map=None, lr_res_file=None, nn_map=None, bias_correct=None)[source]

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

Parameters:
  • res_file (str) – Single resource file (with full path) to retrieve.

  • project_points (reV.config.ProjectPoints) – reV Project Points instance used to retrieve resource data at a specific set of sites.

  • module (str) – SAM module name or reV technology to force interpretation of the resource file type. Example: module set to ‘pvwatts’ or ‘tcsmolten’ means that this expects a SolarResource file. If ‘nsrdb’ is in the res_file name, the NSRDB handler will be used.

  • output_request (list | tuple, optional) – Outputs to retrieve from SAM, by default (‘cf_mean’, )

  • gid_map (None | dict) – Mapping of unique integer generation gids (keys) to single integer resource gids (values). This enables the user to input unique generation gids in the project points that map to non-unique resource gids. This can be None or a pre-extracted dict.

  • lr_res_file (str | None) – Optional low resolution resource file that will be dynamically mapped+interpolated to the nominal-resolution res_file. This needs to be of the same format as resource_file, e.g. they both need to be handled by the same rex Resource handler such as WindResource

  • nn_map (np.ndarray) – Optional 1D array of nearest neighbor mappings associated with the res_file to lr_res_file spatial mapping. For details on this argument, see the rex.MultiResolutionResource docstring.

  • bias_correct (None | pd.DataFrame) – Optional DataFrame or CSV filepath to a wind or solar resource bias correction table. This has columns:

    • gid: GID of site (can be index name of dataframe)

    • method: function name from rex.bias_correction module

    The gid field should match the true resource gid regardless of the optional gid_map input. Only windspeed or GHI + DNI + DHI are corrected, depending on the technology (wind for the former, PV or CSP for the latter). See the functions in the rex.bias_correction module for available inputs for method. Any additional kwargs required for the requested method can be input as additional columns in the bias_correct table e.g., for linear bias correction functions you can include scalar and adder inputs as columns in the bias_correct table on a site-by-site basis. If None, no corrections are applied. By default, None.

Returns:

res (reV.resource.SAMResource) – Resource iterator object to pass to SAM.