ESCOMP / ESCOMP/CMEPS

Calendar bug in med_phases_profile_mod

Open
#432 0 comments 6 reactions 0 assignees View on GitHub
Dominant language
Fortran
Stars
35
Forks
106
Avg merge
6d 5h
Merged PRs (30d)
4

Description

The routine [`med_phases_profile` attempts to get the wall clock time](https://github.com/ESCOMP/CMEPS/blob/7e0908cb958fc36002225efe00a3181f24c41c7a/mediator/med_phases_profile_mod.F90#L173-L179) using the calendar [set in the NUOPC `CLOCK_attributes`](https://github.com/ESCOMP/CMEPS/blob/7e0908cb958fc36002225efe00a3181f24c41c7a/cesm/driver/ensemble_driver.F90#L187-L199). 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:

```bash
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.