Added error handling

error was due to the case where daily minimum equaled daily maximum
(hence also mean) which caused problems. In this case repeating the
mean for the 24 hours seem fine