subroutine ESMFL_FieldRegrid(src, dst, RC)
type(ESMF_Field) :: src
type(ESMF_Field) :: dst
integer, optional, intent(OUT) :: rc
! local vars
#if 0
type (ESMF_Grid) :: srcgrid, dstgrid
type (ESMF_DELayout) :: layout
type (ESMF_Array) :: array
integer :: DIMS(3)
integer :: IM_SRC, JM_SRC
integer :: IM_DST, JM_DST
integer :: J
real, dimension(:,:), pointer :: lats, lons, z0, z, h
real, parameter :: EPS=1.0E-3
real :: ZPOLE
#endif
_UNUSED_DUMMY(src)
_UNUSED_DUMMY(dst)
#if 0
! begin
call ESMF_FieldGetGrid(src, srcgrid, rc=status)
_VERIFY(STATUS)
call ESMF_GridGet(SRCGRID, global_cell_dim=dims, RC=STATUS)
_VERIFY(STATUS)
IM_SRC = DIMS(1)
JM_SRC = DIMS(2)
call ESMF_GridGetDELayout(srcgrid, layout=layout, rc=status)
_VERIFY(STATUS)
call ESMF_FieldGetGrid(dst, dstgrid, rc=status)
_VERIFY(STATUS)
call ESMF_GridGetDELocalInfo(DSTGRID, LOCAL_AXIS_LENGTH=DIMS, RC=STATUS)
_VERIFY(STATUS)
IM_DST = DIMS(1)
JM_DST = DIMS(2)
call ESMFL_GridCoordGet( DSTGRID, LATS , &
Name = "Latitude" , &
Location = ESMF_CELL_CENTER , &
Units = MAPL_UnitsRadians , &
RC = STATUS )
_VERIFY(STATUS)
call ESMFL_GridCoordGet( DSTGRID, LONS , &
Name = "Longitude" , &
Location = ESMF_CELL_CENTER , &
Units = MAPL_UnitsRadians , &
RC = STATUS )
_VERIFY(STATUS)
call ESMF_FieldAllGather(src, array=array, rc=status)
_VERIFY(STATUS)
call ESMF_ArrayGetData(array, z0, RC=status)
_VERIFY(STATUS)
call ESMF_FieldGetData(dst, array, rc=status)
_VERIFY(STATUS)
call ESMF_ArrayGetData(array, z, RC=status)
_VERIFY(STATUS)
! binning
call topo_bin (z0, im_src, jm_src, z, lons(:,1), lats(1,:), &
im_dst,jm_dst)
! _VERIFY(STATUS)
! do I have the pole?
call ESMF_FieldAllGather(dst, array=array, rc=status)
_VERIFY(STATUS)
call ESMF_ArrayGetData(array, h, RC=status)
_VERIFY(STATUS)
DO J = 1, JM_DST
IF (ABS(ABS(LATS(1,J)) - 0.5*PI) .LT. EPS) then
! yes, I have the pole
ZPOLE = SUM(h(:,J))/SIZE(H,1)
Z(:,J) = ZPOLE
end IF
END DO
#endif
_RETURN(ESMF_SUCCESS)
end subroutine ESMFL_FieldRegrid