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

getData function not working #191

Closed
seandres11 opened this issue Jan 28, 2021 · 11 comments
Closed

getData function not working #191

seandres11 opened this issue Jan 28, 2021 · 11 comments

Comments

@seandres11
Copy link

Hi!

I am having issues downloading worldclim data through the raster package.

See code below for error message, and let me know if I can provide any other information to help!

r<-getData('CMIP5', var='bio', res=2.5, rcp=85, model="CN" , year=70, lon=151.0034, lat=-33.8136, download=TRUE)
trying URL 'https://biogeo.ucdavis.edu/data/climate/cmip5/2_5m/cn85bi70.zip'
Content type 'application/zip' length 183455516 bytes (175.0 MB)

downloaded 8.1 MB

Error in utils::download.file(url = aurl, destfile = fn, method = "auto", :
download from 'https://biogeo.ucdavis.edu/data/climate/cmip5/2_5m/cn85bi70.zip' failed
In addition: Warning messages:
1: In utils::download.file(url = aurl, destfile = fn, method = "auto", :
downloaded length 8454144 != reported length 183455516
2: In utils::download.file(url = aurl, destfile = fn, method = "auto", :
URL 'https://data.biogeo.ucdavis.edu/data/climate/cmip5/2_5m/cn85bi70.zip': Timeout of 60 seconds was reached

@rhijmans
Copy link
Member

rhijmans commented Apr 7, 2021

This works for me, so this was probably a temporary glitch (the webserver not working well).

@rhijmans rhijmans closed this as completed Apr 7, 2021
@KaraLayton
Copy link

I'm having this same problem now, but haven't had this problem in the past. Just wondering if this is a server issue or if there's another way to fix this? Thanks!

@seandres11
Copy link
Author

seandres11 commented Apr 27, 2021 via email

@KaraLayton
Copy link

Thanks Sam! I tried installing the newest version of R and still having the issue. If you don't mind me asking, which mirror are you using? I don't see an option for a Mac mirror specifically.

@seandres11
Copy link
Author

seandres11 commented Apr 28, 2021 via email

@rlfrench
Copy link

I've been encountering the same issue for the past two days. Like others who have posted in this thread, I've used the getData function many times (most recently in March) and have never encountered this problem before!

Each time, I've tried running getData as follows:

bioclimdat <- raster::getData(name = "worldclim", var = "bio", res = 2.5)

and every time, I get this message (although the size of the "downloaded" file has ranged from 89.5 - 109.3 MB across my 5 or 6 unsuccessful attempts):

trying URL 'https://biogeo.ucdavis.edu/data/climate/worldclim/1_4/grid/cur/bio_2-5m_bil.zip'
Content type 'application/zip' length 129319755 bytes (123.3 MB)
====================================
downloaded 89.5 MB

Error in utils::download.file(url = aurl, destfile = fn, method = "auto",  : 
  download from 'https://biogeo.ucdavis.edu/data/climate/worldclim/1_4/grid/cur/bio_2-5m_bil.zip' failed
In addition: Warning messages:
1: In utils::download.file(url = aurl, destfile = fn, method = "auto",  :
  downloaded length 93880320 != reported length 129319755
2: In utils::download.file(url = aurl, destfile = fn, method = "auto",  :
  URL 'https://data.biogeo.ucdavis.edu/data/climate/worldclim/1_4/grid/cur/bio_2-5m_bil.zip': Timeout of 60 seconds was reached

I have access to .bil and .hdr files for each of the 19 bioclimatic variables from my last successful getData run in March. Is there a way of using those files to create a raster stack while the webserver is down/malfunctioning (if that is the source of the issue)?

@marcoplebani85
Copy link

I've been encountering the same issue for the past two days. Like others who have posted in this thread, I've used the getData function many times (most recently in March) and have never encountered this problem before!

Each time, I've tried running getData as follows:

bioclimdat <- raster::getData(name = "worldclim", var = "bio", res = 2.5)

and every time, I get this message (although the size of the "downloaded" file has ranged from 89.5 - 109.3 MB across my 5 or 6 unsuccessful attempts):

trying URL 'https://biogeo.ucdavis.edu/data/climate/worldclim/1_4/grid/cur/bio_2-5m_bil.zip'
Content type 'application/zip' length 129319755 bytes (123.3 MB)
====================================
downloaded 89.5 MB

Error in utils::download.file(url = aurl, destfile = fn, method = "auto",  : 
  download from 'https://biogeo.ucdavis.edu/data/climate/worldclim/1_4/grid/cur/bio_2-5m_bil.zip' failed
In addition: Warning messages:
1: In utils::download.file(url = aurl, destfile = fn, method = "auto",  :
  downloaded length 93880320 != reported length 129319755
2: In utils::download.file(url = aurl, destfile = fn, method = "auto",  :
  URL 'https://data.biogeo.ucdavis.edu/data/climate/worldclim/1_4/grid/cur/bio_2-5m_bil.zip': Timeout of 60 seconds was reached

I have access to .bil and .hdr files for each of the 19 bioclimatic variables from my last successful getData run in March. Is there a way of using those files to create a raster stack while the webserver is down/malfunctioning (if that is the source of the issue)?

I'm having the same problem.
I'm using raster version 3.4-13 on:
R version 4.1.1 (2021-08-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.5

Example: getData() cannot access https://biogeo.ucdavis.edu/data/climate/worldclim/1_4/tiles/cur/tmin_23.zip.

I could download the zip file, but it contains 12 .bil files and 12 .hdr files, and I have no idea of what to use. How to fix this? Is there a way to load worldclim data into R from local files? If so, how?

@rhijmans
Copy link
Member

rhijmans commented Oct 7, 2021

perhaps you need to increase the timeout setting before using getData. Something like this:

options(timeout = 600)

@marcoplebani85
Copy link

Hello @rhijmans thank you for the tip. I did not know about it and it might come in handy some other time. Upon closer inspection, my problem is not the same as @rlfrench had though. I should have been more thorough, my bad. Here is my code and error message:

raster::getData('worldclim', var='tmin', res=0.5, lon = -88.35507, lat = 17.19497)

trying URL 'https://biogeo.ucdavis.edu/data/climate/worldclim/1_4/tiles/cur/tmin_23.zip'
Error in utils::download.file(url = aurl, destfile = fn, method = "auto",  : 
  cannot open URL 'https://biogeo.ucdavis.edu/data/climate/worldclim/1_4/tiles/cur/tmin_23.zip'
In addition: Warning message:
In utils::download.file(url = aurl, destfile = fn, method = "auto",  :
  URL 'https://biogeo.ucdavis.edu/data/climate/worldclim/1_4/tiles/cur/tmin_23.zip': status was 'Peer certificate cannot be authenticated with given CA certificates'

@rhijmans
Copy link
Member

rhijmans commented Oct 7, 2021

Hi @marcoplebani85
The error message Peer certificate cannot be authenticated with given CA certificates would seem to be related to your system.
It works for me on a similar macOS. Can you try on another computer?
To create a RasterStack from the files, you can do stack(filenames)

@rhijmans rhijmans mentioned this issue Oct 8, 2021
@marcoplebani85
Copy link

marcoplebani85 commented Oct 8, 2021

Hello,

sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.5

I don't think their server is the issue because I can download the data by opening the link that getData can't access using my browser. Good to know about stack(), thanks. I managed to download worldclim files on my computer via my browser, then I got getData() to load them into R. First I unzipped them, took them out of their folders, and put them in a new folder called "wc0.5" in my work directory. Then I run raster::getData('worldclim', var='tmin', res=0.5, lon = -88.35507, lat = 17.19497, download=F). Cheers!

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

5 participants