handle_chile_cr2_prec: Get historical records for daily precipitation for Chile

View source: R/handle_chile_cr2_prec.R

handle_chile_cr2_precR Documentation

Get historical records for daily precipitation 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 daily precipitation from those weather stations. This function works with data 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 manually downloaded from the following link

Usage

handle_chile_cr2_prec(
  action,
  begin = 19500101,
  end = 20180309,
  latitude,
  longitude,
  number_of_stations = 25,
  path_zip_prec = 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 set to 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 set to 20180309 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 used as closest weather stations to the site of interest. Default option is 25

path_zip_prec

Character string input. Location and name of the zip file downloaded and containing the records for precipitation. 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 full path. This will save a bit of time.

stations_df

A dataframe containing the list of stations for which this function will retrieve precipitation 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_prec(action = "my_data", begin = 20000101, end = 20101030,
#                latitude = -32.8958, longitude = -71.2092,
#                number_of_stations = 25,
#                path_zip_prec = NULL, stations_df = NULL,
#                keep_data = TRUE)



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