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

az_heat only returns data to date - 2 #63

Closed
Tracked by #1782
jeremylweiss opened this issue Oct 31, 2023 · 3 comments · Fixed by #64
Closed
Tracked by #1782

az_heat only returns data to date - 2 #63

jeremylweiss opened this issue Oct 31, 2023 · 3 comments · Fixed by #64
Assignees

Comments

@jeremylweiss
Copy link
Member

It should return data to date - 1. I suspect it involves code in parse_params.R that builds the URL of the data request for the API.

For example, at present

az_heat("az07", start_date = "2023-10-29", end_date = "2023-10-30")

returns a tbl_df with tbl_df$datetime_last = "2023-10-29"

So, it effectively builds a URL of:
https://api.azmet.arizona.edu/v1/observations/hueto/az07/2023-10-29T00:00/P1DT0H
when we'd want this, instead:
https://api.azmet.arizona.edu/v1/observations/hueto/az07/2023-10-29T00:00/P1DT24H

The URL:
https://api.azmet.arizona.edu/v1/observations/hueto/az07/2023-10-29T00:00/P1D
which I think is what the code actually builds, returns the same data as the former URL, above. Do we need to specify "T0H" at the end of the currently constructed URL?

Note: I'm looking at code from the date-input-flex branch.

@Aariq
Copy link
Member

Aariq commented Nov 1, 2023

It doesn't appeary to have anything to do with whether time is specified or not. P2D also gets data with "2023-10-30" for datetime_last. I think this is more likely a quirk with how dates are interpreted by the API. I'll do a little investigating and open a PR with a proposed fix.

@Aariq Aariq self-assigned this Nov 1, 2023
@Aariq
Copy link
Member

Aariq commented Nov 1, 2023

I think we can fix this by always rounding the end date up to 00:00 of the next day.

Aariq added a commit that referenced this issue Nov 2, 2023
@Aariq Aariq linked a pull request Dec 11, 2023 that will close this issue
@Aariq
Copy link
Member

Aariq commented Dec 12, 2023

I think this was technically fixed by #62 but #64 adds tests for this.

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

Successfully merging a pull request may close this issue.

2 participants