dd2m: Compute monthly data from daily (or subdaily) series

View source: R/clihomog.R

dd2mR Documentation

Compute monthly data from daily (or subdaily) series

Description

Daily or sub-daily series are aggregated into total, mean, maximum, or minimum monthly values, and saved to files in climatol input format.

Usage

dd2m(varcli, anyi, anyf, ndec=1, valm=2, namax=30, x=NULL, na.strings="NA",
tz='utc')

Arguments

varcli

Short 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.

ndec

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

valm

Monthly value to compute:

1:

Sum,

2:

Mean,

3:

Maximum,

4:

Minimum,

5:

Standard deviation.

namax

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

x

Time vector. If not provided, it will be built as dates (or date-time for sub-daily data) beginning January 1st of the initial year. The user must provide if data are taken at irregular intervals or are not beginning the first of January.

na.strings

Missing data code in the original daily data. (NA by default.)

tz

Time zone ('utc' by default). Only relevant for subdaily data.

Details

Data are read from files ‘VRB_YEAR-YEAR.dat’ and ‘VRB_YEAR-YEAR.est’, and output monthly data will be saved to files with the same names but with the suffix -m appended to the name of the variable.

See Also

homogen, dahstat, dahgrid

Examples

## Set a temporal working directory and write input files:
wd <- tempdir()
wd0 <- setwd(wd)
data(climatol_data)
write.table(SIstations,'RR_1981-1995.est',row.names=FALSE,col.names=FALSE)
write(as.matrix(RR3st[,2:4]),'RR_1981-1995.dat')

## Now run the example:
dd2m('RR',1981,1995,valm=1)

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

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

climatol documentation built on June 22, 2024, 11:07 a.m.

Related to dd2m in climatol...