Open vendion opened 4 years ago
According to the documentation it is : 5 day forecast includes weather data every 3 hours
so changing this :
func getForecast5(location, units, lang string) (*owm.Forecast5WeatherData, error) {
w, err := owm.NewForecast("5", units, lang, os.Getenv("OWM_API_KEY"))
if err != nil {
return nil, err
}
w.DailyByName(location, 5)
forecast := w.ForecastWeatherJson.(*owm.Forecast5WeatherData)
return forecast, err
}
to
func getForecast5(location, units, lang string) (*owm.Forecast5WeatherData, error) {
w, err := owm.NewForecast("5", units, lang, os.Getenv("OWM_API_KEY"))
if err != nil {
return nil, err
}
w.DailyByName(location, 99)
forecast := w.ForecastWeatherJson.(*owm.Forecast5WeatherData)
return forecast, err
}
note the 99 , this way there is no limit. since we get 7(or 8?) reports a day * 5 days , so 35 - 40 results.
You could loop over these results and only take the ones at a given timestamp.
so yes naming is a bit confusing but it can do what it has to do
Yes that does indeed work and I meant to add that passing a value other than 5
to DailyByName
and the other similar functions does work, just the naming of that parameter is awkward due to how OWM's API functions.
If this is not a concern then this ticket can be closed.
Using the example provided in the repo requesting forcast data only returns 5 3 hour forcast datapoints rather than 5 days worth of data points.