Description Usage Arguments Value Author(s) Examples
View source: R/fdbk_asdataframe.R
Calculates stratified hit rates for uncertain obs/fcst
1 | fdbk_dt_hits_uncert(DT, thrs, by, cores = 1, incores = 1)
|
DT |
data.table with relevant information (at least varno, obs and veri_data) |
thrs |
list of variable having each a list of lower/upper limit, relative to observation |
by |
stratify contingency entries by these DT columns |
cores |
computing cores for the outer loop (splits computation by varnos) |
incores |
computing cores for the outer loop (splits computation by thresholds)(available cores have to be of number cores x incores) |
data.table with columns varno,interval, hits, total and the arguments of 'by'
Felix <felix.fundel@dwd.de>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #EXAMPLE (CSI for quantile thresholds)
require(ggplot2)
fnames = system("ls ~/examplesRfdbk/*/synop/verSYNOP.*",intern=T)
cond = list(veri_description="grepl('forecast',veri_description)",
veri_forecast_time="veri_forecast_time%in%c(2400,4800,7200,9600,12000,14400,16800)")
columnnames = c("obs","veri_data","varno","veri_model","veri_forecast_time","statid","veri_initial_date")
DT = fdbk_dt_multi_large(fnames,cond,columnnames,20)
thrs = list('29'=list('lower'=c(-1/6),'upper'=c(1/6)),
'3'=list('lower'=c(-1,-2),'upper'=c(1,2)))
xx = fdbk_dt_hits_uncert(DT,thrs,by=c("veri_model","veri_forecast_time","varno"),cores=2,incores=3)
PEC = xx[,list(PEC =(hit)/(total) ),by=c("veri_forecast_time","veri_model","interval","varno")]
PEC[,varno:=varno_to_name(varno,T)]
ggplot(PEC,aes(x=veri_forecast_time,y=PEC,group=interaction(veri_model,interval),linetype=veri_model,color=interval))+
geom_line()+
geom_point()+
facet_grid(~varno)+
theme_bw()+
ggtitle("Percent Correct (within interval)")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.