From 6e68ad269b8b6344d90e1d37bdcbf4555309f238 Mon Sep 17 00:00:00 2001 From: anton-climate Date: Mon, 26 Feb 2024 08:51:36 +1100 Subject: [PATCH] Move setting use_leap_years to ice_calendar --- cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 | 6 +----- cicecore/shared/ice_calendar.F90 | 9 ++++++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 index 7f9e266c2..4a4e22666 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 @@ -26,7 +26,7 @@ module ice_comp_nuopc use ice_calendar , only : force_restart_now, write_ic use ice_calendar , only : idate, idate0, mday, mmonth, myear, year_init, month_init, day_init use ice_calendar , only : msec, dt, calendar, calendar_type, nextsw_cday, istep - use ice_calendar , only : ice_calendar_noleap, ice_calendar_gregorian, use_leap_years + use ice_calendar , only : ice_calendar_noleap, ice_calendar_gregorian use ice_kinds_mod , only : dbl_kind, int_kind, char_len, char_len_long use ice_fileunits , only : nu_diag, nu_diag_set, inst_index, inst_name use ice_fileunits , only : inst_suffix, release_all_fileunits, flush_fileunit @@ -675,10 +675,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) else if(mastertask) write(nu_diag,*) trim(subname)//'WARNING: pio_typename from driver needs to be set for netcdf output to work' end if - ! Set use_leap_years as some CICE calls use this instead of the calendar type - call ESMF_TimeGet( currTime, calkindflag=esmf_caltype, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (esmf_caltype == ESMF_CALKIND_GREGORIAN) use_leap_years = .true. #else diff --git a/cicecore/shared/ice_calendar.F90 b/cicecore/shared/ice_calendar.F90 index 17f18edb2..955cdeb7b 100644 --- a/cicecore/shared/ice_calendar.F90 +++ b/cicecore/shared/ice_calendar.F90 @@ -211,7 +211,14 @@ subroutine init_calendar nstreams = 0 #ifdef CESMCOUPLED - ! calendar_type set by coupling + ! calendar_type set by coupling + ! set use_leap_years for consistency + if (calendar_type == trim(ice_calendar_gregorian)) then + use_leap_years = .true. + else + use_leap_years = .false. + endif + #else calendar_type = '' if (use_leap_years) then