subroutine metrics_fill_tripolar_whole(this, grid, lon_west, lat_south, &
dlat_deg, rad_earth, phi_join, lon_pole)
!! The undecomposed tripolar build behind `metrics_fill_tripolar`:
!! `grid` must hold the WHOLE grid (its local extents are the global
!! ones), so the fold and the periodic seam are both local.
type(ocean_metrics_t), intent(inout) :: this
type(hgrid_t), intent(in) :: grid
real(wp), intent(in) :: lon_west, lat_south, dlat_deg
real(wp), intent(in) :: rad_earth, phi_join, lon_pole
real(wp), allocatable :: sg_x(:, :), sg_y(:, :)
real(wp), allocatable :: sg_dx(:, :), sg_dy(:, :), sg_area(:, :)
call tripolar_supergrid_arrays(grid, lon_west, lat_south, dlat_deg, rad_earth, &
phi_join, lon_pole, sg_x, sg_y, sg_dx, sg_dy, sg_area)
call metrics_assemble_from_supergrid_arrays(this, grid, &
sg_x, sg_y, sg_dx, sg_dy, sg_area, &
periodic_x=.true., &
sg_angle_dx=supergrid_angle_dx_from_geography(sg_x, sg_y))
! Replace the assembler's constant-extrapolation ghosts on the seam
! edges with the physically-correct fold (north) + periodic (east-west)
! values. Every metric/geography array is a SCALAR under the fold
! reflection (lengths/areas invariant; geography reads the conjugate
! point's stored coordinate), so all fold ops use negate=.false.
call metrics_fold_periodic_ghosts(this, grid)
deallocate (sg_x, sg_y, sg_dx, sg_dy, sg_area)
end subroutine metrics_fill_tripolar_whole