Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #3280 #3281

Merged
merged 4 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions base/MAPL_EsmfRegridder.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1431,13 +1431,13 @@ subroutine create_route_handle(this, kind, rc)
real(real64), pointer :: src_dummy_r8(:,:), dst_dummy_r8(:,:)
type (ESMF_Field) :: src_field, dst_field

integer :: srcTermProcessing
integer :: srcTermProcessing, num_mask_values
integer, pointer :: factorIndexList(:,:)
integer, allocatable :: dstMaskValues(:)
real(ESMF_KIND_R8), pointer :: factorList(:)
type(ESMF_RouteHandle) :: dummy_rh
type(ESMF_UnmappedAction_Flag) :: unmappedaction
logical :: global, isPresent, has_mask
logical :: global, isPresent, has_mask, has_dstMaskValues
type(RegridderSpecRouteHandleMap), pointer :: route_handles, transpose_route_handles
type(ESMF_RouteHandle) :: route_handle, transpose_route_handle
character(len=ESMF_MAXPATHLEN) :: rh_file,rh_trans_file
Expand Down Expand Up @@ -1512,6 +1512,13 @@ subroutine create_route_handle(this, kind, rc)
end if
call ESMF_GridGetItem(spec%grid_out,itemflag=ESMF_GRIDITEM_MASK, &
staggerloc=ESMF_STAGGERLOC_CENTER, isPresent = has_mask, _RC)
call ESMF_AttributeGet(spec%grid_out, name=MAPL_DESTINATIONMASK, isPresent=has_dstMaskValues, _RC)
if (has_dstMaskValues) then
_ASSERT(has_mask, "masking destination values when no masks is present")
call ESMF_AttributeGet(spec%grid_out, name=MAPL_DESTINATIONMASK, itemcount=num_mask_values, _RC)
allocate(dstMaskValues(num_mask_values), _STAT)
call ESMF_AttributeGet(spec%grid_out, name=MAPL_DESTINATIONMASK, valuelist=dstMaskValues, _RC)
end if

counter = counter + 1

Expand All @@ -1521,7 +1528,6 @@ subroutine create_route_handle(this, kind, rc)
call ESMF_AttributeGet(spec%grid_in, name='Global',value=global,rc=status)
if (.not.global) unmappedaction=ESMF_UNMAPPEDACTION_IGNORE
end if
if (has_mask) dstMaskValues = [MAPL_MASK_OUT] ! otherwise unallocated
select case (spec%regrid_method)
case (REGRID_METHOD_BILINEAR, REGRID_METHOD_BILINEAR_MONOTONIC)

Expand Down
3 changes: 3 additions & 0 deletions base/MAPL_XYGridFactory.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,9 @@ subroutine add_mask(this,grid,rc)
mask = MAPL_MASK_IN
where(fptr==MAPL_UNDEF) mask = MAPL_MASK_OUT

call ESMF_AttributeSet(grid, name=MAPL_DESTINATIONMASK, &
itemCount=1, valueList=[MAPL_MASK_OUT], _RC)

_RETURN(_SUCCESS)
end subroutine add_mask

Expand Down
1 change: 1 addition & 0 deletions shared/Constants/InternalConstants.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module MAPL_InternalConstantsMod
character(len=*), parameter :: MAPL_GRID_NAME_DEFAULT = 'UNKNOWN'
character(len=*), parameter :: MAPL_GRID_FILE_NAME_DEFAULT = 'UNKNOWN'
character(len=*), parameter :: MAPL_CF_COMPONENT_SEPARATOR = '.'
character(len=*), parameter :: MAPL_DESTINATIONMASK = "MAPL_DestinationMask"

enum, bind(c)
enumerator MAPL_TimerModeOld
Expand Down
Loading