energy_methods.weather_calibration#

Seasonal station bias correction with explicit temporal and spatial support.

energy_methods.weather_calibration.fit_monthly_bias(pairs, *, year, minimum_days=20)[source]#

Fit monthly additive T/RH bias and multiplicative wind bias on one year.

Pairs contain date, variable, observed, modelled. Temperature represents the daily min/max midpoint on both sides. RH and wind are daily means. Missing pairs are excluded; all twelve months must meet minimum_days for a variable to be supported. No validation-year observations enter fitting.

Parameters:
  • pairs (DataFrame)

  • year (int)

  • minimum_days (int)

Return type:

DataFrame

energy_methods.weather_calibration.spatial_weights(station_xy, target_xy, *, radius_m=75000, neighbours=4)[source]#

IDW weights in a metric CRS, nearest four stations within 75 km.

Zeros mean unsupported. This does not infer terrain representativeness. A 1 km distance floor avoids singularities; targets are processed in rows.

Parameters:
  • station_xy (ndarray)

  • target_xy (ndarray)

  • radius_m (float)

  • neighbours (int)

Return type:

ndarray

energy_methods.weather_calibration.correct_hourly(weather, monthly)[source]#

Apply declared monthly parameters; retain hourly variability and irradiance.

All three variables require twelve finite parameters. T/RH are additive; wind is multiplicative. RH is physically bounded and clipping is counted. This is monthly bias adjustment, not hourly error or extreme calibration.

Parameters:
  • weather (DataFrame)

  • monthly (dict[str, ndarray])

Return type:

DataFrame