Change get_average_days_per_year to use ESMF_CalendarGet
- Dominant language
- Fortran
- Stars
- 352
- Forks
- 361
- Avg merge
- 6d 6h
- Merged PRs (30d)
- 8
Description
In an upcoming tag, I'm going to introduce a new function in `clm_time_manager`, `get_average_days_per_year` (see also https://github.com/ESCOMP/CTSM/issues/1612 ). Ideally, this would use the `ESMF_CalendarGet` subroutine, returning `daysPerYear + real(daysPerYrDn, r8)/real(daysPerYrDd, r8)`. However, I currently cannot use that subroutine for two reasons:
(1) We don't use the real ESMF library in all builds, and the ESMF WRF time manager that we use in other situations doesn't support `ESMF_CalendarGet`.
(2) It appears that there is a bug in `ESMF_CalendarGet` for Gregorian calendars: it returns information appropriate for a noleap calendar, not for a Gregorian calendar.
Thus, we need to wait until both (1) we can rely on using the real ESMF library in all builds, and (2) the above ESMF bug is resolved and we can rely on users having a version of the ESMF library with this bug fix included. I am therefore marking this issue as "blocked", even though we don't have specific issues that block it.
Once we can rely on the above, we should change the implementation of `get_average_days_per_year` as noted above.
We should also introduce unit tests of this function for both a NOLEAP and a GREGORIAN calendar.
However, before we add these unit tests, we will need to change the unit test build to use the real esmf library instead of the esmf wrf time manager. This will involve getting rid of stuff in the top-level CMakeLists.txt that refers to the esmf wrf time manager, and adding the appropriate includes and links for the esmf library.
Contributor guide
Assessment
This issue has not been assessed yet.