Skip to content
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

USGS REST Collector #82

Open
DanRamage opened this issue Jul 6, 2017 · 0 comments
Open

USGS REST Collector #82

DanRamage opened this issue Jul 6, 2017 · 0 comments

Comments

@DanRamage
Copy link

Internally the Usgs collector puts the date/time into UTC, however I do not think the formatted REST request is correct for that type of query. Looking at the documentation on the USGS test service, they define the date formats as such(using the start time as example):

URL argument name is startDT. Use the ISO-8601 date format External Link.
Examples: &startDT=2010-07-01T12:00 (site local time), &startDT=2010-07-01T12:00-05:00 (Eastern Standard Time), &startDT=2010-07-01T12:00Z (Universal Time) or startDT=2010-07-01. If you do not specify an hour, T00:00 for the start date is assumed.

A + timezone offset must be coded as %2B in the URL. The TestTool here will do this automatically for you.
Example: To indicate T15:00+01:00 Use &startdt=2015-05-01T15:00%2B01:00.

With Start Date and End Date you can express an absolute site time period for retrieval. Real time data typically lag 0-4 hours behind the current time. Start Date and End Date values are inclusive. For example, if you specify a Start Date of 2009-06-15T22:15 and a reading is available for this time, it will appear in the results. For multi-site retrievals, only data since October 1, 2007 are available.

In the collector in the setup_params function, I made the following changes and it appears to now return me the date/times I expec, note the "Z" added to the end of the string formating:

        if self.start_time is not None:
            params["startDT"] = self.start_time.strftime('%Y-%m-%dT%H:%MZ')
        if self.end_time is not None:
            params["endDT"] = self.end_time.strftime('%Y-%m-%dT%H:%MZ')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant