Learn R Programming

dycdtools (version 0.3.1)

plot_ts: Time series plot of simulated and observed values

Description

Time series plot of simulated and observed values

Usage

plot_ts(
  sim = temp.interpolated,
  obs = obs.temp,
  target.depth = c(1, 6, 12, 30),
  sim.start = "2017-06-06",
  sim.end = "2020-02-29",
  plot.start = "2017-06-06",
  plot.end = "2020-02-29",
  min.depth = 0,
  max.depth = 33,
  by.value = 0.5,
  ylabel = "Temperature C",
  plot.save = FALSE,
  file_name,
  height = 7,
  width = 11
)

Arguments

sim

interpolated values of variable

obs

observed values of variable

target.depth

a vector of depth (unit:m) to be used to extract and plot variable values.

sim.start, sim.end

the beginning and ending simulation dates for the intended DYRESM-CAEDYM model run. The date format must be "%Y-%m-%d".

plot.start, plot.end

the beginning and ending dates for the plotting purpose. The date format must be "%Y-%m-%d".

min.depth, max.depth, by.value

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

ylabel

the y axis title.

plot.save

if TRUE, the plot is saved with the "height","width", and "ppi" parameters.

file_name

the file path to save the generated ts plot.

height, width

the height and width of the time series figure.

Value

a plot of sim and obs time series.

Examples

Run this code
# NOT RUN {
 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)

 data(obs_temp)
# time series plot of temperature sim and obs
 plot_ts(sim = temp.interpolated,
         obs = obs_temp,
         target.depth=c(1,6),
         sim.start="2017-06-06",
         sim.end="2017-06-15",
         plot.start="2017-06-06",
         plot.end="2017-06-15",
         ylabel="Temperature \u00B0C",
         min.depth=0,
         max.depth=13,
         by.value=0.5)


# }

Run the code above in your browser using DataLab