cdtMergingClimDataCMD: Merging stations observation and reanalysis data.

View source: R/cdtMerging_ClimData_Cmd.R

cdtMergingClimDataCMDR Documentation

Merging stations observation and reanalysis data.

Description

Function to merge stations observation and reanalysis data.

Usage

cdtMergingClimDataCMD(
  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 = 3.5, use.block =
    TRUE, vargrd = FALSE, vgm.model = c("Sph", "Exp", "Gau", "Pen")),
  auxvar = list(dem = FALSE, slope = FALSE, aspect = FALSE, lon = FALSE, lat = FALSE),
  dem.data = list(file = "", varid = "dem", ilon = 1, ilat = 2),
  grid = list(from = "data", pars = NULL),
  RnoR = list(use = FALSE, wet = 1, smooth = FALSE),
  precision = list(from.data = TRUE, prec = "short"),
  blank = list(data = FALSE, shapefile = ""),
  output = list(dir = "", format = "tmax_mrg_%s%s%s.nc"),
  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 "temp" 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": 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")

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.

grid

named list, providing the grid to use to interpolate the data. The list includes an element from with available options "data", "ncdf" or "new", and an element pars which is a named list specifying the parameters related to from:

  • "data": the grid to interpolate will be taken from the input netCDF data, pars can be omitted

  • "ncdf": the grid to interpolate will be taken from a provided netCDF file, pars specifies the full path to the netCDF file containing the grid to be extracted, the name of the variable to read, the order for the longitude and latitude dimension.
    Example: pars = list(file = "/home/data/files/rfe_2020121.nc", varid = "precip", ilon = 1, ilat = 2)

  • "new": the grid to interpolate will be created from the information provided by user, pars specifies the minimum/maximum of the longitude and latitude of the domain and the resolution to be used.
    Example: pars = list(minlon = 42, maxlon = 52, minlat = -26, maxlat = -11, reslon = 0.1, reslat = 0.1)

RnoR

named list, specifying the rain-no-rain mask parameters if "variable" is "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

precision

named list, indicating the precision of the merged data if "variable" is "rain".

  • from.data: logical, if TRUE the precision from the input netCDF data will be used.

  • prec: character, if from.data is FALSE specify here the precision to be used

blank

named list, indicating if the data outside a provided shapefile will be removed.

  • data: logical, blank the grid outside the provided shapefile

  • shapefile: character, full path to the shapefile to be used for blanking with the extension ".shp"

output

named list, indicating the directory to save the merged data and the format of the merged netCDF file name.

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.