latlon_zstar Subroutine

subroutine latlon_zstar(q, qp, undef, grid, rc)

Arguments

Type IntentOptional Attributes Name
real, intent(inout) :: q(:,:)
real, intent(out) :: qp(:,:)
real, intent(in) :: undef
type(ESMF_Grid), intent(inout) :: grid
integer, intent(out), optional :: rc

Calls

proc~~latlon_zstar~~CallsGraph proc~latlon_zstar latlon_zstar proc~defined defined proc~latlon_zstar->proc~defined proc~latlon_zmean latlon_zmean proc~latlon_zstar->proc~latlon_zmean proc~mapl_abort MAPL_abort proc~latlon_zstar->proc~mapl_abort proc~mapl_gridget MAPL_GridGet proc~latlon_zstar->proc~mapl_gridget proc~mapl_verify MAPL_Verify proc~latlon_zstar->proc~mapl_verify proc~latlon_zmean->proc~mapl_abort proc~latlon_zmean->proc~mapl_gridget proc~latlon_zmean->proc~mapl_verify ESMF_VMGet ESMF_VMGet proc~latlon_zmean->ESMF_VMGet ESMF_VMGetCurrent ESMF_VMGetCurrent proc~latlon_zmean->ESMF_VMGetCurrent interface~mapl_grid_interior MAPL_GRID_INTERIOR proc~latlon_zmean->interface~mapl_grid_interior mpi_recv mpi_recv proc~latlon_zmean->mpi_recv mpi_send mpi_send proc~latlon_zmean->mpi_send proc~get_esmf_grid_layout get_esmf_grid_layout proc~latlon_zmean->proc~get_esmf_grid_layout mpi_abort mpi_abort proc~mapl_abort->mpi_abort proc~mapl_gridget->proc~mapl_verify ESMF_AttributeGet ESMF_AttributeGet proc~mapl_gridget->ESMF_AttributeGet ESMF_DistGridGet ESMF_DistGridGet proc~mapl_gridget->ESMF_DistGridGet ESMF_GridGet ESMF_GridGet proc~mapl_gridget->ESMF_GridGet proc~mapl_distgridget MAPL_DistGridGet proc~mapl_gridget->proc~mapl_distgridget proc~mapl_getimsjms MAPL_GetImsJms proc~mapl_gridget->proc~mapl_getimsjms proc~mapl_gridhasde MAPL_GridHasDE proc~mapl_gridget->proc~mapl_gridhasde proc~mapl_return MAPL_Return proc~mapl_gridget->proc~mapl_return proc~mapl_throw_exception MAPL_throw_exception proc~mapl_verify->proc~mapl_throw_exception proc~get_esmf_grid_layout->proc~mapl_abort proc~get_esmf_grid_layout->proc~mapl_verify proc~get_esmf_grid_layout->ESMF_GridGet proc~get_esmf_grid_layout->ESMF_VMGet proc~get_esmf_grid_layout->ESMF_VMGetCurrent proc~get_esmf_grid_layout->proc~mapl_distgridget proc~get_esmf_grid_layout->proc~mapl_getimsjms proc~mapl_distgridget->proc~mapl_verify proc~mapl_distgridget->ESMF_DistGridGet proc~mapl_getimsjms->proc~mapl_verify proc~mapl_getimsjms->proc~mapl_return interface~mapl_assert MAPL_Assert proc~mapl_getimsjms->interface~mapl_assert interface~mapl_sort MAPL_Sort proc~mapl_getimsjms->interface~mapl_sort proc~mapl_gridhasde->proc~mapl_verify proc~mapl_gridhasde->ESMF_DistGridGet proc~mapl_gridhasde->ESMF_GridGet proc~mapl_gridhasde->proc~mapl_return ESMF_DELayoutGet ESMF_DELayoutGet proc~mapl_gridhasde->ESMF_DELayoutGet proc~mapl_return->proc~mapl_throw_exception at at proc~mapl_return->at insert insert proc~mapl_return->insert

Called by

proc~~latlon_zstar~~CalledByGraph proc~latlon_zstar latlon_zstar program~time_ave time_ave program~time_ave->proc~latlon_zstar

Source Code

   subroutine latlon_zstar (q,qp,undef,grid,rc)
      real, intent(inout) :: q(:,:)
      real, intent(out) :: qp(:,:)
      real, intent(in) :: undef
      type (ESMF_Grid), intent(inout) :: grid
      integer, optional, intent(out) :: rc

      integer :: local_dims(3)
      integer im,jm,i,j,status
      real, allocatable :: qz(:)

      call MAPL_GridGet(grid,localCellCountPerDim=local_dims,_RC)
      im = local_dims(1)
      jm = local_dims(2)
      allocate(qz(jm))

      call latlon_zmean ( q,qz,undef,grid )
      do j=1,jm
         if( qz(j).eq. undef ) then
            qp(:,j) = undef
         else
            do i=1,im
               if( defined( q(i,j),undef) ) then
                  qp(i,j) = q(i,j) - qz(j)
               else
                  qp(i,j) = undef
               endif
            enddo
         endif
      enddo
      if (present(rc)) then
         rc=_SUCCESS
      endif
   end subroutine latlon_zstar