cdtCrossValidationClimDataCMD: Cross-validation, merging stations observation and gridded...

View source: R/cdtCrossValidation_ClimData_Cmd.R

cdtCrossValidationClimDataCMDR Documentation

Cross-validation, merging stations observation and gridded climate data.

Description

Function to perform a Leave-One-Out Cross-Validation for climate data merging.

Usage

cdtCrossValidationClimDataCMD(
  variable = "temp",
  time.step = "dekadal",
  minhour = 1,
  dates = list(from = "range", pars = list(start = "2018011", end = "2018123")),
  station.data = list(file = "", sep = ",", na.strings = "-99"),
  netcdf.data = list(dir = "", format = "tmax_adj_%s%s%s.nc", varid = "temp", ilon =
    1, ilat = 2),
  merge.method = list(method = "SBA", nrun = 3, pass = c(1, 0.75, 0.5)),
  interp.method = list(method = "idw", nmin = 8, nmax = 16, maxdist = 2.5, use.block =
    TRUE, vargrd = FALSE, vgm.model = c("Sph", "Exp", "Gau", "Pen")),
  crossv.station = list(from = "all", pars = NULL),
  auxvar = list(dem = FALSE, slope = FALSE, aspect = FALSE, lon = FALSE, lat = FALSE),
  dem.data = list(file = "", varid = "dem", ilon = 1, ilat = 2),
  RnoR = list(use = FALSE, wet = 1, smooth = FALSE),
  output.dir = "",
  GUI = FALSE
)

Arguments

variable

character, name of the climate variable to merge. Available options: "rain", "temp", "rh", "pres", "prmsl", "rad", "wspd", "ugrd", "vgrd".

  • "rain": rainfall data

  • "temp": temperature data

  • "rh": relative humidity data

  • "pres": surface pressure data

  • "prmsl": pressure at mean sea level

  • "rad": radiation data

  • "wspd": wind speed data

  • "ugrd": zonal wind components, E-W speed

  • "vgrd": meridional wind components, N-S speed

time.step

character, the time step of the data. Available options: "minute", "hourly", "daily", "pentad", "dekadal", "monthly".

minhour

integer, the step for "minute" and "hourly".

  • "minute": can have the value 1, 5, 10, 15, 20 or 30

  • "hourly": can take the value 1, 3, 6 or 12

dates

named list, providing the dates to merge. The list includes an element from with available options "range", "file" or "dates", and an element pars which is a named list specifying the parameters related to from:

  • "range": pars specifies the start and end dates to merge.
    Example: pars = list(start = "2018011", end = "2018123")

  • "file": pars specifies the full path to the file containing the dates to merge. Example: pars = list(file = "/home/data/files/dates.txt")
    The contents of the file are as follows:
    ## cat /home/data/files/dates.txt
    2020011
    2020012
    2020013
    ......

  • "dates": pars specifies a vector containing the dates to merge.
    Example: pars = list(dates = c("2020011", "2020012", 2020091, 2020113))

station.data

named list, providing the station data to be used in CDT format.

  • file: character, full path to the file containing the stations data

  • sep: character, column separator of the data

  • na.strings: character, missing values flag

netcdf.data

named list, providing the input netCDF dataset to be used.

  • dir: character, full path to the directory containing the netCDF files.

  • format: character, format of the netCDF file names

  • varid: character, name of the variable to read from the netCDF data

  • ilon: integer, order for the longitude dimension of the variable. Example: if the variable "precip" has the dimension order [Lat, Lon] then ilon must be 2

  • ilat: integer, order for the latitude dimension of the variable.

merge.method

named list, indicating the merging method.

  • "method": character, the merging method. Valid options: "CSc", "BSc", "SBA" or "RK".

    • "CSc": Cressman Scheme

    • "BSc": Barnes Scheme

    • "SBA": Simple Bias Adjustment

    • "RK": Regression Kriging

  • "nrun": integer, number of the nested run to be performed

  • "pass": numeric vector giving the fraction of nmin, nmax and maxdist to be used for each pass.

interp.method

named list, indicating the interpolation method and parameters to be used for "SBA" and "RK".

  • method: character, the interpolation method to be used. Valid options: "idw", "shepard", "sphere" or "okr".

    • "idw": Inverse distance weighted

    • "shepard": Modified Shepard interpolation

    • "sphere": Spheremap interpolation method

    • "okr": Ordiranry kriging

  • nmin: integer, minimum number of stations to be used to interpolate a grid point

  • nmax: integer, maximum number of stations to be used to interpolate a grid point

  • maxdist: numeric, maximum radius of influence in decimal degree

  • use.block: logical, use block mean values to interpolate a grid point

  • vargrd: logical, use a variable radius of influence

  • vgm.model: character vector of variogram model to be used if method is "okr". Default is c("Exp", "Gau", "Sph", "Pen")

crossv.station

named list, selecting the stations to use for the cross-validation. The list includes an element from with available options "all", "file" or "cdt", and an element pars which is a named list specifying the parameters related to from:

  • "all": all the stations from station.data will be used for cross-validation, pars can be omitted

  • "file": the list of stations to be used for the cross-validation comes from a file.

    • type: character, the type of the data, valid options are:
      "cdtstation": the stations come from a CDT stations data,
      "cdtcoords": the stations come from a CDT coordinates file

    • file: character, full path to the file containing the stations

    • sep: character, column separator of the data

    • na.strings: character, missing values flag

    • header: logical, in case of "cdtcoords", set TRUE if the data has a header

  • "cdt": the list of stations to be used for the cross-validation will be selected from station.data by providing the percent of minimum available data for each station.
    Example: pars = list(min.perc = 40)

auxvar

named list, specifying the auxiliary variables to use when the merging method is "RK".

  • dem: logical, include elevation data as auxiliary variable

  • slope: logical, include slope as auxiliary variable

  • aspect: logical, include aspect as auxiliary variable

  • lon: logical, include longitude as auxiliary variable

  • lat: logical, include latitude as auxiliary variable

dem.data

named list, providing the Digital Elevation Model (in netCDF format) when using regression kriging method with elevation related data as auxiliary variable.

  • file: character, full path to the netCDF file containing the elevation data.

  • varid: character, name of the variable to read from the netCDF data

  • ilon: integer, order for the longitude dimension of the variable.

  • ilat: integer, order for the latitude dimension of the variable.

RnoR

named list, specifying the rain-no-rain mask parameters in case of var.clim = "rain".

  • use: logical, apply rain-no-rain mask

  • wet: numeric, threshold to be use to define the wet/dry event

  • smooth: logical, smooth the rain-no-rain mask after interpolation

output.dir

character, full path to the directory to save the output.

GUI

logical, indicating whether or not the output message should be displayed on CDT GUI. If TRUE, CDT GUI must be open.


rijaf-iri/CDT documentation built on July 3, 2024, 2:54 a.m.