pvlib.iotools.parse_psm3#

pvlib.iotools.parse_psm3(fbuf, map_variables=True)[source]#

Parse an NSRDB PSM3 weather file (formatted as SAM CSV). The NSRDB is described in [1] and the SAM CSV format is described in [2].

Changed in version 0.9.0: The function now returns a tuple where the first element is a dataframe and the second element is a dictionary containing metadata. Previous versions of this function had the return values switched.

Parameters:
  • fbuf (file-like object) – File-like object containing data to read.

  • map_variables (bool, default True) – When true, renames columns of the Dataframe to pvlib variable names where applicable. See variable VARIABLE_MAP.

Returns:

  • data (pandas.DataFrame) – timeseries data from NREL PSM3

  • metadata (dict) – metadata from NREL PSM3 about the record, see notes for fields

Notes

The return is a tuple with two items. The first item is a dataframe with the PSM3 timeseries data.

The second item is a dictionary with metadata from NREL PSM3 about the record containing the following fields:

  • Source

  • Location ID

  • City

  • State

  • Country

  • Latitude

  • Longitude

  • Time Zone

  • Elevation

  • Local Time Zone

  • Clearsky DHI Units

  • Clearsky DNI Units

  • Clearsky GHI Units

  • Dew Point Units

  • DHI Units

  • DNI Units

  • GHI Units

  • Solar Zenith Angle Units

  • Temperature Units

  • Pressure Units

  • Relative Humidity Units

  • Precipitable Water Units

  • Wind Direction Units

  • Wind Speed Units

  • Cloud Type -15

  • Cloud Type 0

  • Cloud Type 1

  • Cloud Type 2

  • Cloud Type 3

  • Cloud Type 4

  • Cloud Type 5

  • Cloud Type 6

  • Cloud Type 7

  • Cloud Type 8

  • Cloud Type 9

  • Cloud Type 10

  • Cloud Type 11

  • Cloud Type 12

  • Fill Flag 0

  • Fill Flag 1

  • Fill Flag 2

  • Fill Flag 3

  • Fill Flag 4

  • Fill Flag 5

  • Surface Albedo Units

  • Version

Examples

>>> # Read a local PSM3 file:
>>> with open(filename, 'r') as f:  
...     df, metadata = iotools.parse_psm3(f)  

References