subroutine gnomonic_dist(im, lamda, theta)
! This is the commonly known equi-distance grid
integer im
real(ESMF_KIND_R8) lamda(im+1,im+1)
real(ESMF_KIND_R8) theta(im+1,im+1)
real(ESMF_KIND_R8) p(3,im+1,im+1)
! Local
real(ESMF_KIND_R8) rsq3, xf, y0, z0, y, x, z, ds
real(ESMF_KIND_R8) dy, dz
integer j,k
! Face-2
rsq3 = 1./sqrt(3.)
xf = -rsq3
y0 = rsq3; dy = -2.*rsq3/im
z0 = -rsq3; dz = 2.*rsq3/im
do k=1,im+1
do j=1,im+1
p(1,j,k) = xf
p(2,j,k) = y0 + (j-1)*dy
p(3,j,k) = z0 + (k-1)*dz
enddo
enddo
call cart_to_latlon( (im+1)*(im+1), p, lamda, theta)
end subroutine gnomonic_dist