-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Observation.weather.reference_time() is not consistent across queries. #361
Comments
Hello @julj the This means that if that measurement is the only available one during your This of course depends on how frequently the measurements change for the place you're asking for So, in conclusion: PyOWM always returns the |
Hi, there seems to be 2 different issues. A difference between the dt from a call with your module VS directly to the API:
And, when called from within a Docker container, some weird dt variations from both (I'll investigate that):
|
Ok this deserves further investigation |
@julj Long answer, take time to read ISSUE N.2 (DOCKER)This is very likely tied to how Docker containers time systems work - they were known to have jitters with respect to the host machine's timeframe ISSUE N.1 (PYOWM vs OWM API TIME DRIFT)Spoiler: I don't have an explanation for that. But I've been able to come up with some further evidence. I've modified your original code so that the call you make with r = requests.get(f'https://api.openweathermap.org/data/2.5/weather',
verify=True, stream=True,
params={'APPID': OWM_KEY, 'lang': 'en', 'id': 3143244})
pyowm reference_time : 1609250868
owm dt : 1609250868
pyowm reference_time : 1609250868
owm dt : 1609250868
pyowm reference_time : 1609250868
owm dt : 1609250868
pyowm reference_time : 1609250868
owm dt : 1609250868
pyowm reference_time : 1609250868
owm dt : 1609250868 It basically seems like that the Provided that PyOWM provides the timestamp value as provided by the API (no rounding is performed), I have NO IDEA why this happens. It is worth to note that the params for the PyOWM GET request depend on PyOWM configuration (eg. proxies, language, etc.) Any thoughts? |
But those timestamps are from the API, not from the system clock, right ?
Not really, I don't see why the parameters you set in the request, verify or stream, would change the response. I don't have much time to investigate, but if I come up with any idea I will let you know here. Thank you for your help ! |
When running successive call to mgr.weather_at_id (and other requests) I get inconsistent results (see below).
Using directly the OWM API, the 'dt' value changes only every few minutes...
The text was updated successfully, but these errors were encountered: