Learn R Programming

dycdtools (version 0.3.1)

interpol: Interpolation of simulation for a series of user-defined depths.

Description

Convert simulated variable at irregular layer heights to a dataframe of the same variable at sequenced layer heights.

Usage

interpol(layerHeights, var, min.depth, max.depth, by.value)

Arguments

layerHeights

layer heights, extracted from DYCD outputs

var

simulated variable values, extracted from DYCD outputs

min.depth, max.depth, by.value

minimum and maximum depth for interpolation at the depth increment of by.value.

Value

a matrix of interpolated values of such variable.

Examples

Run this code
# NOT RUN {
# extract simulated temperature values from DYRESM-CAEDYM simulation file
 var.values<-ext.output(dycd.output=system.file("extdata", "dysim.nc", package = "dycdtools"),
                       var.extract=c("TEMP"))

 for(i in 1:length(var.values)){
  expres<-paste0(names(var.values)[i],"<-data.frame(var.values[[",i,"]])")
  eval(parse(text=expres))
 }
 # interpolate temperature for depths from 0 to 13 m at increment of 0.5 m
 temp.interpolated<-interpol(layerHeights = dyresmLAYER_HTS_Var,
                            var = dyresmTEMPTURE_Var,
                            min.dept = 0,max.dept = 13,by.value = 0.5)

# }

Run the code above in your browser using DataLab