CMEPS icon indicating copy to clipboard operation
CMEPS copied to clipboard

Extending Remapping Background Fill Types

Open danrosen25 opened this issue 4 years ago • 1 comments

@uturuncoglu @mvertens @jedwards4b

Currently we have two background fill types handling unmapped points and they are built directly into the mapping type. We'd like to separate the background fill option from the mapping type. This will allow developers to add new fill types and mapping types independently and users to use more complex combinations.

Current Background Fill Types

  • nearest neighbor source to destination (nstod)
    • mapnstod_consd
    • mapnstod_consf
    • mapnstod_consd
  • constant value
    • mapfillv_bilnr

Pseudo Code med_map_mod.F90: subroutine med_map_field

  subroutine med_map_field(field_src, field_dst, routehandles, maptype, filltype, fldname, rc)
    ! input/output variables
    integer                , intent(in)           :: filltype
    ! local variables
    type(ESMF_Region_Flag) :: zeroregion

    if (filltype == nstod) then
       call ESMF_FieldRegrid(field_src, field_dst, routehandle=RouteHandles(mapnstod), termorderflag=ESMF_TERMORDER_SRCSEQ, checkflag=checkflag, zeroregion=ESMF_REGION_TOTAL, rc=rc)
       zeroregion = ESMF_REGION_SELECT
    else if (filltype == const) then
       call ESMF_FieldFill(field_dst, dataFillScheme="const", const1=fillValue, rc=rc)
       zeroregion = ESMF_REGION_SELECT
    else if (filltype == none) then
       zeroregion = ESMF_REGION_TOTAL
    else
       ERROR - Unsupported filltype
    end if ! filltype
    if (dbug_flag > 1) then
       call Field_diagnose(field_dst, lfldname, " --> after fill: ", rc=rc)       
    end if

    call ESMF_FieldRegrid(field_src, field_dst, routehandle=RouteHandles(maptype), termorderflag=ESMF_TERMORDER_SRCSEQ, checkflag=checkflag, zeroregion=zeroregion, rc=rc)
    if (dbug_flag > 1) then
       call Field_diagnose(field_dst, lfldname, " --> after remap: ", rc=rc)
    end if

danrosen25 avatar Feb 25 '21 17:02 danrosen25