   !!======================================================================

  SUBROUTINE init_marsweb_clim

   !&E---------------------------------------------------------------------
   !&E                 ***  ROUTINE init_marsweb_clim ***
   !&E
   !&E ** Purpose : initialize the parameters set using the MARSWEB interface
   !&E              for the configuration of boundary conditions
   !&E
   !&E ** Description : main, zoom
   !&E
   !&E ** Called by : tool_datosec
   !&E
   !&E ** External calls :
   !&E
   !&E ** Reference :
   !&E
   !&E ** History :
   !&E       !          Original code
   !&E       !  2002-10-23  last modifications
   !&E
   !&E---------------------------------------------------------------------
   !! * Modules used
   USE parameters
   USE comvars2d
   USE comvars3d
   USE cometdyn
   USE cometemp
   USE comaree
   USE comfluxdo
   USE comdiag
   USE output
   USE trackpoints
   IMPLICIT NONE

   !! * Arguments

   !! * Local declarations

   CHARACTER(len=2)      :: nvers
   CHARACTER(len=2)      :: chainclim
   CHARACTER(len=lchain) :: modele,ficclim,path_inputs,path_outputs
   CHARACTER(len=19)     :: date_start,date_end,tool_sectodat
   INTEGER               :: i
   REAL(kind=rlg)        :: tool_datosec,tdb,tfi

   !!----------------------------------------------------------------------
   !! * Executable part

   ! les namelists du para.commun
   !------------------------------

   NAMELIST/namhead/ modele
   NAMELIST/namdate/ date_start,date_end
   NAMELIST/nammeteo/ l_meteo_stat,l_meteo_hom,wind_veloc,wind_dir,file_meteo
   NAMELIST/namtide/ l_tide_M2harm,l_tide_M2statcoef,tide_M2coef,file_tide_M2coef

   ! lecture des namelists
   !-----------------------
   ! namelist a chercher dans le bon repertoire commune a tous les rangs
   !----------------------------------

   CALL getarg(1,path_inputs)
   CALL getarg(2,path_outputs)
   ficclim=TRIM(path_inputs)//'/clim.txt'
   root=TRIM(path_outputs)
   WRITE(nvers,'(i1)') no
   filecl = TRIM(path_outputs)//'/cl_rg'//TRIM(nvers)
   WRITE(nvers,'(i1)') no+1    
   fileclsv = TRIM(path_outputs)//'/cl_rg'//TRIM(nvers)

   DEALLOCATE(tchrono)

   OPEN(50,file=ficclim,status='old',form='formatted',access='sequential')
   READ(50,namhead)
   READ(50,namdate)
   READ(50,nammeteo)
   READ(50,namtide)
   CLOSE(50)

   tdeb=tool_datosec(date_start) ! ajustement des dates, pas de temps et differents pas.
   tfin=tool_datosec(date_end)

   ! modif pour etre sur d avoir assez de temps au CL precedente et pour la SIMU
   IF (no == 0) tfin = tfin+ 8000.0_rlg
   IF (no == 1) tfin = tfin+ 4000.0_rlg
   IF (no == 2) tfin = tfin+ 2000.0_rlg
   IF (no == 3) tfin = tfin+ 1000.0_rlg
   IF (no == 4) tfin = tfin+ 500.0_rlg
   IF (no == 5) tfin = tfin+ 200.0_rlg

   ! remplissage d un fichier de chronologie.
   ! pour simplifier les sequences de rejet et de debits.
   !-------------------------------------------------------

   l_chrono=.FALSE.
   tdb=tdeb+date_startshift*86400.0_rlg-perchrono
   tfi=tfin+perchrono
   nvalmax=NINT((tfi-tdb)/perchrono+0.5_rlg)+1
   ALLOCATE(tchrono(nvalmax))
   DO i=1,nvalmax 
     tchrono(i)=tdb+(i-1.0_rlg)*perchrono
   END DO
   indchrono=1
   l_chrono=.TRUE.
   ! fin de remplissage du vecteur chronologie

   t=tdeb+date_startshift*86400.0_rlg ! dates et pas de temps
   tdeb3d=tdeb
   tsauv=tdeb + saverestart_step
   cdate = tool_sectodat(t)
   CALL tool_decompdate(cdate,ijour,imois,ian,iheure,iminu,isec)

END SUBROUTINE init_marsweb_clim
