ESCOMP / CMEPS

NUOPC Community Mediator for Earth Prediction Systems
https://escomp.github.io/CMEPS/
21 stars 77 forks source link

Extending Remapping Background Fill Types #159

Open danrosen25 opened 3 years ago

danrosen25 commented 3 years ago

@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

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
uturuncoglu commented 3 years ago

@mvertens @jedwards4b we think that the fill type could be controlled via nuopc.runconfig or nems.configure but we could make the default as nstod and the existing applications such as CESM and S2S and it will be find not to provide fill typ. For fill type const we could also add additional variable to ESMF configuration file to set the actual fill value. This will lead to very flexible environment especially for the regional applications.