create_cf Function

public function create_cf(grid_name, im_world, jm_world, nx, ny, lm, cs_stretch_param, lon_range, lat_range, tripolar_file, rc) result(cf)

Uses

  • proc~~create_cf~~UsesGraph proc~create_cf create_cf module~mapl_configmod MAPL_ConfigMod proc~create_cf->module~mapl_configmod ESMF ESMF module~mapl_configmod->ESMF module~mapl_exceptionhandling MAPL_ExceptionHandling module~mapl_configmod->module~mapl_exceptionhandling module~mapl_errorhandlingmod MAPL_ErrorHandlingMod module~mapl_exceptionhandling->module~mapl_errorhandlingmod module~mapl_throwmod MAPL_ThrowMod module~mapl_exceptionhandling->module~mapl_throwmod module~mapl_errorhandlingmod->module~mapl_throwmod mpi mpi module~mapl_errorhandlingmod->mpi

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: grid_name
integer, intent(in) :: im_world
integer, intent(in) :: jm_world
integer, intent(in) :: nx
integer, intent(in) :: ny
integer, intent(in) :: lm
real, intent(in) :: cs_stretch_param(3)
real, intent(in) :: lon_range(2)
real, intent(in) :: lat_range(2)
character(len=*), intent(in) :: tripolar_file
integer, intent(out), optional :: rc

Return Value type(ESMF_Config)


Calls

proc~~create_cf~~CallsGraph proc~create_cf create_cf interface~mapl_assert MAPL_Assert proc~create_cf->interface~mapl_assert interface~mapl_configsetattribute MAPL_ConfigSetAttribute proc~create_cf->interface~mapl_configsetattribute proc~mapl_configcreate MAPL_ConfigCreate proc~create_cf->proc~mapl_configcreate proc~mapl_verify MAPL_Verify proc~create_cf->proc~mapl_verify ESMF_ConfigCreate ESMF_ConfigCreate proc~mapl_configcreate->ESMF_ConfigCreate buffer buffer proc~mapl_configcreate->buffer proc~mapl_return MAPL_Return proc~mapl_configcreate->proc~mapl_return proc~mapl_throw_exception MAPL_throw_exception proc~mapl_verify->proc~mapl_throw_exception proc~mapl_return->proc~mapl_throw_exception at at proc~mapl_return->at insert insert proc~mapl_return->insert

Called by

proc~~create_cf~~CalledByGraph proc~create_cf create_cf proc~create_grid regrid_support%create_grid proc~create_grid->proc~create_cf proc~process_command_line~2 regrid_support%process_command_line proc~process_command_line~2->proc~create_grid proc~main main proc~main->proc~process_command_line~2 program~regrid_util Regrid_Util program~regrid_util->proc~main

Source Code

    function create_cf(grid_name,im_world,jm_world,nx,ny,lm,cs_stretch_param,lon_range,lat_range,tripolar_file,rc) result(cf)
       use MAPL_ConfigMod
       type(ESMF_Config)              :: cf
       character(len=*), intent(in) :: grid_name
       integer, intent(in)          :: im_world,jm_world
       integer, intent(in)          :: nx,ny
       integer, intent(in)          :: lm
       real, intent(in)             :: cs_stretch_param(3)
       real, intent(in)             :: lon_range(2)
       real, intent(in)             :: lat_range(2)
       character(len=*), intent(in) :: tripolar_file
       integer, optional, intent(out) :: rc

       integer :: status
       character(len=2) :: pole,dateline
       integer :: nn

       nn = len_trim(grid_name)
       dateline=grid_name(nn-1:nn)
       pole=grid_name(1:2)

       cf = MAPL_ConfigCreate(_RC)
       call MAPL_ConfigSetAttribute(cf,value=NX, label=trim(grid_name)//".NX:",_RC)
       call MAPL_ConfigSetAttribute(cf,value=lm, label=trim(grid_name)//".LM:",_RC)
       if (dateline=='CF') then
          call MAPL_ConfigSetAttribute(cf,value="Cubed-Sphere", label=trim(grid_name)//".GRID_TYPE:",_RC)
          call MAPL_ConfigSetAttribute(cf,value=6, label=trim(grid_name)//".NF:",_RC)
          call MAPL_ConfigSetAttribute(cf,value=im_world,label=trim(grid_name)//".IM_WORLD:",_RC)
          call MAPL_ConfigSetAttribute(cf,value=ny/6, label=trim(grid_name)//".NY:",_RC)
          if (any(cs_stretch_param/=uninit)) then
             call MAPL_ConfigSetAttribute(cf,value=cs_stretch_param(1),label=trim(grid_name)//".STRETCH_FACTOR:",_RC)
             call MAPL_ConfigSetAttribute(cf,value=cs_stretch_param(2),label=trim(grid_name)//".TARGET_LON:",_RC)
             call MAPL_ConfigSetAttribute(cf,value=cs_stretch_param(3),label=trim(grid_name)//".TARGET_LAT:",_RC)
          end if
       else if (dateline=='TM') then
          call MAPL_ConfigSetAttribute(cf,value="Tripolar", label=trim(grid_name)//".GRID_TYPE:",_RC)
          call MAPL_ConfigSetAttribute(cf,value=im_world,label=trim(grid_name)//".IM_WORLD:",_RC)
          call MAPL_ConfigSetAttribute(cf,value=jm_world,label=trim(grid_name)//".JM_WORLD:",_RC)
          call MAPL_ConfigSetAttribute(cf,value=ny, label=trim(grid_name)//".NY:",_RC)
          _ASSERT(tripolar_file /= "empty","asked for tripolar output but did not specify the coordinate file")
          call MAPL_ConfigSetAttribute(cf,value=tripolar_file,label=trim(grid_name)//".GRIDSPEC:",_RC)
       else
          call MAPL_ConfigSetAttribute(cf,value="LatLon", label=trim(grid_name)//".GRID_TYPE:",_RC)
          call MAPL_ConfigSetAttribute(cf,value=im_world,label=trim(grid_name)//".IM_WORLD:",_RC)
          call MAPL_ConfigSetAttribute(cf,value=jm_world,label=trim(grid_name)//".JM_WORLD:",_RC)
          call MAPL_ConfigSetAttribute(cf,value=ny, label=trim(grid_name)//".NY:",_RC)
          call MAPL_ConfigSetAttribute(cf,value=pole, label=trim(grid_name)//".POLE:",_RC)
          call MAPL_ConfigSetAttribute(cf,value=dateline, label=trim(grid_name)//".DATELINE:",_RC)
          if (pole=='XY' .and. dateline=='XY') then
             _ASSERT(all(lon_range/=uninit),'if regional must specify lon_range')
             _ASSERT(all(lat_range/=uninit),'if regional must specify lat_range')
             call MAPL_ConfigSetAttribute(cf,value=lon_range,label=trim(grid_name)//".LON_RANGE:",_RC)
             call MAPL_ConfigSetAttribute(cf,value=lat_range,label=trim(grid_name)//".LAT_RANGE:",_RC)
          end if
       end if

     end function create_cf