bsrn.io.crs.add_crs_columns#

bsrn.io.crs.add_crs_columns(df, station_code=None, lat=None, lon=None, elev=None)[source]#

Adds CRS (CAMS Radiation Service) all-sky columns to a DataFrame. Fetches data from Hugging Face automatically. 向 DataFrame 添加 CRS (CAMS 辐射服务) 全天空辐射列。自动从 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. ‘QIQ’] Used if lat/lon/elev not provided. BSRN 站点缩写。[例如 ‘QIQ’]。未提供 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 时必填。

Returns:

df – The input DataFrame with added crs columns. 增加了 CRS 列的输入 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)。