MAPL_GridGet Subroutine

public subroutine MAPL_GridGet(GRID, globalCellCountPerDim, localCellCountPerDim, RC)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Grid), intent(in) :: GRID
integer, intent(inout), optional :: globalCellCountPerDim(:)
integer, intent(inout), optional :: localCellCountPerDim(:)
integer, intent(out), optional :: RC

Calls

proc~~mapl_gridget~~CallsGraph proc~mapl_gridget mapl_MaplGrid::MAPL_GridGet ESMF_AttributeGet ESMF::ESMF_AttributeGet proc~mapl_gridget->ESMF_AttributeGet ESMF_GridGet ESMF::ESMF_GridGet proc~mapl_gridget->ESMF_GridGet proc~mapl_gridhasde mapl_MaplGrid::MAPL_GridHasDE proc~mapl_gridget->proc~mapl_gridhasde proc~mapl_return MAPL_ErrorHandlingMod::MAPL_Return proc~mapl_gridget->proc~mapl_return proc~mapl_verify MAPL_ErrorHandlingMod::MAPL_Verify proc~mapl_gridget->proc~mapl_verify proc~mapl_gridhasde->ESMF_GridGet proc~mapl_gridhasde->proc~mapl_return proc~mapl_gridhasde->proc~mapl_verify ESMF_DELayoutGet ESMF::ESMF_DELayoutGet proc~mapl_gridhasde->ESMF_DELayoutGet ESMF_DistGridGet ESMF::ESMF_DistGridGet proc~mapl_gridhasde->ESMF_DistGridGet at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_ThrowMod::MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception

Called by

proc~~mapl_gridget~~CalledByGraph proc~mapl_gridget mapl_MaplGrid::MAPL_GridGet none~check_chunking MAPL_GriddedIOMod::MAPL_GriddedIO%check_chunking none~check_chunking->proc~mapl_gridget none~evaluate_box_mask MAPL_ExtDataMask::ExtDataMask%evaluate_box_mask none~evaluate_box_mask->proc~mapl_gridget none~get_basis MAPL_AbstractGridFactoryMod::AbstractGridFactory%get_basis none~get_basis->proc~mapl_gridget none~request_data_from_file MAPL_GriddedIOMod::MAPL_GriddedIO%request_data_from_file none~request_data_from_file->proc~mapl_gridget none~set_default_chunking MAPL_GriddedIOMod::MAPL_GriddedIO%set_default_chunking none~set_default_chunking->proc~mapl_gridget none~setup_eta_to_pressure MAPL_VerticalDataMod::verticalData%setup_eta_to_pressure none~setup_eta_to_pressure->proc~mapl_gridget none~set~3 mapl_MaplGrid::MaplGrid%set none~set~3->proc~mapl_gridget proc~esmfl_field_is_undefined ESMFL_MOD::ESMFL_field_is_undefined proc~esmfl_field_is_undefined->proc~mapl_gridget proc~esmfl_fieldgetdims ESMFL_MOD::ESMFL_FieldGetDims proc~esmfl_fieldgetdims->proc~mapl_gridget proc~esmfl_gridcoordget ESMFL_MOD::ESMFL_GridCoordGet proc~esmfl_gridcoordget->proc~mapl_gridget proc~has_level regrid_util_support_mod::regrid_support%has_level proc~has_level->proc~mapl_gridget proc~has_level~2 time_ave::has_level proc~has_level~2->proc~mapl_gridget proc~latlon_zmean time_ave::latlon_zmean proc~latlon_zmean->proc~mapl_gridget proc~latlon_zstar time_ave::latlon_zstar proc~latlon_zstar->proc~mapl_gridget proc~mapl_cfiocreatefromfile MAPL_CFIOMod::MAPL_CFIOCreateFromFile proc~mapl_cfiocreatefromfile->proc~mapl_gridget proc~mapl_cfioreadbundleread MAPL_CFIOMod::MAPL_CFIOReadBundleRead proc~mapl_cfioreadbundleread->proc~mapl_gridget proc~mapl_cfiowritebundlepost MAPL_CFIOMod::MAPL_CFIOWriteBundlePost proc~mapl_cfiowritebundlepost->proc~mapl_gridget proc~mapl_cfiowritebundlewait MAPL_CFIOMod::MAPL_CFIOWriteBundleWait proc~mapl_cfiowritebundlewait->proc~mapl_gridget proc~mapl_cfiowritebundlewrite MAPL_CFIOMod::MAPL_CFIOWriteBundleWrite proc~mapl_cfiowritebundlewrite->proc~mapl_gridget proc~mapl_collectivegather3d MAPL_CommsMod::MAPL_CollectiveGather3D proc~mapl_collectivegather3d->proc~mapl_gridget proc~mapl_create_bundle_from_metdata_id MAPL_ESMFFieldBundleRead::MAPL_create_bundle_from_metdata_id proc~mapl_create_bundle_from_metdata_id->proc~mapl_gridget proc~mapl_esmfstatereadfromfile MAPL_GenericMod::MAPL_ESMFStateReadFromFile proc~mapl_esmfstatereadfromfile->proc~mapl_gridget proc~mapl_genericfinalize MAPL_GenericMod::MAPL_GenericFinalize proc~mapl_genericfinalize->proc~mapl_gridget proc~mapl_genericinitialize MAPL_GenericMod::MAPL_GenericInitialize proc~mapl_genericinitialize->proc~mapl_gridget proc~mapl_genericrecord MAPL_GenericMod::MAPL_GenericRecord proc~mapl_genericrecord->proc~mapl_gridget proc~mapl_genericstatesave MAPL_GenericMod::MAPL_GenericStateSave proc~mapl_genericstatesave->proc~mapl_gridget proc~mapl_gridcoordadjust MAPL_LocStreamMod::MAPL_GridCoordAdjust proc~mapl_gridcoordadjust->proc~mapl_gridget proc~mapl_tilemaskget FileIOSharedMod::MAPL_TileMaskGet proc~mapl_tilemaskget->proc~mapl_gridget proc~test_main utCFIO::test_main proc~test_main->proc~mapl_gridget proc~vertinterpolation_presskappa linearVerticalInterpolation_mod::vertInterpolation_pressKappa proc~vertinterpolation_presskappa->proc~mapl_gridget program~time_ave time_ave program~time_ave->proc~mapl_gridget

Source Code

  subroutine MAPL_GridGet(GRID, globalCellCountPerDim, localCellCountPerDim, RC)
      type (ESMF_Grid), intent(IN) :: GRID
      integer, optional, intent(INout) :: globalCellCountPerDim(:)
      integer, optional, intent(INout) :: localCellCountPerDim(:)
      integer, optional, intent(  OUT) :: RC

! local vars
      integer :: status

      integer :: mincounts(ESMF_MAXDIM)
      integer :: maxcounts(ESMF_MAXDIM)
      integer :: gridRank
      integer :: UNGRID
      integer :: sz, tileCount
      logical :: plocal, pglobal, lxtradim
      logical :: isPresent,hasDE

      pglobal = present(globalCellCountPerDim)
      plocal  = present(localCellCountPerDim)

      if (pglobal .or. plocal) then
         call ESMF_GridGet(grid, dimCount=gridRank, _RC)

!ALT kludge
         lxtradim = .false.
         if (gridRank == 1) then
            call ESMF_AttributeGet(grid, name='GRID_EXTRADIM', isPresent=isPresent, _RC)
            if (isPresent) then
               call ESMF_AttributeGet(grid, name='GRID_EXTRADIM', value=UNGRID, _RC)
               lxtradim = .true.
            end if
         else if (gridRank == 2) then
            call ESMF_AttributeGet(grid, name='GRID_LM', isPresent=isPresent, _RC)
            if (isPresent) then
               call ESMF_AttributeGet(grid, name='GRID_LM', value=UNGRID, _RC)
               lxtradim = .true.
            end if
         end if
      end if

      if (pglobal) then

         globalCellCountPerDim = 1
         call ESMF_GridGet(grid, tileCount=tileCount,_RC)

         call ESMF_GridGet(grid, tile=1, staggerLoc=ESMF_STAGGERLOC_CENTER, &
              minIndex=mincounts, &
              maxIndex=maxcounts, &
              _RC      )

         sz = min(gridRank, ESMF_MAXDIM, size(globalCellCountPerDim)) 
         globalCellCountPerDim(1:sz) = maxcounts(1:sz)-mincounts(1:sz)+1

         ! kludge for new cube sphere from ESMF
         if (tileCount == 6) then
            if (globalCellCountPerDim(1) /= 1) then ! kludge-on-the-kludge for Single-Column case
               globalCellCountPerDim(2)=globalCellCountPerDim(2)*6
            end if
         end if

         if (lxtradim ) then
            globalCellCountPerDim(gridRank+1) = UNGRID
         end if
      end if

      if (plocal) then
         localCellCountPerDim = 1

         HasDE = MAPL_GridHasDE(grid,_RC)
         if (HasDE) then
            call ESMF_GridGet(GRID, localDE=0, &
                 staggerloc=ESMF_STAGGERLOC_CENTER, &
                 exclusiveCount=localCellCountPerDim, _RC)
         end if

         if (lxtradim ) then
            localCellCountPerDim(gridRank+1) = UNGRID
         end if
      end if

      _RETURN(ESMF_SUCCESS)

    end subroutine MAPL_GridGet