climatol2rclimdex: Convert DAILY data from 'climatol' to RClimDex input format

View source: R/clihomog.R

climatol2rclimdexR Documentation

Convert DAILY data from climatol to RClimDex input format

Description

This function reads homogenized daily series of precipitation (RR) and extreme temperatures (TX, TN), adjusted from the last homogeneous sub-period, and writes them in files (one per station) with RClimDex format.

Usage

climatol2rclimdex(varRR, varTX, varTN, yiRR, yfRR, yiTX=yiRR, yfTX=yfRR,
  yiTN=yiRR, yfTN=yfRR, header=TRUE, prefix='hoclm', dir=NA, na='-99.9')

Arguments

varRR, varTX, varTN

Name of the variables in the climatol destination files. If some variable is not available, name it as ”.

yiRR, yfRR

Initial and final years of the homogenized RR series.

yiTX, yfTX, yiTN, yfTN

Initial and final years of the TX and TN series. (The same as yiRR and yfRR by default.)

header

include a header in the files? (TRUE by default)

prefix

Prefix to prepend to station codes to name the output RClimDex files.

dir

Destination directory of the output RClimDex files. (If not set, they will be saved into the current R working directory).

na

Missing data code to use in the ouput files. ('-99.9' by default.)

Details

After homogenizing daily series with climatol, the user may be interested in applying the RClimDex program to the homogenized series. This function automatizes the conversion of file formats between both programs.

Note that if there are some days with TX<TN (can happen because of the independent homogenization of extreme temperatures), a trivial fix will be applied by just exchanging the problem values.

See Also

homogen

Examples

## Set a temporal working directory and generate input files:
wd <- tempdir()
wd0 <- setwd(wd)

## copy example daily RR, TX and TN homogenization results:
file.copy(exampleFiles('RR_1981-1995.rda'),'.')
file.copy(exampleFiles('TX_1981-1995.rda'),'.')
file.copy(exampleFiles('TN_1981-1995.rda'),'.')

## Now run the example:
climatol2rclimdex('RR','TX','TN',1981,1995)

## Return to user's working directory:
setwd(wd0)

## Input and output files can be found in directory:
print(wd)

climatol documentation built on April 20, 2023, 5:08 p.m.