Convert daily data files to Climatol input format
This function can be useful to prepare the Climatol input files when the user have their daily data in per station individual files.
daily2climatol(stfile, stcol=1:6, datcol=1:4, varcli, anyi=NA, anyf=NA, mindat=365, sep='', dec='.', na.strings='NA', header=FALSE)
stfile |
Name of the file with the list of data file names and station coordinates, codes and names. |
stcol |
Columns in |
datcol |
Columns in data files (named as in the first column of |
varcli |
Acronym of the name of the studied climatic variable. |
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). |
mindat |
Minimum required number of data per station. (Defaults to 365 daily data.) |
sep |
Field separator in all files, whether data or stations. (Defaults to white space.) |
dec |
Symbol of the decimal point. (Defaults to '.'.) |
na.strings |
Missing data code in the original daily data. (Defaults to 'NA'.) |
header |
Logical value indicating whether input files have a header line or not. (Defaults to |
Many users have their daily series in separate files (one per station), either
in text format (as the files used by RClimDex) or in spread-sheets (from which
they can be exported to CSV text files). This function can be used to read
these daily data files and write the input files needed by the homogen
function of this Climatol package.
When either station codes or names are missing in the stations file, its corresponding column must be set to 0. In this case, codes and/or names will be assigned with numeric values.
Field separator, decimal point and the presence of a header line must be consistent in all files (data files and station list).
This function does not return any value.
wd <- tempdir() #temporal working directory for the examples wd0 <- setwd(wd) data(dailies) write.table(stations,'stations.txt',sep=',',row.names=FALSE,col.names=FALSE) write.table(WY003,'WY003.txt',sep=',',row.names=FALSE,col.names=FALSE) write.table(WY018,'WY018.txt',sep=',',row.names=FALSE,col.names=FALSE) write.table(WY020,'WY020.txt',sep=',',row.names=FALSE,col.names=FALSE) daily2climatol('stations.txt',c(1,3,2,4,0,0),2:5,'TestVar',sep=',',na.strings='-99.9') #Return to user's working directory: setwd(wd0) #Input and output files can be found in directory: print(wd)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.