outrename: Rename homogen's output files

Description Usage Arguments Details Value See Also Examples

View source: R/depurdat.R

Description

This function inserts a suffix to the output file names of homogen, to prevent them from being rewritten by any further function run.

Usage

1
outrename(varcli, anyi, anyf, suffix, restore=FALSE)

Arguments

varcli

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

anyi

Initial year of the study period

anyf

Final year of the study period

suffix

Suffix to be inserted (or removed) in the output file names.

restore

Set this parameter to TRUE to remove the suffix previously inserted by this function.

Details

The variable (or file base) name is separated from the appended suffix by a hyphen. The purpose of this function is to allow a new application of homogen to the same data with different parameters without overwriting the previous results.

Value

This function does not return any value.

See Also

homogen

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#Set a temporal working directory and write input files:
wd <- tempdir()
wd0 <- setwd(wd)
data(Ptest)
dim(dat) <- c(720,20)
dat[601:720,5] <- dat[601:720,5]*1.8
write(dat[481:720,1:5],'pcp_1991-2010.dat')
write.table(est.c[1:5,1:5],'pcp_1991-2010.est',row.names=FALSE,col.names=FALSE)
homogen('pcp',1991,2010,std=2) #homogenization
#Now run the example:
outrename('pcp',1991,2010,'ok')
#Return to user's working directory:
setwd(wd0)
#Input and output files can be found in directory:
print(wd)

Example output

Loading required package: maps
Loading required package: mapdata

HOMOGEN() APPLICATION OUTPUT  (From R's contributed package 'climatol' 3.1.1)

=========== Homogenization of pcp, 1991-2010. (Thu Jan 17 01:35:10 2019)

Parameters: varcli=pcp anyi=1991 anyf=2010 suf=NA nm=NA nref=10,10,4 std=2 swa=NA ndec=1 dz.max=5 dz.min=-5 wd=0,0,100 snht1=25 snht2=25 tol=0.02 maxdif=0.05 mxdif=0.05 maxite=999 force=FALSE wz=0.001 trf=0 mndat=NA gp=3 ini=NA na.strings=NA vmin=NA vmax=NA nclust=100 cutlev=NA grdcol=#666666 mapcol=#666666 hires=TRUE expl=FALSE metad=FALSE sufbrk=m tinc=NA tz=UTC cex=1.2 verb=TRUE

Read 1200 items
Data matrix: 240 data x 5 stations

-------------------------------------------
Stations in the 2 clusters:

$`1`
    Z Code        Name
1 183 S031 Station_031
4 129 S051 Station_051

$`2`
    Z Code        Name
2 125 S047 Station_047
3 100 S098 Station_098
5  79 S081 Station_081

---------------------------------------------
Computing inter-station distances:  1  2  3  4


========== STAGE 1 (SNHT on overlapping temporal windows) ===========

Computation of missing data with outlier removal
(Suggested data replacements are provisional)
  Station(rank) Date: Observed -> Suggested (Anomaly, in std. devs.)
S098(3) 1991-10-01: 298.4 -> 92.9 (5.56)
S081(5) 2002-10-01: 724.68 -> 390.7 (6.02)

Performing shift analysis on the 5 series...


========== STAGE 2 (SNHT on the whole series) =======================

Computation of missing data with outlier removal
(Suggested data replacements are provisional)
  Station(rank) Date: Observed -> Suggested (Anomaly, in std. devs.)
S098(3) 2008-09-01: 111.3 -> 290.8 (-5.09)

Performing shift analysis on the 5 series...

S081(5) breaks at 2000-12-01 (26.3)

Update number of series:  5 + 1 = 6 

Computation of missing data with outlier removal
(Suggested data replacements are provisional)
  Station(rank) Date: Observed -> Suggested (Anomaly, in std. devs.)
S081-2(6) 1993-10-01: 309 -> 111.2 (5.58)

Performing shift analysis on the 6 series...


========== STAGE 3 (Final computation of all missing data) ==========

Computing inter-station weights... (done)

Computation of missing data with outlier removal
(Suggested data replacements are provisional)

The following lines will have one of these formats:
  Station(rank) Date: Observed -> Suggested (Anomaly, in std. devs.)
  Iteration Max.data.difference (Station_code)
2 -5.569 (S081-2)
3 -3.255 (S081-2)
4 -2.049 (S081-2)
5 -1.308 (S081-2)
6 -0.843 (S081-2)
7 -0.547 (S081-2)
8 -0.356 (S081-2)
9 -0.232 (S081-2)
10 -0.152 (S081-2)
11 -0.099 (S081-2)
12 -0.065 (S081-2)
13 -0.043 (S081-2)

Last series readjustment (please, be patient...)

======== End of the homogenization process, after 2.67 secs 

----------- Final computations:

ACmx: Station maximum absolute autocorrelations of anomalies
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.2000  0.2275  0.2900  0.2733  0.3000  0.3500 

SNHT: Standard normal homogeneity test (on anomaly series)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  1.200   2.300   2.400   2.583   2.575   4.600 

RMSE: Root mean squared error of the estimated data
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  30.49   31.56   32.73   36.98   38.67   54.11 

POD: Percentage of original data
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  49.00   57.50   89.50   78.67   96.75   98.00 

  ACmx SNHT RMSE POD Code   Name         
1 0.30 2.6  40.5 98  S031   Station_031  
2 0.20 2.3  31.3 96  S047   Station_047  
3 0.21 2.3  32.2 97  S098   Station_098  
4 0.28 2.5  33.3 83  S051   Station_051  
5 0.35 1.2  54.1 49  S081   Station_081  
6 0.30 4.6  30.5 49  S081-2 Station_081-2

----------- Generated output files: -------------------------

pcp_1991-2010.txt :  This text output 
pcp_1991-2010_out.csv :  List of corrected outliers 
pcp_1991-2010_brk.csv :  List of corrected breaks 
pcp_1991-2010.pdf :  Diagnostic graphics 
pcp_1991-2010.rda :  Homogenization results. Postprocess with (examples):
   dahstat('pcp',1991,2010) #get averages in file pcp_1991-2010-me.csv 
   dahstat('pcp',1991,2010,stat='tnd') #get OLS trends and their p-values 
   dahgrid('pcp',1991,2010,grid=YOURGRID) #get homogenized grids 
   ... (See other options in the package documentation)

[1] "/work/tmp/tmp/RtmpDj8rfR"

climatol documentation built on Aug. 6, 2019, 1:02 a.m.

Related to outrename in climatol...