2

I am trying to get Solar Radiation data from WorldClim version 2.0 in R, However, I am using the library raster in R but it seems to not be possible to download this data. (since there is only functions for bioclimatic data, Temperature, altitude, and precipitation)

Does anyone know how to download this data from the website using R?

I have specific coordinates. And for my bioclimatic data I have used this code, which worked:

library(raster)
library(sp)

r <- getData("worldclim",var="bio",res=10) 
r <- r[[c(1,12)]]

names(r) <- c("Temp","Prec")

lats <- c(48.45435)
lons <- c(-2.04734)

coords <- data.frame(x=lons,y=lats)
points <- SpatialPoints(coords, proj4string = r@crs)
values <- extract(r,points)
df <- cbind.data.frame(coordinates(points),values)
df

2 Answers 2

2

getData() only downloads tmean, tmin, tmax, prec, bio and alt from WorldClim v1.4. Check lines 252 to 325.

You can download files with utils::download.file() function using WorlClim data URLs, but it will download a full file, not a specific tiles as getData() does.

3
  • Dear Aldo , thank you very much, indeed that was what I was fearing. Following the topic, using download.file, do you know how could I get the tiles and the data for my coordinates? Commented Dec 12, 2017 at 0:23
  • @MaravillasRuiz Data by tiles is only for WorldClim 1.4. I suppose in a future will be available version 2.0 by tile too
    – aldo_tapia
    Commented Dec 12, 2017 at 10:36
  • I have been able to extract the data with ArcGIS and R code, and it seems that I can extract tiles... I have values for my different coordinates. Commented Dec 13, 2017 at 0:14
0
library(geodata)
R_solar <- worldclim_global("srad", 0.5, path=tempdir(), version="2.1")
1
  • 2
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Jun 24, 2023 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.