brightwind-dev / brightwind

Python library containing wind analysis functions
MIT License
46 stars 15 forks source link

[_mean_of_monthly_means_seasonal_adjusted] calculation of days in month #423

Open rach185 opened 6 months ago

rach185 commented 6 months ago

The momm function which does seasonal adjustment _mean_of_monthly_means_seasonal_adjusted calculates the day in each month using the pd.DatetimeIndex function called days_in_month. This does not consider that the coverage of that month might not be complete. In the instance where there are time continuity gaps in the series, the total days in the month should be less than the days in the calendar month, i.e. 28/30/31 days. We should make this update so that the momm with seasonal adjustment equals the algebraic mean of the whole data series when there are full years of data.

image
rach185 commented 5 months ago

Test cases:

  1. Use a dataset with full coverage (20-year synthesised timeseries or similar) which HTS can supply, that showed difference in momm versus the arithmetic mean.
  2. Use a dataset with some months which do not have full coverage.