As part of the UK TerraFIRMA project, I am using the heatwave & coldwave recipe: recipe_heatwaves_coldwaves.yml to analyse output from the TerraFIRMA overshoot runs.
I can successfully run the example recipe, which uses CMIP5 output for bcc-csm1-1 (on a 365-day calendar). However, all the TerraFIRMA heat wave/cold wave runs failed, apart from one. It is not clear to me why this one period worked and the rest did not, except that, apart from the historical runs, it is the earliest period (1979-2009) analysed. I also found similar behaviour when using the HadGEM3-GC31-MM CMIP6 datasets. Note: The TerraFIRMA output uses a 360-day calendar.
Neither the Weigel et al paper on ESMValTool v2.0 (https://doi.org/10.5194/gmd-14-3159-2021) nor the online documentation (https://docs.esmvaltool.org/en/latest/recipes/recipe_heatwaves_coldwaves.html) indicate any restrictions in using the recipe.
In the preproc folders, I can see that the required variable for the heatwave/coldspell recipe (tasmax) was extracted successfully in all the runs. The heatwave/coldwave recipe use a R-script: extreme_spells.R. The error is not in this routine, but a routine that it calls ‘WaveDuration’ (which is part of the ClimProjDiags package). The error message (and a search) suggests that it is an issue in converting time as ‘days from a start date’ into a date.
Error in as.POSIXlt.character(x, tz = tz) :
character string is not in a standard unambiguous format
Calls: WaveDuration ... strftime -> format -> as.POSIXlt -> as.POSIXlt.character
I have been looking at the Threshold and WaveDuration routine to understand how they work. As far as I can tell, the date is used to get the day in the year. From my limited debugging, there seems to be an issue in the R Date conversion when using a 360-day calendar. There is a difference between the effective date of the output (2069-01-01) and the date derived in the R package (2065-11-09), which increases the further the date is from the start date (1850-01-01). The newer CFtime package seems better suited for the 360-day calendar used here.
As requested, I attach:
The recipe needs a 'historical' dataset for the reference period. The TerraFIRMA overshoot runs use 'esm-hist'. I cannot upload the modified R script (extreme_spells_local.R), used in the recipe. I replaced:
41,42c41,47
< reference_files <- which(unname(experiment) == "historical")
< projection_files <- which(unname(experiment) != "historical")
---
> if ('esm-hist' %in% experiment) {
> historical <- 'esm-hist'
> } else {
> historical <- 'historical' }
>
> reference_files <- which(unname(experiment) == historical)
> projection_files <- which(unname(experiment) != historical)
As part of the UK TerraFIRMA project, I am using the heatwave & coldwave recipe: recipe_heatwaves_coldwaves.yml to analyse output from the TerraFIRMA overshoot runs.
I can successfully run the example recipe, which uses CMIP5 output for bcc-csm1-1 (on a 365-day calendar). However, all the TerraFIRMA heat wave/cold wave runs failed, apart from one. It is not clear to me why this one period worked and the rest did not, except that, apart from the historical runs, it is the earliest period (1979-2009) analysed. I also found similar behaviour when using the HadGEM3-GC31-MM CMIP6 datasets. Note: The TerraFIRMA output uses a 360-day calendar.
Neither the Weigel et al paper on ESMValTool v2.0 (https://doi.org/10.5194/gmd-14-3159-2021) nor the online documentation (https://docs.esmvaltool.org/en/latest/recipes/recipe_heatwaves_coldwaves.html) indicate any restrictions in using the recipe.
In the preproc folders, I can see that the required variable for the heatwave/coldspell recipe (tasmax) was extracted successfully in all the runs. The heatwave/coldwave recipe use a R-script: extreme_spells.R. The error is not in this routine, but a routine that it calls ‘WaveDuration’ (which is part of the ClimProjDiags package). The error message (and a search) suggests that it is an issue in converting time as ‘days from a start date’ into a date.
I have been looking at the Threshold and WaveDuration routine to understand how they work. As far as I can tell, the date is used to get the day in the year. From my limited debugging, there seems to be an issue in the R Date conversion when using a 360-day calendar. There is a difference between the effective date of the output (2069-01-01) and the date derived in the R package (2065-11-09), which increases the further the date is from the start date (1850-01-01). The newer CFtime package seems better suited for the 360-day calendar used here.
As requested, I attach:
The recipe that you are trying to run, you can find a copy in the
rundirectory in the output directoryrecipe_heatwaves_coldwaves_TF_OS_run_issue.yml
The
main_log_debug.txtfile, this can also be found in therundirectory in the output directorymain_log_debug.txt
The
log.txtfile, with the error from the diagnostic scriptlog.txt
The recipe needs a 'historical' dataset for the reference period. The TerraFIRMA overshoot runs use 'esm-hist'. I cannot upload the modified R script (extreme_spells_local.R), used in the recipe. I replaced: