Learn R Programming

climatol (version 3.1.2)

rclimdex2climatol: Convert RClimDex daily data files to Climatol input format

Description

This function can be useful to prepare the Climatol input files when the user have their daily data in RClimDex format.

Usage

rclimdex2climatol(stfile, kvar, varcli='', chrcod=c(6,10), anyi=NA, anyf=NA,
  mis=-99.9, mindat=365, names=FALSE)

Arguments

stfile

Name of the file with the list of data file names and station coordinates, codes and names (in HOMER format).

kvar

RClimDex variable to extract: 1(RR), 2(TX), 3(TN).

varcli

Acronym of the name of the studied climatic variable.

chrcod

Initial and final characters of data file names to be used as station codes. (Between the sixth and the tenth by default.)

anyi

First year to study. (Defaults to the first year of available data.)

anyf

Last year to study. (Defaults to the last year of available data.)

mis

Missing data code. (Defaults to -99.9.)

mindat

Minimum required number of data per station. (Defaults to 365 daily data.)

names

Are there a 9th column with the station names? (FALSE by default.)

Value

This function does not return any value.

Details

Users of the RClimDex program can convert their daily data files to the Climatol format. All files listed in stfile will be read, and the selected variable (precipitation, maximum or minimum temperature) will be stored in a unique *.dat file, with its companion *.est station file. Therefore, if you want to convert all three variables, you must run this function three times.

See Also

homogen

Examples

Run this code
# NOT RUN {
#Set a temporal working directory and write input files:
wd <- tempdir()
wd0 <- setwd(wd)
data(rclimdex)
write.table(rcxsta,'stations.txt',sep='\t',row.names=FALSE,col.names=FALSE,
  quote=FALSE)
write.table(df1,'raxxd000WY003d.txt',row.names=FALSE,col.names=FALSE)
write.table(df2,'raxxd000WY018d.txt',row.names=FALSE,col.names=FALSE)
write.table(df3,'raxxd000WY020d.txt',row.names=FALSE,col.names=FALSE)
#Now run the examples:
rclimdex2climatol('stations.txt',1,'RR',c(9,13))
rclimdex2climatol('stations.txt',2,'TX',c(9,13))
rclimdex2climatol('stations.txt',3,'TN',c(9,13))
#Return to user's working directory:
setwd(wd0)
#Input and output files can be found in directory:
print(wd)
# }

Run the code above in your browser using DataLab