Data Max/Min average using LBT SDK

Want to get your advice. I want to get the average of the max/min values of some data using the LBT SDK.
For instance the monthly max average of temperatures (taking the daily max values and averaging them per month).
Will appreciate any pointers.

The easiest way to do this is by converting the Hourly data collection to a MonthlyPerHour data collection. The following should do the trick for any hourly data collection data_hourly, even if it is discontinuous or does not have all months of the year:

data_mph = data_hourly.average_monthly_per_hour()
data_by_month= [[] for _ in range(12)]
for v, dt in zip(data_mph.values, data_mph.datetimes):
    data_by_month[dt[0] - 1].append(v)
max_vals = [max(vals) for vals in data_by_month if len(vals) != 0]
1 Like

This is excelent!!
This SDK is powerful.
Thanks @chris

1 Like