pvlib.iotools.read_nsrdb_psm4#

pvlib.iotools.read_nsrdb_psm4(filename, map_variables=True)[source]#

Read an NSRDB PSM4 weather file (formatted as SAM CSV).

The NSRDB is described in [1] and the SAM CSV format is described in [2].

Parameters:
  • filename (str, path-like, or buffer) – Filename or in-memory buffer of a file 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 PSM4

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

Notes

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

The second item is a dictionary with metadata from NREL PSM4 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 PSM4 file:
>>> df, metadata = iotools.read_nsrdb_psm4("data.csv")  
>>> # Read a file object or an in-memory buffer:
>>> with open(filename, 'r') as f:  
...     df, metadata = iotools.read_nsrdb_psm4(f)  

References