Skip to content

Commit

Permalink
Merge pull request #3233 from GEOS-ESM/feature/mathomp4/weight-logger
Browse files Browse the repository at this point in the history
Add loggers when reading and writing weights
  • Loading branch information
mathomp4 authored Dec 10, 2024
2 parents c3d2046 + b134aa2 commit 4dbc5e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added loggers when writing or reading weight files

### Changed

### Fixed
Expand Down
7 changes: 7 additions & 0 deletions base/MAPL_EsmfRegridder.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module MAPL_EsmfRegridderMod
use MAPL_RegridderSpecRouteHandleMap
use MAPL_MAPLGrid
use MAPL_ConstantsMod
use pFlogger, only: logging, Logger
implicit none
private

Expand Down Expand Up @@ -1442,6 +1443,9 @@ subroutine create_route_handle(this, kind, rc)
character(len=ESMF_MAXPATHLEN) :: rh_file,rh_trans_file
logical :: rh_file_exists, file_weights, compute_transpose

type(Logger), pointer :: lgr
lgr => logging%get_logger('MAPL')

if (kind == ESMF_TYPEKIND_R4) then
route_handles => route_handles_r4
transpose_route_handles => transpose_route_handles_r4
Expand All @@ -1468,6 +1472,7 @@ subroutine create_route_handle(this, kind, rc)
rh_file_exists = .false.
end if
if (rh_file_exists) then
call lgr%info('Reading weight file: %a', trim(rh_file))
route_handle = ESMF_RouteHandleCreate(rh_file,_RC)
call route_handles%insert(spec, route_handle)
if (compute_transpose) then
Expand Down Expand Up @@ -1586,8 +1591,10 @@ subroutine create_route_handle(this, kind, rc)
call ESMF_FieldDestroy(dst_field, rc=status)
_VERIFY(status)
if (file_weights) then
call lgr%info('Writing weight file: %a', trim(rh_file))
call ESMF_RouteHandleWrite(route_handle,rh_file,_RC)
if (compute_transpose) then
call lgr%info('Writing transpose weight file: %a', trim(rh_trans_file))
call ESMF_RouteHandleWrite(transpose_route_handle,rh_trans_file,_RC)
end if
end if
Expand Down

0 comments on commit 4dbc5e3

Please sign in to comment.