dahstat: Extract series or statistics of the homogenized data

View source: R/clihomog.R

dahstatR Documentation

Extract series or statistics of the homogenized data

Description

Lists series, means, medians, standard deviations, quantiles or trends, for a specified period, from series homogenized by homogen.

Usage

dahstat(varcli, anyi, anyf, anyip=anyi, anyfp=anyf, stat="me", ndc=NA, vala=2,
valm=vala, cod=NULL, prob=.5, all=FALSE, long=FALSE, relref=FALSE, pernyr=10,
estcol=c(1,2,4), sep=',', dec='.')

Arguments

varcli

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

anyi

Initial year of the homogenized period.

anyf

Final year of the homogenized period.

anyip

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

anyfp

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

stat

Statistical parameter to compute for the selected period:

"me":

Means (default),

"mdn"

Medians,

"max"

Maxima,

"min"

Minima,

"std"

Standard deviations,

"q"

Quantiles (see the prob parameter),

"tnd"

OLS trends and their p-values,

"series"

Do not compute any statistic; only write homogenized series and flags into two CSV files.

"mseries"

As before, but output series in individual *.csv files. (Not applicable to daily series.)

ndc

Number of decimal places to be saved in the output file (defaults to that used in the homogenization).

vala

Annual values to compute from the sub-annual data:

0:

None,

1:

Sum,

2:

Mean (default),

3:

Maximum,

4:

Minimum.

valm

Monthly values to calculate from sub-monthly data (defaults to vala):

1:

Sum,

2:

Mean,

3:

Maximum,

4:

Minimum.

cod

Vector of requested station codes (all by default).

prob

Probability for the computation of quantiles (0.5 by default, i.e., medians). You can set probabilities with more than 2 decimals, but the name of the output file will be identified with the rounded percentile.

all

If TRUE, all reconstructed series will be used. The default is FALSE, hence using only the series reconstructed from the last homogeneous subperiod.

long

If TRUE (the default is FALSE), only series reconstructed from the longest homogeneous subperiod will be used.

relref

If TRUE, statistics from reliable reference series will also be listed. (FALSE by default).

pernyr

Number of years on which to express trend units (10 by default).

estcol

Columns of the homogenized stations file to be included in the output file. (Defaults to c(1,2,4), the columns of station coordinates and codes).

sep

Field separator (',' by default).

dec

Decimal point ('.' by default).

Details

Homogenized data are read from the file ‘VRB_ANYI-ANYF.rda’ saved by homogen, while this function saves the computed data for the specified period in ‘VRB_ANYIP-ANYFP.STAT’, where STAT is substituted by the stat requested statistic. An exception is when stat="q", since then the extension of the output file will be qPP, where PP stands for the specified prob probability (in percent).

The output period ANYIP-ANYFP must of course be comprised within the period of the input data, ANYI-ANYF.

stat='tnd' computes trends by Ordinary Least Squares linear regression on time, listing them in a CSV file ‘*_tnd.csv’ and their p-values in ‘*_pval.csv

If stat='series' is chosen, two text files in CSV format will be produced for every station, one with the data and another with their flags: 0 for original, 1 for infilled and 2 for corrected data.

See Also

homogen, dahgrid.

Examples

## Set a temporal working directory:
wd <- tempdir()
wd0 <- setwd(wd)

## Copy an example file of homogenization results:
file.copy(exampleFiles('Temp_1991-2000.rda'),'.')

## Now run the examples:
dahstat('Temp', 1991, 2000)
dahstat('Temp', 1991, 2000, stat='q', prob=0.4)
dahstat('Temp', 1991, 2000, stat='tnd')
dahstat('Temp', 1991, 2000, stat='series')

## 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 dahstat in climatol...