cdtMergingLOOCV: CDT Merging Leave-One-Out Cross-Validation

Description Usage Arguments Examples

View source: R/cdtMergingLOOCV.R

Description

This function perform a Leave-One-Out Cross-Validation.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
cdtMergingLOOCV(time.step = "dekadal", start.date = c(1981, 1, 1),
  end.date = c(2018, 12, 3), station = list(file = NULL, sep = ",",
  miss = "-99"), netcdf = list(dir = NULL, varid = NA, order.lon = 1,
  order.lat = 2, format = "rfe_%s%s%s.nc"), merging.method = "SBA",
  interp.method = "idw", spheric = FALSE, maxdist = 2.5,
  pass.ratio = c(1, 0.5, 0.2), pass.nmin = c(5, 4, 3),
  pass.nmax = c(15, 10, 7), neg.value = FALSE, output.file = NULL,
  use.RnoR = FALSE, pars.RnoR = list(wet.day = 1, smooth = FALSE),
  vgm.model = c("Exp", "Gau", "Sph", "Pen"), parallel = list(dopar =
  TRUE, detect.cores = TRUE, nb.cores = 2))

Arguments

time.step

Time step of the data. Should be "daily", "pentad", "dekadal" or "monthly".

start.date

A vector of the start date to merge.

  • Daily data: c(year, month, day)

  • Pentad data: c(year, month, pentad), pentad must be 1, 2, 3, 4, 5, or 6

  • Dekadal data: c(year, month, dekad), dekad must be 1, 2 or 3

  • Monthly data: c(year, month)

end.date

A vector of the start date to merge. Same format as start.date.

station

A list containing the station information in the form list(file, sep, miss).

  • file: full path to the station file (CDT station data format)

  • sep: separator of the column

  • miss: missing value flag

netcdf

A list containing the netcdf data information in the form list(dir, order.lon, order.lat, format).

  • dir: full path to the directory containing the ne netcdf data

  • varid: name of the variable to be used

  • order.lon: order of the longitude (netcdf dimension order)

  • order.lat: order of the latitude

  • format: filename format of the netcdf files

merging.method

Merging method to be used. Valid options: "CSc", "BSc", "SBA" or "RK".

  • "CSc": Cressman Scheme

  • "BSc": Barnes Scheme

  • "SBA": Simple Bias Adjustment

  • "RK": Regression Kriging

interp.method

Interpolation method to be used for "SBA" and "RK". Valid options: "idw", "shepard", "spheremap" or "kriging".

  • "idw": Inverse distance weighted

  • "shepard": Modified Shepard interpolation

  • "spheremap": Spheremap interpolation method

  • "kriging": Ordiranry kriging

spheric

If FALSE (default), then a cartesian distance will be computed. If set to TRUE, a spherical distance (using a standard great circle method) will be computed.

maxdist

Maximum radius of influence in decimal degree.

pass.ratio

A vector giving the fraction of maxdist to be used for each pass.

pass.nmin

A vector giving the minimum number of stations to be used to interpolate a grid point for each pass. Must be the same length as pass.ratio.

pass.nmax

A vector giving the maximum number of stations to be used to interpolate a grid point for each pass. Must be the same length as pass.ratio.

neg.value

If TRUE, negative values will be kept. If FALSE (default), negative values will be set to zero.

output.file

Full path name to save the result.

use.RnoR

If TRUE, apply rain-no-rain mask for rainfall data.

pars.RnoR

A list of parameters to be used if use.RnoR is TRUE.

  • wet.day: wet day definition

  • smooth: if TRUE, smooth the mask

vgm.model

A vector of variogram model to be used if interp.method is "kriging". Default is c("Exp", "Gau", "Sph", "Pen").

parallel

A list of parameters for parallel processing.

  • dopar: if TRUE (default), use parallel computing

  • detect.cores: if TRUE (default), detect the number of CPU cores.

  • nb.cores: if dopar is TRUE and detect.cores is FALSE, the number of CPU cores to be used

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 
cdtMergingLOOCV(
     time.step = "dekadal",
     start.date = c(2018, 1, 1),
     end.date = c(2018, 12, 3),
     station = list(file = "~/DONNEES/STN_DATA/CDT_RR_dekad_1981-2018_CLM.csv",
                 sep = ",", miss = "-99"),
     netcdf = list(dir = "~/DONNEES/GRIDDED_DATA/tamsat_v3/dekadal", varid = "rfe",
                 order.lon = 1, order.lat = 2, format = "rfe_%s%s%s.nc"),
     merging.method = "SBA", 
     interp.method = "idw",
     spheric = TRUE,
     maxdist = 1.0,
     pass.ratio = c(1, 0.75, 0.5),
     pass.nmin = c(5, 4, 3),
     pass.nmax = c(15, 10, 7),
     neg.value = FALSE,
     output.file = "~/DONNEES/OUT_Merging/LOOCV_SBA-idw.csv",
     use.RnoR = TRUE,
     pars.RnoR = list(wet.day = 1.0, smooth = FALSE),
     vgm.model = c("Exp", "Gau", "Sph", "Pen")
 )

## End(Not run)

rijaf-iri/CDTMergingF documentation built on May 4, 2020, 9:05 p.m.