From ec68112f6396e6370c7c9fa071b6d9543d618c6e Mon Sep 17 00:00:00 2001 From: vagudets Date: Wed, 26 Jun 2024 12:38:29 +0200 Subject: [PATCH 1/3] Remove January 1993 start date for UKMO --- modules/Loading/R/dates2load.R | 18 +++++-- recipes/atomic_recipes/recipe_ukmo-tas.yml | 57 ++++++++++++++++++++++ 2 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 recipes/atomic_recipes/recipe_ukmo-tas.yml diff --git a/modules/Loading/R/dates2load.R b/modules/Loading/R/dates2load.R index f084ce62..f2d39c7a 100644 --- a/modules/Loading/R/dates2load.R +++ b/modules/Loading/R/dates2load.R @@ -18,15 +18,28 @@ library(lubridate) dates2load <- function(recipe, logger) { temp_freq <- recipe$Analysis$Variables$freq + system_name <- recipe$Analysis$Datasets$System$name recipe <- recipe$Analysis$Time # hcst dates file_dates <- paste0(strtoi(recipe$hcst_start):strtoi(recipe$hcst_end), recipe$sdate) - + + # Note: UKMO models are always missing the start date of January 1993. + # This piece of code removes that date from the start dates. + UKMO_MODELS <- c("UK-MetOffice-Glosea600", "UK-MetOffice-Glosea601", + "UKMO-System602") + if ((system_name %in% UKMO_MODELS) && ("19930101" %in% file_dates)) { + file_dates <- file_dates[-(which(file_dates == '19930101'))] + warn(logger, + paste("January 1993 start date is not available for", system_name, + "and has been removed from the list of start dates.")) + } + + # Add dimensions to the vector 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") { @@ -38,7 +51,6 @@ dates2load <- function(recipe, logger) { paste("fcst_year empty in the recipe, creating empty fcst object...")) } return(list(hcst = file_dates, fcst = file_dates.fcst)) - ## TODO: document header of fun } # adds the correspondent dims to each sdate array diff --git a/recipes/atomic_recipes/recipe_ukmo-tas.yml b/recipes/atomic_recipes/recipe_ukmo-tas.yml new file mode 100644 index 00000000..bea2bda5 --- /dev/null +++ b/recipes/atomic_recipes/recipe_ukmo-tas.yml @@ -0,0 +1,57 @@ +Description: + Author: V. Agudetse + Description: Analysis of MF System 7 with temperature +Analysis: + Horizon: Seasonal + Variables: + name: tas + freq: monthly_mean + Datasets: + System: + name: UK-MetOffice-Glosea600 + Multimodel: False + Reference: + name: ERA5 + Time: + sdate: '0101' + fcst_year: '2020' + hcst_start: '1993' + hcst_end: '2010' + ftime_min: 1 + ftime_max: 2 + Region: + latmin: 30 + latmax: 70 + lonmin: -20 + lonmax: 40 + Regrid: + method: bilinear + type: to_system + Workflow: + Anomalies: + compute: yes # yes/no, default yes + cross_validation: yes # yes/no, default yes + save: 'all' # 'all'/'none'/'exp_only'/'fcst_only' + Calibration: + method: mse_min + save: 'none' # 'all'/'none'/'exp_only'/'fcst_only' + Skill: + metric: BSS10 BSS90 + save: 'all' # 'all'/'none' + Probabilities: + percentiles: [[1/3, 2/3], [1/10, 9/10]] + save: 'percentiles_only' # 'all'/'none'/'bins_only'/'percentiles_only' + Visualization: + plots: skill_metrics, forecast_ensemble_mean, most_likely_terciles + multi_panel: no + projection: lambert_europe + Indicators: + index: no + ncores: 10 + remove_NAs: yes + Output_format: S2S4E +Run: + Loglevel: INFO + Terminal: yes + output_dir: /esarchive/scratch/vagudets/auto-s2s-outputs/ + code_dir: /esarchive/scratch/vagudets/repos/auto-s2s/ -- GitLab From 197a2d49b80007ede652c93e73750f556d1c0a96 Mon Sep 17 00:00:00 2001 From: vagudets Date: Fri, 30 May 2025 16:31:03 +0200 Subject: [PATCH 2/3] Remove first year from data when loading UKMO if start date is January 1993 --- modules/Loading/R/dates2load.R | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/Loading/R/dates2load.R b/modules/Loading/R/dates2load.R index 1d3fcbaa..203922f0 100644 --- a/modules/Loading/R/dates2load.R +++ b/modules/Loading/R/dates2load.R @@ -21,11 +21,22 @@ dates2load <- function(recipe, logger) { # temporal frequency of the variable requested # the details in $Time request: hcst period, forecast times ... temp_freq <- recipe$Analysis$Variables$freq + system_name <- recipe$Analysis$Datasets$System$name recipe <- recipe$Analysis$Time if (temp_freq == "monthly_mean") { - # hcst dates + # hcst dates file_dates <- paste0(strtoi(recipe$hcst_start):strtoi(recipe$hcst_end), recipe$sdate) + # Note: UKMO models are always missing the start date of January 1993. + # This piece of code removes that date from the start dates. + UKMO_MODELS <- c("UK-MetOffice-Glosea600", "UK-MetOffice-Glosea601", + "UK-MetOffice-Glosea602", "UK-MetOffice-Glosea603") + if ((system_name %in% UKMO_MODELS) && (file_dates[1] == "19930101")) { + file_dates <- file_dates[-1] + warn(logger, + paste("January 1993 start date is not available for", system_name, + "and has been removed from the list of start dates.")) + } ## TODO: Add dims? file_dates <- .add_dims(file_dates) } else if (temp_freq == "weekly_mean") { -- GitLab From da4ec29fef876cbdfc1f5f9fbf0c8b4b79c48598 Mon Sep 17 00:00:00 2001 From: vagudets Date: Mon, 2 Jun 2025 10:59:40 +0200 Subject: [PATCH 3/3] Add UKMO602 grid --- conf/grid_description/griddes_ukmo602.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 conf/grid_description/griddes_ukmo602.txt diff --git a/conf/grid_description/griddes_ukmo602.txt b/conf/grid_description/griddes_ukmo602.txt new file mode 100644 index 00000000..1a79ef46 --- /dev/null +++ b/conf/grid_description/griddes_ukmo602.txt @@ -0,0 +1,17 @@ +# +# gridID 2 +# +gridtype = lonlat +gridsize = 64800 +xsize = 360 +ysize = 180 +xname = lon +xlongname = "longitude" +xunits = "degrees_east" +yname = lat +ylongname = "latitude" +yunits = "degrees_north" +xfirst = 0.5 +xinc = 1 +yfirst = 89.5 +yinc = -1 -- GitLab