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

Limited output of climatology data before error occurred #57

Closed
camwur opened this issue Aug 30, 2021 · 5 comments
Closed

Limited output of climatology data before error occurred #57

camwur opened this issue Aug 30, 2021 · 5 comments
Milestone

Comments

@camwur
Copy link

camwur commented Aug 30, 2021

Describe the bug
When I try and apply the nasapower::get_power function to get climatology data with more than 31 latitude/latitude coordinates I receive an error when it is used with the map2 function. Is there a limit to the number of rows of climatology data I can download, or is there an error in my code? On the NASA website I was not able to see if there is a download limit. I have thousands of locations to do this for so any help would be much appreciated!

Code to Reproduce
library("nasapower")
get_power_location <- function(lon,lat) {
nasapower::get_power(
community = "ag",
lonlat = c(lon, lat),
site_elevation = NULL,
wind_elevation = NULL,
wind_surface = NULL,
pars = c("RH2M", "T2M"),
temporal_api = "climatology"
)
}
lon <- c(1:32)
lat <- c(1:32)
A <- purrr::map2( lon,lat,get_power_location)

Error: Something went wrong with the query, no data were returned. Please see https://power.larc.nasa.gov for potential server issues.

Expected behaviour
I expected to receive climatology data for the 31 latitude/longitude coordinates, but received an error instead. When I apply the same code for 30 latitude/longitude coordinates no error arises. This gave me the impression the API has a limit to the number of rows one can download.

OS and R versions:

  • OS: Windows 10 x64
  • R Version 4.1.0
@adamhsparks
Copy link
Member

adamhsparks commented Aug 30, 2021

If it works with 30 coordinates but not 31, this seems that it's an API issue, not a client issue. I'm sorry, I'm not sure what I can do for you? The client seems to work as I intended it to. This is something to ask of the POWER team, I think. They have information on how to mirror the database, which sounds like it's better for your needs than using this client.

@camwur
Copy link
Author

camwur commented Aug 30, 2021

Thanks very much for your prompt reply! I will contact the POWER team.

@camwur
Copy link
Author

camwur commented Aug 30, 2021

FYI, below is the reply from the POWER team:

The POWER API has a limit of 30 request per minute on the climatology endpoint. I would recommend slowing your API requests.

In the future, we will be increasing the requests per minute but currently to enable access for all users we have that limit set.

Thank you,

The NASA POWER Team

@adamhsparks
Copy link
Member

Thanks. I can easily add this to the docs.

@adamhsparks adamhsparks added this to the v4.0.1 milestone Sep 1, 2021
@adamhsparks
Copy link
Member

adamhsparks commented Sep 1, 2021

Coming back to this, I did better than just document it. I have a version in development now that respects the API's limits.

09c80c7

I've implemented a test that uses your example, which passes, indicating that the rate-limiting I've put in place works properly.

So thank you for raising this. I'll include it in the v4.0.1 release.

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

2 participants