handle_chile_cr2: Get historical records of extreme temperatures for Chile

View source: R/handle_chile_cr2.R

handle_chile_cr2R Documentation

Get historical records of extreme temperatures for Chile

Description

This function allows to obtain information about weather stations located in Chile as well as a data frame containing historical records of minimum and maximum temperatures from those weather stations. This function works with data downloaded from the website of the Center for Climate and Resilience Research (CR)2 sponsored by the University of Chile. The function allows to download the data (only recommended once) as well as to handle zip files previously downloaded. Data can be downloaded from the following links: minimum temperatures and maximum temperatures

Usage

handle_chile_cr2(
  action,
  begin = 19500101,
  end = 20180309,
  latitude,
  longitude,
  number_of_stations = 25,
  path_zip_tmin = NULL,
  path_zip_tmax = NULL,
  stations_df = NULL,
  keep_data = TRUE
)

Arguments

action

Character string input that defines the kind of data required. There are three options for this parameter:

"info_stations"

provides a dataframe with information about a given number of weather stations (set in number_of_stations) located close to the location established with latitude and longitude parameters

"list_data"

provides a list of dataframes containing minimum and maximum temperature records from each weather station obtained with the "info_stations" mode within the period established in the call of the function

"my_data"

provides the first dataframe of the previous list and represent the data of the closest weather station to the location established

begin

Numeric parameter in YEARMODA format. This parameter represents the initial date of the period of interest. If it is not provided, the default is established as 19500101 which correspond to the oldest date possible to use

end

Numeric parameter in YEARMODA format. This parameter represents the final date of the period of interest. If it is not provided, the default is established as 20180310 which corresponds to the earliest possible date that can be used for the assessment

latitude

Numerical input. Latitude of the site of interest in decimal format

longitude

Numerical input. Longitude of the site of interest in decimal format

number_of_stations

Numerical input. Number of stations wanted to use as closest stations to the site of interest. Default option is the value 25

path_zip_tmin

Character string input. Location of the zip file containing minimum temperatures. This input must include the name and extension of the file. Default is set to NULL so the function will download the data from the CR2 site and store the zip file in a temporary folder. If you have the data, please provide the path. This will save a bit of time.

path_zip_tmax

Character string input. Location of the zip file containing maximum temperatures. This input must include the name and extension of the file. Default is set to NULL so the function will download the data from the CR2 site and store the zip file in a temporary folder. If you have the data, please provide the path. This will save a bit of time.

stations_df

A dataframe containing the list of stations for which this function will retrieve weather data. It is important that this dataframe be produced by this function under the action "info_stations". The default is set to NULL

keep_data

Boolean parameter indicating if the data downloaded should be deleted or not

Examples


#handle_chile_cr2(action = "my_data", begin = 20000101, end = 20101030,
#                latitude = -32.8958, longitude = -71.2092, number_of_stations = 25,
#                path_zip_tmin = NULL, path_zip_tmax = NULL,
#                stations_df = NULL, keep_data = TRUE)



EduardoFernandezC/dormancyR documentation built on Aug. 24, 2022, 7:21 a.m.