pvlib.iotools.read_crn#

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

Read a NOAA USCRN fixed-width file into a pandas dataframe.

The CRN network consists of over 100 meteorological stations covering the U.S. and is described in 1 and 2. The primary goal of CRN is to provide long-term measurements of temperature, precipitation, and soil moisture and temperature. Additionally, global horizontal irradiance (GHI) is measured at each site using a photodiode pyranometer.

Parameters
  • filename (str, path object, or file-like) – filepath or url to read for the fixed-width file.

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

Returns

data (Dataframe) – A dataframe with DatetimeIndex and all of the variables in the file.

Notes

CRN files contain 5 minute averages labeled by the interval ending time. Here, missing data is flagged as NaN, rather than the lowest possible integer for a field (e.g. -999 or -99). Air temperature is in deg C and wind speed is in m/s at a height of 1.5 m above ground level.

Variables corresponding to standard pvlib variables are by default renamed, e.g. SOLAR_RADIATION becomes ghi. See the pvlib.iotools.crn.VARIABLE_MAP dict for the complete mapping.

CRN files occasionally have a set of null characters on a line instead of valid data. This function drops those lines. Sometimes these null characters appear on a line of their own and sometimes they occur on the same line as valid data. In the latter case, the valid data will not be returned. Users may manually remove the null characters and reparse the file if they need that line.

References

1

U.S. Climate Reference Network https://www.ncdc.noaa.gov/crn/qcdatasets.html

2

Diamond, H. J. et. al., 2013: U.S. Climate Reference Network after one decade of operations: status and assessment. Bull. Amer. Meteor. Soc., 94, 489-498. DOI: 10.1175/BAMS-D-12-00170.1