Fix a bug that produced negative array indexes in the function that aggregates temperature values