Skip to contents

clim_extract acquires crucial climate data from online datasets for drawing Walter & Lieth climatic diagrams based on the provided location coordinates.

Usage

clim_extract(file, path = tempdir())

Arguments

file

A data.frame(see details in dataset locdata) with the following 5 columns:

  • No: Serial number of the locations

  • location: Abbreviation of the locations

  • lon: Longitude of the locations in decimal digit (West longitude are represented by negative numbers)

  • lat: Latitude of the locations in decimal digit (South latitude are represented by negative numbers)

  • altitude: Altitude of the locations

Other columns with information is allowed behind the columns above but would be discarded in following process.

path

character.A Path for storing the downloaded data, avoids downloading the same data many times over and guards against service interruptions. Deafault is tempdir().

Value

A data.frame with annual average precipitation, annual average temperature, annual average minimum temperature and annual average max temperature of 12 months, as well as other essential information of every location. Note that some locations don't have data of annual average temperature, so they would be replace by values averaged by annual average minimum temperature and annual average maximum temperature.

  • No,location,lon,lat: Information of the locations, the the same as which in parameter file.

  • type: The labels of climate data, encompassing annual average precipitation, annual average minimum temperature,annual average temperature and annual average maximum temperature.

  • 1-12: The column names of the particular climate data type correspond to monthly values ranging from January to December.

See more details in dataset plotdata.

Details

This function extracts precipitation and temperature from Worldclim Historical monthly weather data in 2010-2019 (Version of 2.5 minutes,https://worldclim.org/data/monthlywth.html), containing annual average precipitation, annual average temperature,annual average minimum temperature and annual average max temperature of 12 months. It downloads the climate data, extracts and arranges them to a data frame for drawing the climatic diagram.

Examples

{
#import data of locations
x <- data.frame(No = "1", location = "test",
lon = 0, lat = -30, altitude = 20)
#Code below will download data automatically
if (FALSE) {
y <- clim_extract(x)
}
}