Skip to content

Migrate idfupd.F90 from integer-packed datetime to ESMF_Time (MAPL3 migration) #1079

Description

@tclune

Summary

As part of the MAPL3 migration, MAPL_UnpackDateTime (and all legacy integer-packed time) is being removed from MAPL_Base (tracked in GEOS-ESM/MAPL#4805 and GEOS-ESM/MAPL#4811). idfupd.F90 must be updated to use ESMF_Time directly — no integer-packed datetime should remain.

File

src/Applications/@GEOSgcm_App/idfupd.F90

Background

idfupd.F90 uses MAPL_GetResource to read 2-element integer arrays (datetime(2)) from RC files and from the cap_restart file, where datetime(1) is YYYYMMDD and datetime(2) is HHMMSS. It then calls MAPL_UnpackDateTime to extract the individual components (yy, mm, dd, h, m, s) before passing them to ESMF_TimeSet.

There are 4 call sites (lines ~540, ~565, ~595, ~698).

Change needed

The goal is to eliminate the integer datetime(2) intermediate entirely and work with ESMF_Time directly:

  1. For RC file resources (BEG_DATE:, END_DATE:, JOB_SGMT:/JOB_DURATION:): Replace MAPL_GetResource(..., datetime, label=...) + MAPL_UnpackDateTime + ESMF_TimeSet with a direct read of an ISO8601 datetime string using MAPL_GetResource (string overload) and ESMF_TimeSet string interface — or read year/month/day/hour/minute/second components individually as already done in the fallback branches below each if(STATUS==ESMF_SUCCESS) block, and use ESMF_TimeSet(yy=...,mm=...,dd=...,h=...,m=...,s=...) directly.

  2. For cap_restart file (line ~695-698): The file is read as read(UNIT,100) datetime with format (i8.8,1x,i6.6). Replace with reading the two integers directly into component variables and calling ESMF_TimeSet with keyword arguments — or update the restart format to ISO8601 if the broader team agrees.

  3. Remove integer :: datetime(2), all MAPL_UnpackDateTime calls, and the corresponding use of MAPL_UnpackDateTime.

Note

The fallback branches (individual BEG_YY:, BEG_MM:, etc. resource items) already use the right pattern — the MAPL_UnpackDateTime branches should be brought in line with those.

Blocks

GEOS-ESM/MAPL#4811 (deletion of MAPL_UnpackDateTime from Base_Base.F90)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions