Index: LMDZ6/trunk/libf/phylmd/grid_index.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/grid_index.F90	(revision 5085)
+++ LMDZ6/trunk/libf/phylmd/grid_index.F90	(revision 5085)
@@ -0,0 +1,21 @@
+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
