PhenoCamNetwork / phenocamapi

An R Interface to PhenoCam API
https://phenocam.nau.edu/api
GNU Affero General Public License v3.0
6 stars 7 forks source link

get_midday_list fails, with direct = TRUE and direct = FALSE #1

Closed kevstyers closed 4 years ago

kevstyers commented 4 years ago

Hello,

I am trying to grab yesterday's midday photos for all NEON sites. Some sites fail regularly and it appears that both direct and indirect pull methods fail. Here's a sample of the code I am using

phenocamapi::get_midday_list(site = "NEON.D06.KONA.DP1.00033",direct = TRUE)

error message for direct = TRUE: "Error in file(con, "r") : cannot open the connection In addition: Warning message: In file(con, "r") : InternetOpenUrl failed: 'The operation timed out'"

error message for direct = FALSE: "Warning message: In phenocamapi::get_midday_list(site = "NEON.D06.KONA.DP1.00033", direct = FALSE) : midday list file was not found on the Phenocam server!"

bbcrown commented 4 years ago

Thanks for the post. Make sure your internet is not blocking the phenocam server. I just tried the code you pasted and it worked as expected. The error was not reproduced. Not sure why you got an error.

Another alternative to latest images for each site is to use the following link, where you replace SITE_NAME with each site's name: https://phenocam.sr.unh.edu/data/latest/[SITE_NAME].jpg

kevstyers commented 4 years ago

Hmm, I'm not sure what the issue with my internet is. I am able to ping the server successfully.

At any rate the alternative you suggested worked very well!

for(i in NeonPhenoCamList){
  base::download.file(url = base::paste0("https://phenocam.sr.unh.edu/data/latest/",i ,".jpg"),
                destfile = base::paste0("X:/1_Data/phenoCam/",i,".jpg"), mode = "wb")
}

Thanks for all your work with the phenocamapi !