ESCOMP / CMEPS

NUOPC Community Mediator for Earth Prediction Systems
https://escomp.github.io/CMEPS/
24 stars 79 forks source link

Calendar bug in med_phases_profile_mod #432

Open dougiesquire opened 9 months ago

dougiesquire commented 9 months ago

The routine med_phases_profile attempts to get the wall clock time using the calendar set in the NUOPC CLOCK_attributes. This can cause issues if the calendar is not GREGORIAN. For example, today is a leap day so an error is thrown trying to run any experiment using a NO_LEAP calendar:

20240229 134349.633 ERROR            PET00 ESMCI_Calendar.C:1161 ESMCI::Calendar::convertToTime() Input argument out of range  - ; NoLeap: for month 2, dd=29 > 28 days in the month.
20240229 134349.633 ERROR            PET00 ESMCI_Time.C:333 ESMCI::Time::set() Input argument out of range  - Internal subroutine call returned Error
20240229 134349.633 ERROR            PET00 ESMCI_Time.C:870 ESMCI::Time::syncToRealTime() Input argument out of range  - Internal subroutine call returned Error
20240229 134349.633 ERROR            PET00 ESMF_Time.F90:1485 ESMF_TimeSyncToRealTime() Input argument out of range  - Internal subroutine call returned Error
20240229 134349.633 ERROR            PET00 med_phases_profile_mod.F90:176 Input argument out of range  - Passing error in return code
20240229 134349.633 ERROR            PET00 MED:src/addon/NUOPC/src/NUOPC_ModelBase.F90:2207 Input argument out of range  - Passing error in return code
20240229 134349.633 ERROR            PET00 ESM0001:src/addon/NUOPC/src/NUOPC_Driver.F90:3642 Input argument out of range  - Phase 'med_phases_profile' Run for modelComp 1 did not return ESMF_SUCCESS
20240229 134349.633 ERROR            PET00 ESM0001:src/addon/NUOPC/src/NUOPC_Driver.F90:3880 Input argument out of range  - Passing error in return code
20240229 134349.633 ERROR            PET00 ESM0001:src/addon/NUOPC/src/NUOPC_Driver.F90:3557 Input argument out of range  - Passing error in return code
20240229 134349.633 ERROR            PET00 ensemble:src/addon/NUOPC/src/NUOPC_Driver.F90:3642 Input argument out of range  - Phase 'RunPhase1' Run for modelComp 1 did not return ESMF_SUCCESS
20240229 134349.633 ERROR            PET00 ensemble:src/addon/NUOPC/src/NUOPC_Driver.F90:3880 Input argument out of range  - Passing error in return code
20240229 134349.633 ERROR            PET00 ensemble:src/addon/NUOPC/src/NUOPC_Driver.F90:3557 Input argument out of range  - Passing error in return code
20240229 134349.633 ERROR            PET00 esmApp.F90:143 Input argument out of range  - Passing error in return code

The easy fix is to initialize wallclocktime in med_phases_profile using calkindflag=ESMF_CALKIND_GREGORIAN. I can confirm that this fixed the issue for me today. If you agree, I'm happy to submit a PR with the fix.