real(ESMF_KIND_R8) function create_coord(index, grid, axis, rc)
!-----------------------------------------------------------------------------
! selects coordinate value based upon specified grid type.
!-----------------------------------------------------------------------------
integer, intent(in ) :: index, axis
integer, intent(inout) :: rc
type(grid_specification_record)::grid
!-----------------------------------------------------------------------------
!
!-----------------------------------------------------------------------------
select case( trim(grid%gtype(axis)%string) )
case("UNI")
create_coord = create_uniform_coord(index, grid%grange(axis,2), &
grid%grange(axis,1), grid%gsize(axis))
case("UNIFORM")
create_coord = create_uniform_coord(index, grid%grange(axis,2), &
grid%grange(axis,1), grid%gsize(axis))
case("UNIFORM_POLE")
create_coord = create_uniform_coord(index, grid%grange(axis,2), &
grid%grange(axis,1), grid%gsize(axis))
case("UNIFORM_PERIODIC")
create_coord = create_uniform_coord(index, grid%grange(axis,2), &
grid%grange(axis,1), grid%gsize(axis))
case("GAUSS")
create_coord = create_gaussian_coord(index, grid%grange(axis,2), &
grid%grange(axis,1), grid%gsize(axis))
case("GAUSSIAN")
create_coord = create_gaussian_coord(index, grid%grange(axis,2), &
grid%grange(axis,1), grid%gsize(axis))
case("GAUSSIAN_POLE")
create_coord = create_gaussian_coord(index, grid%grange(axis,2), &
grid%grange(axis,1), grid%gsize(axis))
case("GAUSSIAN_PERIODIC")
create_coord = create_gaussian_coord(index, grid%grange(axis,2), &
grid%grange(axis,1), grid%gsize(axis))
case default
print*,'Unsupported grid type',trim(grid%gtype(axis)%string)
call ESMF_LogSetError( ESMF_FAILURE, msg="Unsupported grid type " // &
trim(grid%gtype(axis)%string), rcToReturn=rc)
return
end select
!-----------------------------------------------------------------------------
end function create_coord