bsrn.io.nsrdb.add_nsrdb_columns#

bsrn.io.nsrdb.add_nsrdb_columns(df, station_code=None, lat=None, lon=None, elev=None, variant='conus')[source]#

Adds NSRDB all-sky columns to a DataFrame. Fetches data from Hugging Face automatically. 向 DataFrame 添加 NSRDB 全天空辐射列。自动从 Hugging Face 获取数据。

Location can be given by BSRN station code or by explicit lat/lon/elev. 位置可由 BSRN 站点代码指定,或由显式的 lat/lon/elev 指定。

Parameters:
  • df (pd.DataFrame) – DataFrame to which columns will be added. Index must be DatetimeIndex. 要添加列的 DataFrame。索引必须是 DatetimeIndex。

  • station_code (str, optional) – BSRN station abbreviation. [e.g. ‘BIL’] Used if lat/lon/elev not provided. BSRN 站点缩写。[例如 ‘BIL’]。未提供 lat/lon/elev 时使用。

  • lat (float, optional) – Latitude. [degrees] Required for non-BSRN stations if station_code omitted. 纬度。[度]。非 BSRN 站点且未提供 station_code 时必填。

  • lon (float, optional) – Longitude. [degrees] Required for non-BSRN stations if station_code omitted. 经度。[度]。非 BSRN 站点且未提供 station_code 时必填。

  • elev (float, optional) – Elevation. [m] Required for non-BSRN stations if station_code omitted. 海拔。[米]。非 BSRN 站点且未提供 station_code 时必填。

  • variant (str, default "conus") – NSRDB variant name: ‘conus’, ‘full-disc’, or ‘aggregated’. NSRDB 变体名称。

Returns:

df – The input DataFrame with added NSRDB columns. 增加了 NSRDB 列的输入 DataFrame。

Return type:

pd.DataFrame

Raises:
  • ValueError – If df.index is not a DatetimeIndex. / 索引非 DatetimeIndex。

  • ValueError – If neither a valid station_code nor complete (lat, lon, elev) is provided. 若既未提供有效 station_code 也未提供完整的 (lat, lon, elev)。