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.
Location can be given by BSRN station code or by explicit lat/lon/elev.
- Parameters:
df (pd.DataFrame) – DataFrame to which columns will be added. Index must be DatetimeIndex.
station_code (str, optional) – BSRN station abbreviation. [e.g. ‘QIQ’] Used if lat/lon/elev not provided.
lat (float, optional) – Latitude. [degrees] Required for non-BSRN stations if station_code omitted.
lon (float, optional) – Longitude. [degrees] Required for non-BSRN stations if station_code omitted.
elev (float, optional) – Elevation. [m] Required for non-BSRN stations if station_code omitted.
- Returns:
df – The input DataFrame with added crs columns.
- Return type:
pd.DataFrame
- Raises:
ValueError – If
df.indexis not aDatetimeIndex.ValueError – If neither a valid station_code nor complete (lat, lon, elev) is provided.