diff --git a/conf/archive.yml b/conf/archive.yml index 0251beaf4151ce8c90b26094531d640f68d0a4cc..e7c18bdf9607022cbefa716fb93d560da0828e00 100644 --- a/conf/archive.yml +++ b/conf/archive.yml @@ -19,7 +19,6 @@ archive: fcst: 51 hcst: 25 calendar: "proleptic_gregorian" - time_stamp_lag: "0" reference_grid: "/esarchive/exp/ecmwf/system5c3s/monthly_mean/tas_f6h/tas_20180501.nc" system7c3s: name: "Meteo-France System 7" @@ -31,7 +30,6 @@ archive: nmember: fcst: 51 hcst: 25 - time_stamp_lag: "+1" calendar: "proleptic_gregorian" reference_grid: "conf/grid_description/griddes_system7c3s.txt" system21_m1: @@ -45,7 +43,6 @@ archive: fcst: 50 hcst: 30 calendar: "proleptic_gregorian" - time_stamp_lag: "+1" reference_grid: "conf/grid_description/griddes_system21_m1.txt" system35c3s: name: "CMCC-SPS3.5" @@ -58,7 +55,6 @@ archive: fcst: 50 hcst: 40 calendar: "proleptic_gregorian" - time_stamp_lag: "+1" reference_grid: "conf/grid_description/griddes_system35c3s.txt" system2c3s: name: "JMA System 2" @@ -70,7 +66,6 @@ archive: fcst: 10 hcst: 10 calendar: "proleptic_gregorian" - time_stamp_lag: "+1" reference_grid: "conf/grid_description/griddes_system2c3s.txt" eccc1: name: "ECCC CanCM4i" @@ -82,7 +77,6 @@ archive: fcst: 10 hcst: 10 calendar: "proleptic_gregorian" - time_stamp_lag: "+1" reference_grid: "conf/grid_description/griddes_eccc1.txt" glosea6_system600-c3s: name: "UKMO GloSea 6 6.0" @@ -94,7 +88,6 @@ archive: fcst: 62 hcst: 28 calendar: "proleptic_gregorian" - time_stamp_lag: "+1" reference_grid: "conf/grid_description/griddes_ukmo600.txt" ncep-cfsv2: name: "NCEP CFSv2" @@ -106,7 +99,6 @@ archive: fcst: 20 hcst: 20 calendar: "gregorian" - time_stamp_lag: "0" reference_grid: "conf/grid_description/griddes_ncep-cfsv2.txt" Reference: era5: diff --git a/modules/Loading/Loading.R b/modules/Loading/Loading.R index 1c8ccad72c3c50402e1e27ce952b010c539cce0e..66a53451091a85836183e3074fca50d81ba78ed5 100644 --- a/modules/Loading/Loading.R +++ b/modules/Loading/Loading.R @@ -143,11 +143,7 @@ load_datasets <- function(recipe) { ## TODO: Give correct dimensions to $Dates$start ## (sday, sweek, syear instead of file_date) hcst <- as.s2dv_cube(hcst) - # Adjust dates for models where the time stamp goes into the next month - if (recipe$Analysis$Variables$freq == "monthly_mean") { - hcst$Dates$start[] <- hcst$Dates$start - seconds(exp_descrip$time_stamp_lag) - } - + # Load forecast #------------------------------------------------------------------- if (!is.null(recipe$Analysis$Time$fcst_year)) { @@ -155,7 +151,7 @@ load_datasets <- function(recipe) { # with the daily case and the current version of startR not allowing # multiple dims split - fcst <- Start(dat = fcst.path, + fcst <- Start(dat = fcst.path, var = variable, file_date = sdates$fcst, time = idxs$fcst, @@ -197,11 +193,6 @@ load_datasets <- function(recipe) { # Convert fcst to s2dv_cube fcst <- as.s2dv_cube(fcst) - # Adjust dates for models where the time stamp goes into the next month - if (recipe$Analysis$Variables$freq == "monthly_mean") { - fcst$Dates$start[] <- - fcst$Dates$start - seconds(exp_descrip$time_stamp_lag) - } } else { fcst <- NULL diff --git a/modules/Loading/dates2load.R b/modules/Loading/dates2load.R index 0e3613f3a3a7e6b09d8317cdadb8bcb850b2bccc..ca8ecaa3b3f64ec94bc08044ca6fe5cdec274a7c 100644 --- a/modules/Loading/dates2load.R +++ b/modules/Loading/dates2load.R @@ -19,6 +19,7 @@ dates2load <- function(recipe, logger) { temp_freq <- recipe$Analysis$Variables$freq recipe <- recipe$Analysis$Time + # hcst dates file_dates <- paste0(strtoi(recipe$hcst_start):strtoi(recipe$hcst_end), recipe$sdate) @@ -26,7 +27,8 @@ dates2load <- function(recipe, logger) { if (temp_freq == "monthly_mean") { file_dates <- .add_dims(file_dates) } - # fcst dates (if fcst_year empty it creates an empty object) + + # fcst dates (if fcst_year empty it creates an empty object) if (! is.null(recipe$fcst_year)) { file_dates.fcst <- paste0(recipe$fcst_year, recipe$sdate) if (temp_freq == "monthly_mean") { diff --git a/tests/testthat/test-seasonal_monthly.R b/tests/testthat/test-seasonal_monthly.R index de03bf7340906650004fbdf5bcdf445992144c09..e9792df0f2d187ad27c6271682655c1793e403ff 100644 --- a/tests/testthat/test-seasonal_monthly.R +++ b/tests/testthat/test-seasonal_monthly.R @@ -108,19 +108,19 @@ tolerance = 0.0001 ) expect_equal( (data$hcst$Dates$start)[1], -as.POSIXct("1993-11-30 23:59:59", tz = 'UTC') +as.POSIXct("1993-12-01", tz = 'UTC') ) expect_equal( (data$hcst$Dates$start)[2], -as.POSIXct("1994-11-30 23:59:59", tz = 'UTC') +as.POSIXct("1994-12-01", tz = 'UTC') ) expect_equal( (data$hcst$Dates$start)[5], -as.POSIXct("1993-12-31 23:59:59", tz = 'UTC') +as.POSIXct("1994-01-01", tz = 'UTC') ) expect_equal( (data$obs$Dates$start)[10], -as.POSIXct("1995-01-15 12:00:00", tz = 'UTC') +as.POSIXct("1995-02-14", tz = 'UTC') ) }) @@ -153,22 +153,22 @@ c(dat = 1, var = 1, sday = 1, sweek = 1, syear = 1, time = 3, latitude = 3, long ) expect_equal( mean(calibrated_data$fcst$data), -291.6433, +291.1218, tolerance = 0.0001 ) expect_equal( mean(calibrated_data$hcst$data), -290.9006, +289.8596, tolerance = 0.0001 ) expect_equal( as.vector(drop(calibrated_data$hcst$data)[1, , 2, 3, 4]), -c(291.8887, 287.0233, 289.8808), +c(287.7982, 287.0422, 290.4297), tolerance = 0.0001 ) expect_equal( range(calibrated_data$fcst$data), -c(283.8926, 299.0644), +c(283.5374, 306.2353), tolerance = 0.0001 ) @@ -201,7 +201,7 @@ dim(skill_metrics$rpss) ) expect_equal( as.vector(skill_metrics$rpss[, 2, 3]), -c(-0.2918857, -1.4809143, -1.3842286), +c(-1.153829, -1.114743, -1.392457), tolerance = 0.0001 ) expect_equal(