#########################################################################################
#                                                                   Sub-seasonal Skill Scores                                                                                   #
#########################################################################################

library(s2dverification)
workdir <- "/gpfs/projects/bsc32/bsc32842/RESILIENCE"

chunk <- as.integer(commandArgs(TRUE)[1])
#chunk=1

lat <- read.table("/gpfs/projects/bsc32/bsc32842/RESILIENCE/latitudes.txt")[,1]
lat=rev(lat) # to go in increasing order of latitudes instead of decreasing!
time <- system.time(data.hindcast <- Load(var='sfcWind', exp = list(list(path="/gpfs/projects/bsc32/bsc32842/RESILIENCE/2014010200/sfcWind_2013010200.nc")), obs=NULL,sdates='20130102', nleadtime=1, output='lonlat', latmin=lat[chunk], latmax=lat[chunk+2],nprocs=1))


#time <- system.time(data.hindcast <- Load(var='psl', exp = list(list(path="/gpfs/projects/bsc32/bsc32842/RESILIENCE/2014010200/psl_19900501.nc")), obs=NULL,sdates='19900501', nleadtime=1, output='lonlat', latmin=lat[chunk], latmax=lat[chunk+2],nprocs=1))
#lat=seq(-90,90,0.75)

save(time, file=paste0(workdir,'/test_chunk_',chunk,'_time_',round(time[3],2),'.RData'))
