Skip to content

Commit

Permalink
Merge branch 'develop' into bugfix/atrayano/maxmin_support_for_nan
Browse files Browse the repository at this point in the history
  • Loading branch information
atrayano committed Jan 7, 2025
2 parents 02f81aa + c8ad63f commit 02f3794
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Changed MAPL_ESMFRegridder to require the dstMaskValues to be added as grid attribute to use fixed masking, fixes UFS issue
- Increased formatting width of time index in ExtData2G diagnostic print

### Fixed
Expand Down
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

0 comments on commit 02f3794

Please sign in to comment.