function grid_index(lon_deg,lat_deg)
!--------------------------------------------------------------------------------
! Get local index of grid point of longitude,latitude lon_deg,lat_deg
! Author : FH 2024/07/18
! Please do not put this function in a m*odule not to complexify the replay script
!--------------------------------------------------------------------------------
USE dimphy, only : klon
USE geometry_mod, ONLY: latitude_deg, longitude_deg
implicit none
real, intent(in) :: lon_deg,lat_deg
integer :: grid_index
integer i
grid_index=0
do i=1,klon
   if ( abs(lon_deg-longitude_deg(i)) < 0.02 .and.  abs(lat_deg-latitude_deg(i)) < 0.02 ) then
        grid_index=i
        exit
   endif
enddo
return
end function grid_index
