RemkoDuursma / speciesmap

Species Occurrences and Climate Data
http://remkoduursma.github.io/speciesmap
7 stars 2 forks source link

download.file error #9

Closed amandasalvi closed 6 years ago

amandasalvi commented 6 years ago

I'm running into a downloading error when running climate_presence():

climate_presence("Eucalyptus regnans", database = "ALA", vars = c("tmin","tmax","tavg","prec","srad","wind","vapr"), output = c("annual"))

INFO [2018-02-13 14:28:46] ALA returned 5328 records for Eucalyptus regnans in 0.4 sec. INFO [2018-02-13 14:28:52] Rasterized 5328 occurrences into 216 cells

Error in download.file(fn, fn_to, mode = "wb", quiet = TRUE) : cannot download all files In addition: Warning messages: 1: In download.file(fn, fn_to, mode = "wb", quiet = TRUE) : URL http://biogeo.ucdavis.edu/data/worldclim/v2.0/tif/base/wc2.0_10m_tmin.zip: cannot open destfile 'worldclim/wc2.0_10m_tmin.zip', reason 'No such file or directory' 2: In download.file(fn, fn_to, mode = "wb", quiet = TRUE) : downloaded length 0 != reported length 33428903

RemkoDuursma commented 6 years ago

It works fine on this end. Perhaps the Worldclim server was temporarily down, can you check again?

amandasalvi commented 6 years ago

I tried again and this time got the error: Error in get_wcpath() : Set path for WorldClim rasters first, e.g. options(worldclimpath = 'c:/worldclim')

So, input >options(worldclimpath = 'c:/worldclim'), and tried again.

Then got the same error in downloading as I did before

RemkoDuursma commented 6 years ago

Very strange. What happens if you put the URL http://biogeo.ucdavis.edu/data/worldclim/v2.0/tif/base/wc2.0_10m_tmin.zip in a browser?

amandasalvi commented 6 years ago

Hmm when I do that, a zip file successfully downloads to my computer

amandasalvi commented 6 years ago

I figured out the problem. Rather than using setwd() to set where the zip file would be downloaded, I had to do options(worldclimpath = ... )

Also, I needed to install the package rgdal

Now it works! Thanks!