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

API Issue with evapotranspiration names between daily and other time intervals #80

Open
bozaah opened this issue Jul 3, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@bozaah
Copy link
Collaborator

bozaah commented Jul 3, 2024

In the DPIRD Weather API swagger page, all time intervals besides "daily" take etoShortCrop and etoTallCrop to source evapotranspiration values (in addition to evapotranspiration which fetches both). The "daily" timeframe only accepts evapotranspirationShortCrop and evapotranspirationTallCrop.

This is not problematic if not querying those variables by name, ie passing them to the values argument of get_dpird_summaries(), but it is an issue when a user passes values = "all" or queries those specific variables.

It gets a bit more complicated as there are internal checks for the variables passed to the values argument (weatherOz throws an error):

get_dpird_summaries(
  station_code = "KA",
  start_date = "20220501",
  end_date = "20220502",
  api_key = Sys.getenv("DPIRD_API_KEY"),
  interval = "daily",
  values = c(
    "rainfall",
    "evapotranspirationShortCrop"
  )
)

Error: You have specified invalid weather values.

And if you pass the short name, the API throws a HTTP 400 error:

get_dpird_summaries(
  station_code = "KA",
  start_date = "20220501",
  end_date = "20220502",
  api_key = Sys.getenv("DPIRD_API_KEY"),
  interval = "daily",
  values = c(
    "rainfall",
    "etoShortCrop"
  )
)

Error: HTTP (400) - Bad Request
Invalid select field specified: etoShortCrop

The opposite is true for the rest of the time intervals. I have reached out to the eConnect team in hope that the daily naming will match the other time intervals.

Perhaps as a temporary fix, I could add evapotranspirationShortCrop and evapotranspirationTallCrop to the dpird_summary_values dataset/vector as etoShortCrop, etoTallCrop are already included.

@bozaah bozaah self-assigned this Jul 3, 2024
@bozaah bozaah added the bug Something isn't working label Jul 3, 2024
@adamhsparks
Copy link
Member

Hmm. I thought we’d dealt with this already or it at least seems familiar. Your fix sounds right at least for now to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants