create_output_grid Function

function create_output_grid(grid_name, lm, rc) result(new_grid)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(inout) :: grid_name
integer, intent(in) :: lm
integer, intent(out), optional :: rc

Return Value type(ESMF_Grid)


Calls

proc~~create_output_grid~~CallsGraph proc~create_output_grid create_output_grid interface~mapl_assert MAPL_Assert proc~create_output_grid->interface~mapl_assert interface~mapl_configsetattribute MAPL_ConfigSetAttribute proc~create_output_grid->interface~mapl_configsetattribute interface~mapl_makedecomposition MAPL_MakeDecomposition proc~create_output_grid->interface~mapl_makedecomposition none~make_grid~4 GridManager%make_grid proc~create_output_grid->none~make_grid~4 proc~mapl_abort MAPL_abort proc~create_output_grid->proc~mapl_abort proc~mapl_configcreate MAPL_ConfigCreate proc~create_output_grid->proc~mapl_configcreate proc~mapl_verify MAPL_Verify proc~create_output_grid->proc~mapl_verify none~make_grid_from_distgrid GridManager%make_grid_from_distGrid none~make_grid~4->none~make_grid_from_distgrid mpi_abort mpi_abort proc~mapl_abort->mpi_abort 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 none~make_grid_from_distgrid->none~make_grid~4 none~make_grid_from_distgrid->proc~mapl_verify none~make_grid_from_distgrid->proc~mapl_return ESMF_AttributeSet ESMF_AttributeSet none~make_grid_from_distgrid->ESMF_AttributeSet none~make_factory~3 GridManager%make_factory none~make_grid_from_distgrid->none~make_factory~3 proc~mapl_return->proc~mapl_throw_exception at at proc~mapl_return->at insert insert proc~mapl_return->insert none~make_factory_from_distgrid GridManager%make_factory_from_distGrid none~make_factory~3->none~make_factory_from_distgrid

Called by

proc~~create_output_grid~~CalledByGraph proc~create_output_grid create_output_grid program~time_ave time_ave program~time_ave->proc~create_output_grid

Source Code

   function create_output_grid(grid_name,lm,rc) result(new_grid)
      type(ESMF_Grid) :: new_grid
      character(len=*), intent(inout) :: grid_name
      integer, intent(in) :: lm
      integer, optional, intent(out) :: rc

      type(ESMF_Config) :: cf
      integer :: nn,im_world,jm_world,nx, ny
      character(len=5) :: imsz,jmsz
      character(len=2) :: pole,dateline

      nn   = len_trim(grid_name)
      imsz = grid_name(3:index(grid_name,'x')-1)
      jmsz = grid_name(index(grid_name,'x')+1:nn-3)
      pole = grid_name(1:2)
      dateline = grid_name(nn-1:nn)
      read(IMSZ,*) im_world
      read(JMSZ,*) jm_world

      cf = MAPL_ConfigCreate(_RC)
      call MAPL_ConfigSetAttribute(cf,value=lm, label=trim(grid_name)//".LM:",_RC)
      if (dateline=='CF') then
         call MAPL_MakeDecomposition(nx,ny,reduceFactor=6,_RC)
         call MAPL_ConfigSetAttribute(cf,value=NX, label=trim(grid_name)//".NX:",_RC)
         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, label=trim(grid_name)//".NY:",_RC)
      else if (dateline=='TM') then
         _FAIL("Tripolar not yet implemented for outpout")
      else
         call MAPL_MakeDecomposition(nx,ny,_RC)
         call MAPL_ConfigSetAttribute(cf,value=NX, label=trim(grid_name)//".NX:",_RC)
         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
            _FAIL("regional lat-lon output not supported")
         end if
      end if

      new_grid = grid_manager%make_grid(cf,prefix=trim(grid_name)//".",_RC)
      if (present(rc)) then
         rc=_SUCCESS
      end if
   end function create_output_grid