worldclim() downloads the WorldClim V2.1 climate data for 1970–2000. This includes monthly climate data for minimum, mean, and maximum temperature and precipitation at a resolution of 0.5 minutes of a degree. This function uses the geodata to download the worldclim tiles.

worldclim(output_dir, location, var = "all", ...)

Arguments

output_dir

Character (e.g., "../Desktop/chelsa"). Pathway to where the data will be stored.

location

A "sp", "sf" polygon or point object. See sf::st_polygon to make polygons and sf::st_as_sf to make point objects.

var, ...

Arguments to download.file() to control file download. .

Value

worldclim() is called for its side effects and returns NULL. Creates four subfolders named prec, tmax, tmin and tmean. Each folder contains 12 GeoTiff (.tif) files, one for each month of the year for the time period 1970–2000. Each of the files are downloaded at a spatial resolution of 0.5 minutes of a degree. The precipitation folder contains average monthly precipitation (mm). The tmax folder contains maximum monthly temperature. The tmin folder contains minimum monthly temperature. The tmean folder contains the average monthly temperature. Temperature values are reported in °C.

References

Fick, S.E. & Hijmans, R.J. (2017). WorldClim 2: new 1km spatial resolution climate surfaces for global land areas. International Journal of Climatology. 37, 4302–4315. doi:10.1002/joc.5086

See also

Downloading from CHELSA chelsa() or a more convenient function for downloading other climate and elevation data ce_download().

Author

James L. Tsakalos and Martin R. Smith

Examples

# \donttest{
# Download time will depend on the size of the area you wish to access
# climate data for and your internet connection speed.

# Make a polygon file
regents <- sf::st_polygon(
  list(
    cbind(
      "lon" = c(51.537, 51.525, 51.523, 51.530, 51.534, 51.537),
      "lat" = c(-0.150, -0.145, -0.156, -0.167, -0.163, -0.150)
    )
  )
)

# Create temporary file
temp_path <- tempfile()

# Download the WorldClim data
worldclim(
  output_dir = temp_path,
  location = regents
)
#> "Writing to: /tmp/RtmpDLXUpX/file37e253ffed91"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/prec/wc2.1_30s_prec_01.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/prec/wc2.1_30s_prec_02.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/prec/wc2.1_30s_prec_03.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/prec/wc2.1_30s_prec_04.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/prec/wc2.1_30s_prec_05.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/prec/wc2.1_30s_prec_06.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/prec/wc2.1_30s_prec_07.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/prec/wc2.1_30s_prec_08.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/prec/wc2.1_30s_prec_09.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/prec/wc2.1_30s_prec_10.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/prec/wc2.1_30s_prec_11.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/prec/wc2.1_30s_prec_12.tif"
#> "Writing to: /tmp/RtmpDLXUpX/file37e253ffed91"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmax/wc2.1_30s_tmax_01.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmax/wc2.1_30s_tmax_02.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmax/wc2.1_30s_tmax_03.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmax/wc2.1_30s_tmax_04.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmax/wc2.1_30s_tmax_05.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmax/wc2.1_30s_tmax_06.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmax/wc2.1_30s_tmax_07.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmax/wc2.1_30s_tmax_08.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmax/wc2.1_30s_tmax_09.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmax/wc2.1_30s_tmax_10.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmax/wc2.1_30s_tmax_11.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmax/wc2.1_30s_tmax_12.tif"
#> "Writing to: /tmp/RtmpDLXUpX/file37e253ffed91"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmin/wc2.1_30s_tmin_01.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmin/wc2.1_30s_tmin_02.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmin/wc2.1_30s_tmin_03.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmin/wc2.1_30s_tmin_04.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmin/wc2.1_30s_tmin_05.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmin/wc2.1_30s_tmin_06.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmin/wc2.1_30s_tmin_07.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmin/wc2.1_30s_tmin_08.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmin/wc2.1_30s_tmin_09.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmin/wc2.1_30s_tmin_10.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmin/wc2.1_30s_tmin_11.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tmin/wc2.1_30s_tmin_12.tif"
#> "Writing to: /tmp/RtmpDLXUpX/file37e253ffed91"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tavg/wc2.1_30s_tavg_01.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tavg/wc2.1_30s_tavg_02.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tavg/wc2.1_30s_tavg_03.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tavg/wc2.1_30s_tavg_04.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tavg/wc2.1_30s_tavg_05.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tavg/wc2.1_30s_tavg_06.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tavg/wc2.1_30s_tavg_07.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tavg/wc2.1_30s_tavg_08.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tavg/wc2.1_30s_tavg_09.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tavg/wc2.1_30s_tavg_10.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tavg/wc2.1_30s_tavg_11.tif"
#> "  File: /tmp/RtmpDLXUpX/file37e253ffed91/tavg/wc2.1_30s_tavg_12.tif"

# Reset user options
unlink(file.path(temp_path))

# }