fdbk_dt_add_obs_ini: Update a feedback file data.table with observations valid at...

Description Usage Arguments Value Author(s) Examples

View source: R/fdbk_asdataframe.R

Description

Update a feedback file data.table with observations valid at initialization (helpful for calculation of tendency correlations or persistence scores)

Usage

1
fdbk_dt_add_obs_ini(DT, fnamepast, cond = cond)

Arguments

DT

data.table with feedback file content, minimum requires "obs","level","varno","lon","lat" and "veri_initial_date" as YYYYmmddHHMM numeric and a column called "lonlat":=paste0(lon,lat)

fnamepast

vector of filenames (including path) of feedback files that should be valid at times needed to fill DT (e.g. files of past 7 days to fill DT for a model of 7 day forecast range)

cond

list of conditions used for loading DT

Value

DT with an additional columns "obs_ini"

Author(s)

Felix <[email protected]>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
fdbkDir   = "~/examplesRfdbk/icon/synop"
fileName  = tail(dir(fdbkDir,full.names=T),1)
vars      = c("obs","veri_data","veri_forecast_time","level","varno","lon","lat","veri_initial_date")
cond      = ""
DT        = fdbk_dt_multi_large(fileName, condition=cond, vars=vars, cores=1)
DT[,lonlat:=paste0(lon,lat)]
fileNames = tail(dir(fdbkDir,full.names=T),10)
DT = fdbk_dt_add_obs_ini(DT,fileNames,cond)
DT[,lonlat:=NULL]
Plot correlation between observations for different lead-times
na.omit(DT[,list(cor=cor(obs,obs_ini,use="pairwise.complete.obs")),by=c("veri_forecast_time","varno")])[,ggplot(.SD,aes(x=veri_forecast_time,y=cor))+geom_line()+facet_wrap(~varno,scales="free")]

rfxf/Rfdbk documentation built on Dec. 17, 2018, 9:14 a.m.