Compute monthly data from daily series

Description

Daily series are aggregated into total, mean, maximum, or minimum monthly values, and saved to files for further processing.

Usage

1
2
dd2m(varcli, anyi, anyf, anyip=anyi, anyfp=anyf, ndec=1, suf=NA, valm=2,
namax=10, na.strings="NA", homog=FALSE, ini=NA)

Arguments

varcli

Acronym of the name of the studied climatic variable, as in the data file name.

anyi

Initial year of the data present in the file.

anyf

Final year of the data present in the file.

anyip

First year of the output period. (Defaults to anyi).

anyfp

Last year of the output period. (Defaults to anyf).

ndec

Number of decimal places to be saved in the output file.

suf

Optional suffix to be added (by a hyphen) to the acronym of the variable to form the name of the input data.

valm

Monthly value to compute:

1:

Sum,

2:

Mean,

3:

Maximum,

4:

Minimum.

namax

Maximum number of missing data in any month to compute its monthly value. (10 by default)

na.strings

Missing data code in the original daily data.

homog

If TRUE, monthly aggregation will be performed on daily adjusted from a previous monthly homogenization.

ini

Initial date of the daily data, with format "YYYY-MM-DD". Its default NA value assume it to be the first day of the period of study.

Details

This function can be applied to either raw or homogenized daily data.

Raw data are read from files ‘VAR_YEAR-YEAR.dat’ and ‘VAR_YEAR-YEAR.est’, and monthly data will be saved to files ‘VAR-m_YEAR-YEAR.dat’ and ‘VAR-m_YEAR-YEAR.est’.

Homogenized data are read from ‘VAR_YEAR-YEAR.rda’. In this case monthly data will be saved to files named ‘VAR-mh_YEAR-YEAR.dat’ and ‘VAR-mh_YEAR-YEAR.est’.

Value

This function does not return any value.

See Also

homogen, dahstat, dahgrid

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
#First we must generate the input files from example data:
data(Ttest)
write(dat,'Ttest_1981-2000.dat')
write.table(est.c,'Ttest_1981-2000.est',row.names=FALSE,col.names=FALSE)
rm(dat,est.c) #remove loaded data from memory space
#Now we can apply this function to these monthly precipitation data:
#
dd2m('Ttest',1981,2000)

## End(Not run)