library(s2dverification)
source("/esarchive/scratch/nperez/git/s2dverification/R/Utils.R")
source("/esarchive/scratch/nperez/git/s2dverification/R/Load.R")
library(ncdf4)
ecearth <- list(name = 'system5_m1',
                   path = file.path('/esarchive/exp/ecmwf',
                                    '$EXP_NAME$/$STORE_FREQ$_mean',  #month_mean',
                                    '$VAR_NAME$_f6h/$VAR_NAME$_$START_DATE$.nc'))
sdate <- c('20170101')#, '20170201')   
startDates <- sdate
time_length <- 7
lon <- c(0, 359)
lat <- c(-90, 90)

   data_Load <- Load(var = 'tas',
                     exp = list(ecearth),
                     sdates = startDates,
                     storefreq = "monthly",
                     leadtimemax = time_length,
                     output = 'lonlat',
                     nmember = 1)

  lons <- data_Load$lon
  lats <- data_Load$lat
 PlotEquiMap(data_Load$mod[1, 1, 1, 1, , ], lons, lats)

# -------------------
# Step by step:

var ='tas'
exp = list(ecearth); obs = NULL
sdates = startDates; nmember = 1; nmemberobs = NULL; nleadtime = NULL; leadtimemin = 1
leadtimemax = time_length; storefreq = 'monthly'; sampleperiod = 1
lonmin = 0; lonmax = 360; latmin = -90; latmax = 90
output = 'lonlat'; method = 'conservative'; grid = NULL
maskmod = vector("list", 15); maskobs = vector("list", 15)
configfile = NULL; varmin = NULL; varmax = NULL
silent = FALSE; nprocs = NULL; dimnames = NULL
remapcells = 2; path_glob_permissive = 'partial'



