You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There may be in issue with how the timestamps are handled in this library. I have reached out to MSW for additional information. Some questions that should be answered:
When querying the API, should the timestamps provided to the start and end URL parameters be in the user's local time or in UTC?
localTimestamp is described in the docs as Unix timestamp adjusted to represent local time for this location. Should this be converted to a Python datetime object as datetime.fromtimestamp() or datetime.utcfromtimestamp().
issueTimestamp is described as in the docs as GMT unix time for the start of this forecast. Although we call it the ‘issue’ time it’ll always actually become available after this time because we need to create or obtain the model data and prepare it for delivery. Is this referring to the time when the forecast was made?
Observations
Example query with start and end parameters set to datetime.now().timestamp() (1533770006.53376) returned:
I came across the same issue with localTimestamp when working with the MSW api directly. In particular, when daylight savings is applicable, the timestamp intervals in localTimestamp (when converted using datetime.fromTimestamp()) returned 01:00, 04:00, 07:00, etc. instead of 00:00, 03:00, 06:00. When I use datetime.utcfromtimestamp() instead, the intervals return as expected i.e. 00:00, 03:00, 06:00, etc. Sounds like your theory is right. Thanks for the pointer!
Issue
There may be in issue with how the timestamps are handled in this library. I have reached out to MSW for additional information. Some questions that should be answered:
start
andend
URL parameters be in the user's local time or in UTC?localTimestamp
is described in the docs asUnix timestamp adjusted to represent local time for this location.
Should this be converted to a Python datetime object as datetime.fromtimestamp() or datetime.utcfromtimestamp().issueTimestamp
is described as in the docs asGMT unix time for the start of this forecast. Although we call it the ‘issue’ time it’ll always actually become available after this time because we need to create or obtain the model data and prepare it for delivery.
Is this referring to the time when the forecast was made?Observations
start
andend
parameters set todatetime.now().timestamp()
(1533770006.53376) returned:localTimestamp
to a datetime object produced these results:issueTimestamp
to a datetime object produced these results:Theory
localTimestamp
should usedatetime.utcfromtimestamp()
issueTimestamp
should usedatetime.fromTimestamp()
The text was updated successfully, but these errors were encountered: