# 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)
data(obs_temp)
# contour plot of temperature simulations with observed data shown as colour-coded dots
plot_cont_comp(sim=temp.interpolated,
obs=obs_temp,
sim.start = "2017-06-06",
sim.end = "2017-06-15",
plot.start="2017-06-06",
plot.end="2017-06-15",
legend.title="T \u00B0C",
min.depth=0,max.depth=13,by.value=0.5,
nlevels=20,
plot.save=FALSE,
file_name="Contour_temp.png",
height=5,width=8,ppi=150)
# }
Run the code above in your browser using DataLab