Skip to content

Commit

Permalink
Skip 'cpl_scalars' field when dumping export state
Browse files Browse the repository at this point in the history
  • Loading branch information
DusanJovic-NOAA committed Jul 5, 2024
1 parent a1db89b commit 53b6b22
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions cpl/module_cap_cpl.F90
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ subroutine State_RWFields_tiles(state,filename,rc)
endif
enddo

fieldbundle = ESMF_FieldBundleCreate(rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

call ESMF_LogWrite(trim(subname)//": write "//trim(filename), ESMF_LOGMSG_INFO, rc=rc)

do ifld=1, fieldCount
Expand All @@ -158,6 +161,13 @@ subroutine State_RWFields_tiles(state,filename,rc)
call ESMF_ArrayGet(array, distgrid=distgrid, dimCount=dimCount, tileCount=tileCount, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

! skip 'cpl_scalars' field because it has tileCount == 1, while all other fields have 6.
! This causes the following error:
! 20240705 134459.788 ERROR PET000 ESMCI_IO.C:1614 ESMCI::IO::checkNtiles() Wrong data value - New number of tiles (6) does not match previously-set number of tiles (1) for this IO object. All arrays handled by a given IO object must have the same number of tiles.
if (trim(fldNameList(ifld)) == 'cpl_scalars') then
cycle
endif

allocate(fieldDimLen(fieldDimCount))

allocate(minIndexPTile(dimCount, tileCount))
Expand Down Expand Up @@ -221,13 +231,10 @@ subroutine State_RWFields_tiles(state,filename,rc)
deallocate(gridded_dim_labels)
deallocate(ungridded_dim_labels)

enddo

fieldbundle = ESMF_FieldBundleCreate(rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
call ESMF_FieldBundleAdd(fieldbundle, (/flds(ifld)/), rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

call ESMF_FieldBundleAdd(fieldbundle, flds, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
enddo

call ESMF_FieldBundleWrite(fieldbundle, fileName=trim(filename), convention=convention, purpose=purpose, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
Expand Down

0 comments on commit 53b6b22

Please sign in to comment.