captest.calcparams.apparent_zenith

captest.calcparams.apparent_zenith(data, site=None, altitude_override=0, verbose=True)

Compute apparent solar zenith angle at each timestamp in data.

Wraps pvlib.location.Location.get_solarposition() and returns the apparent_zenith column aligned to data.index. Designed for use inside a CapData.regression_cols calc tuple: site is auto-injected by CapData.custom_param from cd.site.

Per the pvlib First Solar spectral-correction reference, the absolute airmass is computed against zenith at sea level. altitude_override defaults to 0 so a deep copy of site has its loc.altitude forced to 0 before the Location is instantiated. The caller’s site dict is not mutated.

Night-time rows (apparent_zenith > 90) are set to NaN so downstream airmass / spectral-factor calls do not emit pvlib warnings on invalid geometry.

Parameters:
  • data (DataFrame) – DataFrame with a DatetimeIndex. The index may be tz-naive or tz-aware.

  • site (dict) – Nested {"loc": {...}, "sys": {...}} dict as produced by load_data(site=...). Only the loc sub-dict is consumed here. Auto-injected from cd.site by custom_param when used in a regression_cols calc tuple.

  • altitude_override (numeric, default 0) – Altitude (in meters) to use when building the pvlib.Location. Set to None to respect site['loc']['altitude'] unchanged.

  • verbose (bool, default True) – Set to False to suppress the explanatory print message.

Returns:

Apparent zenith angle (degrees) indexed like data.index with a tz-naive index. NaN where the sun is below the horizon.

Return type:

Series