Description Usage Arguments Details Value See Also Examples
This function can be useful to prepare the Climatol input files when the user have their daily data in per station individual files.
1 2 | 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.
1 2 3 4 5 6 7 8 9 10 11 12 | 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)
|
Loading required package: maps
Loading required package: mapdata
Checking the period covered by the data...
1 2 3
3652 days between 1981-01-01 and 1990-12-31
Generating TestVar input files for Climatol from daily files...:
1 WY003.txt
2 WY018.txt
3 WY020.txt
Data saved to file TestVar_1981-1990.dat :
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
-38.900 -0.300 7.300 7.065 15.700 28.300 1692
Station coordinates and names saved to file TestVar_1981-1990.est :
X (lon) Y (lat) Z (elev) Code Name
Min. :44.38 Min. :-108.9 Min. :1169 1:1 st0001:1
1st Qu.:44.40 1st Qu.:-108.7 1st Qu.:1210 2:1 st0002:1
Median :44.41 Median :-108.6 Median :1251 3:1 st0003:1
Mean :44.56 Mean :-108.5 Mean :1340
3rd Qu.:44.65 3rd Qu.:-108.3 3rd Qu.:1425
Max. :44.89 Max. :-108.0 Max. :1599
[1] "/work/tmp/tmp/Rtmpom9ch4"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.