Index: IOIPSL/tags/v2_1_1/example/example/AA_make
===================================================================
--- IOIPSL/tags/v2_1_1/example/example/AA_make	(revision 31)
+++ IOIPSL/tags/v2_1_1/example/example/AA_make	(revision 31)
@@ -0,0 +1,270 @@
+#-
+#- $Id$
+#-
+USER_DIR = $(shell pwd)
+MAKE_DIR = '??'
+ifneq ($(USER_DIR),$(MAKE_DIR))
+ @$(error You must invoke this Makefile from its directory)
+endif
+#-
+all: testhist1 testhist2 testrest testopp testcalendar testflio
+	echo don t forget to do : $(M_K) clean !!!
+
+testhist1:
+	$(M_K) libioipsl
+	$(M_K) testhist1.x
+#-Q- sx8brodie	echo cd $(USER_DIR) > Job_testhist1
+#-Q- sx8brodie	echo '\
+#-Q- sx8mercure	echo cd $(USER_DIR) > Job_testhist1
+#-Q- sx8mercure	echo '\
+	./testhist1.x \
+#-Q- sx8brodie ' >> Job_testhist1
+#-Q- sx8brodie	qsub -j o -S /usr/bin/ksh \
+#-Q- sx8brodie	 -o $(USER_DIR)/Out_testhist1 Job_testhist1
+#-Q- sx8brodie	echo job Job_testhist1 has been submitted
+#-Q- sx8mercure ' >> Job_testhist1
+#-Q- sx8mercure	qsub -j o -S /usr/bin/ksh \
+#-Q- sx8mercure	 -o $(USER_DIR)/Out_testhist1 Job_testhist1
+#-Q- sx8mercure	echo job Job_testhist1 has been submitted
+
+	@echo ' '
+	@echo 'file testhist1.nc should be created'
+	@echo 'to see it, type : ncdump -h testhist1.nc'
+	@echo ' '
+
+testhist1.x: testhist1.o
+	$(F_L) -o testhist1.x testhist1.o \
+               $(L_O) $(IOIPSL_LIB) $(NCDF_LIB)
+
+testhist2:
+	$(M_K) libioipsl
+	$(M_K) testhist2.x
+#-Q- sx8brodie	echo cd $(USER_DIR) > Job_testhist2
+#-Q- sx8brodie	echo '\
+#-Q- sx8mercure	echo cd $(USER_DIR) > Job_testhist2
+#-Q- sx8mercure	echo '\
+	./testhist2.x \
+#-Q- sx8brodie ' >> Job_testhist2
+#-Q- sx8brodie	qsub -j o -S /usr/bin/ksh \
+#-Q- sx8brodie	 -o $(USER_DIR)/Out_testhist2 Job_testhist2
+#-Q- sx8brodie	echo job Job_testhist2 has been submitted
+#-Q- sx8mercure ' >> Job_testhist2
+#-Q- sx8mercure	qsub -j o -S /usr/bin/ksh \
+#-Q- sx8mercure	 -o $(USER_DIR)/Out_testhist2 Job_testhist2
+#-Q- sx8mercure	echo job Job_testhist2 has been submitted
+
+	@echo ' '
+	@echo 'file testhist2.nc should be created'
+	@echo 'to see it, type : ncdump -h testhist2.nc'
+	@echo ' '
+	@echo 'file testhist2_bis.nc should be created'
+	@echo 'to see it, type : ncdump -h testhist2_bis.nc'
+	@echo ' '
+
+testhist2.x: testhist2.o
+	$(F_L) -o testhist2.x testhist2.o \
+               $(L_O) $(IOIPSL_LIB) $(NCDF_LIB)
+
+testrest:
+	$(M_K) libioipsl
+	$(M_K) testrest.x
+	$(RM) restfile.nc restfilebis.nc
+#-Q- sx8brodie	echo cd $(USER_DIR) > Job_testrest
+#-Q- sx8brodie	echo '\
+#-Q- sx8mercure	echo cd $(USER_DIR) > Job_testrest
+#-Q- sx8mercure	echo '\
+	./testrest.x \
+#-Q- sx8brodie ' >> Job_testrest
+#-Q- sx8brodie	qsub -j o -S /usr/bin/ksh \
+#-Q- sx8brodie	 -o $(USER_DIR)/Out_testrest Job_testrest
+#-Q- sx8brodie	echo job Job_testrest has been submitted
+#-Q- sx8mercure ' >> Job_testrest
+#-Q- sx8mercure	qsub -j o -S /usr/bin/ksh \
+#-Q- sx8mercure	 -o $(USER_DIR)/Out_testrest Job_testrest
+#-Q- sx8mercure	echo job Job_testrest has been submitted
+
+	@echo ' '
+	@echo 'file restfile.nc should be created'
+	@echo 'to see it, type : ncdump -h restfile.nc'
+	@echo ' '
+	@echo 'file restfilebis.nc should be created'
+	@echo 'to see it, type : ncdump -h restfilebis.nc'
+	@echo ' '
+
+testrest.x: testrest.o
+	$(F_L) -o testrest.x testrest.o \
+               $(L_O) $(IOIPSL_LIB) $(NCDF_LIB)
+
+testopp:
+	$(M_K) libioipsl
+	$(M_K) testopp.x
+#-Q- sx8brodie	echo cd $(USER_DIR) > Job_testopp
+#-Q- sx8brodie	echo '\
+#-Q- sx8mercure	echo cd $(USER_DIR) > Job_testopp
+#-Q- sx8mercure	echo '\
+	./testopp.x \
+#-Q- sx8brodie ' >> Job_testopp
+#-Q- sx8brodie	qsub -j o -S /usr/bin/ksh \
+#-Q- sx8brodie	 -o $(USER_DIR)/Out_testopp Job_testopp
+#-Q- sx8brodie	echo job Job_testopp has been submitted
+#-Q- sx8mercure ' >> Job_testopp
+#-Q- sx8mercure	qsub -j o -S /usr/bin/ksh \
+#-Q- sx8mercure	 -o $(USER_DIR)/Out_testopp Job_testopp
+#-Q- sx8mercure	echo job Job_testopp has been submitted
+
+testopp.x: testopp.o
+	$(F_L) -o testopp.x testopp.o \
+               $(L_O) $(IOIPSL_LIB) $(NCDF_LIB)
+
+testcalendar:
+	$(M_K) libioipsl
+	$(M_K) testcalendar.x
+#-Q- sx8brodie	echo cd $(USER_DIR) > Job_testcalendar
+#-Q- sx8brodie	echo '\
+#-Q- sx8mercure	echo cd $(USER_DIR) > Job_testcalendar
+#-Q- sx8mercure	echo '\
+	echo; \
+#-Q- sx8brodie ' >> Job_testcalendar
+#-Q- sx8brodie	echo '\
+#-Q- sx8mercure ' >> Job_testcalendar
+#-Q- sx8mercure	echo '\
+        ./testcalendar.x; \
+#-Q- sx8brodie ' >> Job_testcalendar
+#-Q- sx8brodie	echo '\
+#-Q- sx8mercure ' >> Job_testcalendar
+#-Q- sx8mercure	echo '\
+        echo; \
+#-Q- sx8brodie ' >> Job_testcalendar
+#-Q- sx8brodie	echo '\
+#-Q- sx8mercure ' >> Job_testcalendar
+#-Q- sx8mercure	echo '\
+        ./testcalendar.x noleap; \
+#-Q- sx8brodie ' >> Job_testcalendar
+#-Q- sx8brodie	echo '\
+#-Q- sx8mercure ' >> Job_testcalendar
+#-Q- sx8mercure	echo '\
+        echo; \
+#-Q- sx8brodie ' >> Job_testcalendar
+#-Q- sx8brodie	echo '\
+#-Q- sx8mercure ' >> Job_testcalendar
+#-Q- sx8mercure	echo '\
+        ./testcalendar.x 360d; \
+#-Q- sx8brodie ' >> Job_testcalendar
+#-Q- sx8brodie	qsub -j o -S /usr/bin/ksh \
+#-Q- sx8brodie	 -o $(USER_DIR)/Out_testcalendar Job_testcalendar
+#-Q- sx8brodie	echo job Job_testcalendar has been submitted
+#-Q- sx8mercure ' >> Job_testcalendar
+#-Q- sx8mercure	qsub -j o -S /usr/bin/ksh \
+#-Q- sx8mercure	 -o $(USER_DIR)/Out_testcalendar Job_testcalendar
+#-Q- sx8mercure	echo job Job_testcalendar has been submitted
+
+testcalendar.x: testcalendar.o
+	$(F_L) -o testcalendar.x testcalendar.o \
+               $(L_O) $(IOIPSL_LIB) $(NCDF_LIB)
+
+testflio:
+	$(M_K) libioipsl
+	$(M_K) testflio.x
+
+#-Q- sx8brodie	echo cd $(USER_DIR) > Job_testflio
+#-Q- sx8brodie	echo '\
+#-Q- sx8mercure	echo cd $(USER_DIR) > Job_testflio
+#-Q- sx8mercure	echo '\
+	./testflio.x \
+#-Q- sx8brodie ' >> Job_testflio
+#-Q- sx8brodie	qsub -j o -S /usr/bin/ksh \
+#-Q- sx8brodie	 -o $(USER_DIR)/Out_testflio Job_testflio
+#-Q- sx8brodie	echo job Job_testflio has been submitted
+#-Q- sx8mercure ' >> Job_testflio
+#-Q- sx8mercure	qsub -j o -S /usr/bin/ksh \
+#-Q- sx8mercure	 -o $(USER_DIR)/Out_testflio Job_testflio
+#-Q- sx8mercure	echo job Job_testflio has been submitted
+
+	@echo ' '
+	@echo 'file testflio_0001.nc should be created'
+	@echo 'to see it, type : ncdump -h testflio_0001.nc'
+	@echo ' '
+
+testflio.x: testflio.o
+	$(F_L) -o testflio.x testflio.o \
+               $(L_O) $(IOIPSL_LIB) $(NCDF_LIB)
+
+testconfig:
+	$(M_K) libioipsl
+	$(M_K) testconfig.x
+#-Q- sx8brodie	echo cd $(USER_DIR) > Job_testconfig
+#-Q- sx8brodie	echo '\
+#-Q- sx8mercure	echo cd $(USER_DIR) > Job_testconfig
+#-Q- sx8mercure	echo '\
+	./testconfig.x \
+#-Q- sx8brodie ' >> Job_testconfig
+#-Q- sx8brodie	qsub -j o -S /usr/bin/ksh \
+#-Q- sx8brodie	 -o $(USER_DIR)/Out_testconfig Job_testconfig
+#-Q- sx8brodie	echo job Job_testconfig has been submitted
+#-Q- sx8mercure ' >> Job_testconfig
+#-Q- sx8mercure	qsub -j o -S /usr/bin/ksh \
+#-Q- sx8mercure	 -o $(USER_DIR)/Out_testconfig Job_testconfig
+#-Q- sx8mercure	echo job Job_testconfig has been submitted
+
+testconfig.x: testconfig.o
+	$(F_L) -o testconfig.x testconfig.o \
+               $(L_O) $(IOIPSL_LIB) $(NCDF_LIB)
+
+testconfig2:
+	$(M_K) libioipsl
+	$(M_K) testconfig2.x
+#-Q- sx8brodie	echo cd $(USER_DIR) > Job_testconfig2
+#-Q- sx8brodie	echo '\
+#-Q- sx8mercure	echo cd $(USER_DIR) > Job_testconfig2
+#-Q- sx8mercure	echo '\
+	./testconfig2.x \
+#-Q- sx8brodie ' >> Job_testconfig2
+#-Q- sx8brodie	qsub -j o -S /usr/bin/ksh \
+#-Q- sx8brodie	 -o $(USER_DIR)/Out_testconfig2 Job_testconfig2
+#-Q- sx8brodie	echo job Job_testconfig2 has been submitted
+#-Q- sx8mercure ' >> Job_testconfig2
+#-Q- sx8mercure	qsub -j o -S /usr/bin/ksh \
+#-Q- sx8mercure	 -o $(USER_DIR)/Out_testconfig2 Job_testconfig2
+#-Q- sx8mercure	echo job Job_testconfig2 has been submitted
+
+testconfig2.x: testconfig2.o
+	$(F_L) -o testconfig2.x testconfig2.o \
+               $(L_O) $(IOIPSL_LIB) $(NCDF_LIB)
+
+config: libioipsl
+	(cd ../src; $(M_K) -f Makefile config)
+	$(BINDIR)/Fparser -main -name testconfig testconfig.f90
+	$(SCPDIR)/build_tkmenus
+	./config.tk
+	$(RM) Config.*
+
+libioipsl:
+	(cd ../src; $(M_K) -f Makefile)
+
+clean:
+	$(RM) *.*~ Makefile~ core *.o *.nc Out_t* Job_t* *.x *_run.def
+
+testhist1.o: testhist1.f90
+	$(F_C) $(F_O) testhist1.f90
+
+testhist2.o: testhist2.f90
+	$(F_C) $(F_O) testhist2.f90
+
+testrest.o: testrest.f90
+	$(F_C) $(F_O) testrest.f90
+
+testopp.o: testopp.f90
+	$(F_C) $(F_O) testopp.f90
+
+testcalendar.o: testcalendar.f90
+	$(F_C) $(F_O) testcalendar.f90
+
+testflio.o: testflio.f90
+	$(F_C) $(F_O) testflio.f90
+
+testconfig.o: testconfig.f90
+	$(F_C) $(F_O) testconfig.f90
+
+testconfig2.o: testconfig2.f90
+	$(F_C) $(F_O) testconfig2.f90
+
Index: IOIPSL/tags/v2_1_1/example/example/AA_make.ldef
===================================================================
--- IOIPSL/tags/v2_1_1/example/example/AA_make.ldef	(revision 31)
+++ IOIPSL/tags/v2_1_1/example/example/AA_make.ldef	(revision 31)
@@ -0,0 +1,15 @@
+#-
+#- $Id$
+#-
+#---------------------------------------------------------------------
+#- Exemples relatifs a IOIPSL
+#---------------------------------------------------------------------
+SHELL = /bin/sh
+#---------------------------------------------------------------------
+LIBDIR = ../../../lib
+BINDIR = ../../../bin
+SCPDIR = ../../../scripts
+MODDIR = $(LIBDIR)
+#---------------------------------------------------------------------
+IOIPSL_LIB = -L$(LIBDIR) -lioipsl
+#-Q- eshpux  IOIPSL_LIB = -L $(LIBDIR) -lsxioipsl
Index: IOIPSL/tags/v2_1_1/example/example/testcalendar.f90
===================================================================
--- IOIPSL/tags/v2_1_1/example/example/testcalendar.f90	(revision 31)
+++ IOIPSL/tags/v2_1_1/example/example/testcalendar.f90	(revision 31)
@@ -0,0 +1,67 @@
+PROGRAM testcalendar
+!-
+!$Id$
+!---------------------------------------------------------------------
+!- This program will do some basic tests on the calendar
+!---------------------------------------------------------------------
+  USE calendar
+!-
+  IMPLICIT NONE
+!-
+  REAL :: julian, sec
+  INTEGER :: year, month, day
+  INTEGER :: iread, iret
+  CHARACTER(LEN=20) :: tmp
+!-
+  INTEGER :: iargc, getarg
+  EXTERNAL iargc, getarg
+!---------------------------------------------------------------------
+!-
+! Get the command line arguments
+!-
+  iread = iargc()
+  IF (iread .EQ. 0) THEN
+    WRITE(*,*) 'Using the default calendar'
+  ELSE
+    iret = getarg(1,tmp)
+    WRITE(*,*) 'Using the calendar named :',TRIM(tmp)
+    CALL ioconf_calendar (TRIM(tmp))
+  ENDIF
+!-
+! Get the origine of the julian days
+!-
+  julian = 0.0
+  CALL ju2ymds (julian, year, month, day, sec)
+  WRITE(*,*) 'Day at which the julian day was zero :'
+  WRITE(*,*) 'Year : ',year,' Month : ',month,' Day : ',day
+!-
+! Do we get the same day back when we go back and forth
+!-
+  year = 1997
+  month = 8
+  day = 21
+  sec = 0.0
+  WRITE(*,*) 'Day transformed into julian :'
+  WRITE(*,*) 'Year : ',year,' Month : ',month,' Day : ',day
+  CALL ymds2ju (year, month, day, sec, julian)
+  WRITE(*,*) ' --> The resulting julian day : ',julian
+  CALL ju2ymds (julian, year, month, day, sec)
+  WRITE(*,*) 'The day which comes out again :'
+  WRITE(*,*) 'Year : ',year,' Month : ',month,' Day : ',day
+!-
+! Yet another test but this time with a strange dat !
+!-
+  year = 1997
+  month = 3
+  day = 34
+  sec = 0.0
+  WRITE(*,*) 'Strange day transformed into julian :'
+  WRITE(*,*) 'Year : ',year,' Month : ',month,' Day : ',day
+  CALL ymds2ju (year, month, day, sec, julian)
+  WRITE(*,*) ' --> The resulting julian day : ',julian
+  CALL ju2ymds (julian, year, month, day, sec)
+  WRITE(*,*) &
+ &  'The day which comes out again, does it make more sense ? :'
+  WRITE(*,*) 'Year : ',year,' Month : ',month,' Day : ',day
+!-----------------------
+END PROGRAM testcalendar
Index: IOIPSL/tags/v2_1_1/example/example/testconfig.f90
===================================================================
--- IOIPSL/tags/v2_1_1/example/example/testconfig.f90	(revision 31)
+++ IOIPSL/tags/v2_1_1/example/example/testconfig.f90	(revision 31)
@@ -0,0 +1,95 @@
+PROGRAM testconfig
+!-
+!$Id$
+  !
+  USE getincom
+  !
+  !
+  !      This program will do some basic tests on the getin module
+  !
+  !
+  IMPLICIT NONE
+  !
+  LOGICAL           :: debug
+  CHARACTER(LEN=80) :: filename
+  CHARACTER(LEN=10), DIMENSION(3) :: strvec
+  INTEGER           :: split
+  REAL              :: g
+  REAL, DIMENSION(3) :: realvec
+  !
+  !-
+  !- set debug to have more information
+  !-
+  !Config  Key  = DEBUG_INFO
+  !Config  Desc = Flag for debug information
+  !Config  Def  = n
+  !Config  Help = This option allows to switch on the output of debug
+  !Config         information without recompiling the code.
+  !-
+  debug = .FALSE.
+  CALL getin('DEBUG_INFO',debug) 
+  !
+  !Config  Key  = FORCING_FILE
+  !Config  Desc = Name of file containing the forcing data
+  !Config  Def  = islscp_for.nc
+  !Config  Help = This is the name of the file which should be opened
+  !Config         for reading the forcing data of the dim0 model.
+  !Config         The format of the file has to be netCDF and COADS
+  !Config         compliant.
+  !-
+  filename='islscp_for.nc'
+  CALL getin('FORCING_FILE',filename)
+  !
+  !
+  !Config  Key  = SPLIT_DT
+  !Config  Desc = splits the timestep imposed by the forcing
+  !Config  Def  = 12
+  !Config  Help = With this value the time step of the forcing
+  !Config         will be devided. In principle this can be run
+  !Config         in explicit mode but it is strongly suggested
+  !Config         to use the implicit method so that the
+  !Config         atmospheric forcing has a smooth evolution.
+  !-
+  split = 12
+  CALL getin('SPLIT_DT', split)
+  !
+  !
+  !Config  Key  = GRAVIT
+  !Config  Desc = Gravitation constant
+  !Config  Def  = 9.98
+  !Config  Help = In theory these parameters could also be defined through
+  !Config         this mechanisme to ensure that the same value is used by
+  !Config         all components of the model.
+  !-
+  g = 9.98
+  CALL getin('GRAVIT', g)
+  !
+  !Config  Key  = WORDS
+  !Config  Desc = A vector of words
+  !Config  Def  = here there anywhere
+  !Config  Help = An example for a vector of strings
+  !-
+  strvec(1) = "here"
+  strvec(2) = "there"
+  strvec(3) = "anywhere"
+  CALL getin('WORDS', strvec)
+  !
+  !Config  Key  = VECTOR
+  !Config  Desc = A vector of reals
+  !Config  Def  = 1, 2, 3
+  !Config  Help = An example for a vector of REALs
+  !-
+  realvec=(/1,2,3/)
+  CALL getin('VECTOR', realvec)
+  !
+  WRITE(*,*) 'From the run.def we have extracted the following information :'
+  WRITE(*,*) 'DEBUG : ', debug
+  WRITE(*,*) 'FILENAME : ', filename(1:len_trim(filename))
+  WRITE(*,*) 'SPLIT : ', split
+  WRITE(*,*) 'G : ', g
+  WRITE(*,*) 'WORDS : ', strvec
+  WRITE(*,*) 'VECTOR : ', realvec
+  !
+  CALL getin_dump()
+  !
+END PROGRAM testconfig
Index: IOIPSL/tags/v2_1_1/example/example/testconfig2.f90
===================================================================
--- IOIPSL/tags/v2_1_1/example/example/testconfig2.f90	(revision 31)
+++ IOIPSL/tags/v2_1_1/example/example/testconfig2.f90	(revision 31)
@@ -0,0 +1,483 @@
+PROGRAM testconfig2
+!-
+!$Id$
+  !
+  USE getincom
+  !
+  !
+  !      This program will do some basic tests on the getin module
+  !
+  !
+  IMPLICIT NONE
+  !
+  INTEGER :: dayref=181
+  INTEGER :: anneeref = 1998
+  INTEGER :: nday = 10
+  INTEGER :: day_step = 240 
+  INTEGER :: iperiod = 5
+  INTEGER :: iconser = 240  
+  INTEGER :: iecri = 1
+  INTEGER :: idissip = 10
+  INTEGER :: nitergdiv = 1
+  INTEGER :: nitergrot = 2
+  INTEGER :: niterh = 2
+  INTEGER :: iphysiq = 5
+  INTEGER :: ecritphy = 1
+  INTEGER :: nbapp_rad = 12
+  INTEGER :: iflag_con = 2
+
+  REAL :: periodav = 1.
+  REAL :: tetagdiv = 7200.
+  REAL :: tetagrot = 7200.
+  REAL :: tetatemp  = 7200.
+  REAL :: coefdis = 0.
+  REAL :: clonn = 0.
+  REAL :: clatt = 0.
+  REAL :: grossismxx = 1.0
+  REAL :: grossismyy = 1.0
+  REAL :: dzoomxx = 0.0
+  REAL :: dzoomyy = 0.0
+  REAL :: tauxx = 3.0
+  REAL :: tauyy = 3.0
+  REAL :: clon = 0.
+  REAL :: clat = 0.
+  REAL :: grossismx = 1.0
+  REAL :: grossismy = 1.0
+  REAL :: dzoomx = 0.0
+  REAL :: dzoomy = 0.0
+  REAL :: taux = 3.0
+  REAL :: tauy = 3.0
+
+  LOGICAL :: lstardis = .TRUE.
+  LOGICAL :: purmats = .FALSE.
+  LOGICAL :: physic = .TRUE.
+  LOGICAL :: cycle_diurne = .TRUE.
+  LOGICAL :: soil_model = .TRUE.
+  LOGICAL :: new_oliq = .TRUE.
+  LOGICAL :: ok_orodr = .TRUE.
+  LOGICAL :: ok_orolf = .TRUE.
+  LOGICAL :: ok_limitvrai = .FALSE.
+  LOGICAL :: fxyhypbb = .TRUE.
+  LOGICAL :: ysinuss = .TRUE.
+  LOGICAL :: fxyhypb = .TRUE.
+  LOGICAL :: ysinus = .TRUE.
+!
+! For time keeping
+!
+  INTEGER :: date_time(8), date_start, date_end
+  CHARACTER(LEN=10) big_ben(3)
+!
+!
+!
+  CALL DATE_AND_TIME(big_ben(1), big_ben(2), big_ben(3), date_time)
+  date_start = date_time(8) + 1000*date_time(7) + 60*1000*date_time(7)
+!
+!Config  Key  = dayref
+!Config  Desc = Jour de l'etat initial
+!Config  Def  = 181
+!Config  Help = Jour de l'etat initial ( = 350  si 20 Decembre ,
+!Config         par expl. ,comme ici ) ... A completer
+  dayref=181
+  CALL getin('dayref', dayref)
+
+!Config  Key  = anneeref
+!Config  Desc = Annee de l'etat initial
+!Config  Def  = 1998
+!Config  Help = Annee de l'etat  initial 
+!Config         (   avec  4  chiffres   ) ... A completer
+  anneeref = 1998
+  CALL getin('anneeref',anneeref)
+
+!Config  Key  = nday
+!Config  Desc = Nombre de jours d'integration
+!Config  Def  = 10
+!Config  Help = Nombre de jours d'integration
+!Config         ... On pourait aussi permettre des mois ou des annees !
+  nday = 10
+  CALL getin('nday',nday)
+
+!Config  Key  = day_step
+!Config  Desc = nombre de pas par jour
+!Config  Def  = 240 
+!Config  Help = nombre de pas par jour (multiple de iperiod) (
+!Config          ici pour  dt = 1 min ) 
+  day_step = 240 
+  CALL getin('day_step',day_step)
+
+!Config  Key  = iperiod
+!Config  Desc = periode pour le pas Matsuno 
+!Config  Def  = 5
+!Config  Help = periode pour le pas Matsuno (en pas de temps) 
+  iperiod = 5
+  CALL getin('iperiod',iperiod)
+
+
+!Config  Key  = iconser
+!Config  Desc = periode de sortie des variables de controle
+!Config  Def  = 240  
+!Config  Help = periode de sortie des variables de controle
+!Config         (En pas de temps)
+  iconser = 240  
+  CALL getin('iconser', iconser)
+
+!Config  Key  = iecri
+!Config  Desc = periode d'ecriture du fichier histoire
+!Config  Def  = 1
+!Config  Help = periode d'ecriture du fichier histoire (en jour) 
+  iecri = 1
+  CALL getin('iecri',iecri)
+
+
+!Config  Key  = periodav
+!Config  Desc = periode de stockage fichier histmoy
+!Config  Def  = 1
+!Config  Help = periode de stockage fichier histmoy (en jour) 
+  periodav = 1.
+  CALL getin('periodav',periodav)
+
+!Config  Key  = idissip
+!Config  Desc = periode de la dissipation 
+!Config  Def  = 10
+!Config  Help = periode de la dissipation 
+!Config         (en pas) ... a completer !
+  idissip = 10
+  CALL getin('idissip',idissip)
+
+!Config  Key  = lstardis
+!Config  Desc = choix de l'operateur de dissipation
+!Config  Def  = y
+!Config  Help = choix de l'operateur de dissipation
+!Config         'y' si on veut star et 'n' si on veut non-start !
+!Config         Moi y en a pas comprendre ! 
+  lstardis = .TRUE.
+  CALL getin('lstardis',lstardis)
+
+
+!Config  Key  = nitergdiv
+!Config  Desc = Nombre d'iteration de gradiv
+!Config  Def  = 1
+!Config  Help = nombre d'iterations de l'operateur de dissipation 
+!Config         gradiv
+  nitergdiv = 1
+  CALL getin('nitergdiv',nitergdiv)
+
+!Config  Key  = nitergrot
+!Config  Desc = nombre d'iterations de nxgradrot
+!Config  Def  = 2
+!Config  Help = nombre d'iterations de l'operateur de dissipation  
+!Config         nxgradrot
+  nitergrot = 2
+  CALL getin('nitergrot',nitergrot)
+
+
+!Config  Key  = niterh
+!Config  Desc = nombre d'iterations de divgrad
+!Config  Def  = 2
+!Config  Help = nombre d'iterations de l'operateur de dissipation
+!Config         divgrad
+  niterh = 2
+  CALL getin('niterh',niterh)
+
+
+!Config  Key  = tetagdiv
+!Config  Desc = temps de dissipation pour div
+!Config  Def  = 7200
+!Config  Help = temps de dissipation des plus petites longeur 
+!Config         d'ondes pour u,v (gradiv)
+  tetagdiv = 7200.
+  CALL getin('tetagdiv',tetagdiv)
+
+!Config  Key  = tetagrot
+!Config  Desc = temps de dissipation pour grad
+!Config  Def  = 7200
+!Config  Help = temps de dissipation des plus petites longeur 
+!Config         d'ondes pour u,v (nxgradrot)
+  tetagrot = 7200.
+  CALL getin('tetagrot',tetagrot)
+
+!Config  Key  = tetatemp 
+!Config  Desc = temps de dissipation pour h
+!Config  Def  = 7200
+!Config  Help =  temps de dissipation des plus petites longeur 
+!Config         d'ondes pour h (divgrad)   
+  tetatemp  = 7200.
+  CALL getin('tetatemp',tetatemp )
+
+!Config  Key  = coefdis
+!Config  Desc = coefficient pour gamdissip
+!Config  Def  = 0
+!Config  Help = coefficient pour gamdissip  
+  coefdis = 0.
+  CALL getin('coefdis',coefdis)
+
+!Config  Key  = purmats
+!Config  Desc = Schema d'integration
+!Config  Def  = n
+!Config  Help = Choix du schema d'integration temporel.
+!Config         y = pure Matsuno sinon c'est du Matsuno-leapfrog
+  purmats = .FALSE.
+  CALL getin('purmats',purmats)
+
+!Config  Key  = physic
+!Config  Desc = Avec ls physique 
+!Config  Def  = y
+!Config  Help = Permet de faire tourner le modele sans 
+!Config         physique.
+  physic = .TRUE.
+  CALL getin('physic',physic)
+
+
+!Config  Key  =  iphysiq
+!Config  Desc = Periode de la physique
+!Config  Def  = 5
+!Config  Help = Periode de la physique en pas de temps de la dynamique.
+  iphysiq = 5
+  CALL getin('iphysiq', iphysiq)
+
+!Config  Key  = ecritphy
+!Config  Desc = Frequence d'ecriture de la physique
+!Config  Def  = 1
+!Config  Help = frequence  de l'ecriture du fichier histphy
+!Config         en jours.
+  ecritphy = 1
+  CALL getin('ecritphy',ecritphy)
+
+!Config  Key  = cycle_diurne
+!Config  Desc = Cycle ddiurne
+!Config  Def  = y
+!Config  Help = Cette option permet d'eteidre le cycle diurne.
+!Config         Peut etre util pour accelerer le code !
+  cycle_diurne = .TRUE.
+  CALL getin('cycle_diurne',cycle_diurne)
+
+!Config  Key  = soil_model
+!Config  Desc = Modele de sol
+!Config  Def  = y
+!Config  Help = Choix du modele de sol (Thermique ?)
+!Config         Option qui pourait un string afin de pouvoir
+!Config         plus de choix ! Ou meme une liste d'options !
+  soil_model = .TRUE.
+  CALL getin('soil_model',soil_model)
+
+!Config  Key  = new_oliq
+!Config  Desc = Nouvelle eau liquide
+!Config  Def  = y
+!Config  Help = Permet de mettre en route la
+!Config         nouvelle parametrisation de l'eau liquide !
+  new_oliq = .TRUE.
+  CALL getin('new_oliq',new_oliq)
+
+!Config  Key  = ok_orodr
+!Config  Desc = Orodr ???
+!Config  Def  = y
+!Config  Help = Y en a pas comprendre !
+!Config         
+  ok_orodr = .TRUE.
+  CALL getin('ok_orodr',ok_orodr)
+
+!Config  Key  =  ok_orolf
+!Config  Desc = Orolf ??
+!Config  Def  = y
+!Config  Help = Connais pas !
+  ok_orolf = .TRUE.
+  CALL getin('ok_orolf', ok_orolf)
+
+!Config  Key  = ok_limitvrai
+!Config  Desc = Force la lecture de la bonne annee
+!Config  Def  = n
+!Config  Help = On peut forcer le modele a lire le
+!Config         fichier SST de la bonne annee. C'est une tres bonne
+!Config         idee, pourquoi ne pas mettre toujours a y ???
+  ok_limitvrai = .FALSE.
+  CALL getin('ok_limitvrai',ok_limitvrai)
+
+!Config  Key  = nbapp_rad
+!Config  Desc = Frequence d'appel au rayonnement
+!Config  Def  = 12
+!Config  Help = Nombre  d'appels des routines de rayonnements
+!Config         par jour.
+  nbapp_rad = 12
+  CALL getin('nbapp_rad',nbapp_rad)
+
+!Config  Key  = iflag_con
+!Config  Desc = Flag de convection
+!Config  Def  = 2
+!Config  Help = Flag  pour la convection les options suivantes existent :
+!Config         1 pour LMD,
+!Config         2 pour Tiedtke,
+!Config         3 pour CCM(NCAR)  
+  iflag_con = 2
+  CALL getin('iflag_con',iflag_con)
+
+!Config  Key  = clon
+!Config  Desc = centre du zoom, longitude
+!Config  Def  = 0
+!Config  Help = longitude en degres du centre 
+!Config         du zoom
+  clonn = 0.
+  CALL getin('clon',clonn)
+
+!Config  Key  = clat
+!Config  Desc = centre du zoom, latitude
+!Config  Def  = 0
+!Config  Help = latitude en degres du centre du zoom
+!Config         
+  clatt = 0.
+  CALL getin('clat',clatt)
+
+!Config  Key  = grossismx 
+!Config  Desc = zoom en longitude
+!Config  Def  = 1.0
+!Config  Help = facteur de grossissement du zoom,
+!Config         selon la longitude
+  grossismxx = 1.0
+  CALL getin('grossismx',grossismxx)
+
+!Config  Key  = grossismy
+!Config  Desc = zoom en latitude
+!Config  Def  = 1.0
+!Config  Help = facteur de grossissement du zoom,
+!Config         selon la latitude
+  grossismyy = 1.0
+  CALL getin('grossismy',grossismyy)
+
+!Config  Key  = fxyhypb
+!Config  Desc = Fonction  hyperbolique
+!Config  Def  = y
+!Config  Help = Fonction  f(y)  hyperbolique  si = .true.  
+!Config         sinon  sinusoidale
+  fxyhypbb = .TRUE.
+  CALL getin('fxyhypb',fxyhypbb)
+
+!Config  Key  = dzoomx
+!Config  Desc = extension en longitude
+!Config  Def  = 0
+!Config  Help = extension en longitude  de la zone du zoom  
+!Config         ( fraction de la zone totale)
+  dzoomxx = 0.0
+  CALL getin('dzoomx',dzoomxx)
+
+!Config  Key  = dzoomy
+!Config  Desc = extension en latitude
+!Config  Def  = 0
+!Config  Help = extension en latitude de la zone  du zoom  
+!Config         ( fraction de la zone totale)
+  dzoomyy = 0.0
+  CALL getin('dzoomy',dzoomyy)
+      
+!Config  Key  = taux
+!Config  Desc = raideur du zoom en  X
+!Config  Def  = 3
+!Config  Help = raideur du zoom en  X
+  tauxx = 3.0
+  CALL getin('taux',tauxx)
+
+!Config  Key  = tauyy
+!Config  Desc = raideur du zoom en  Y
+!Config  Def  = 3
+!Config  Help = raideur du zoom en  Y
+  tauyy = 3.0
+  CALL getin('tauy',tauyy)
+
+!Config  Key  = ysinus
+!Config  IF   = !fxyhypb
+!Config  Desc = Fonction en Sinus
+!Config  Def  = y
+!Config  Help = Fonction  f(y) avec y = Sin(latit.) si = .true. 
+!Config         sinon y = latit.
+  ysinuss = .TRUE.
+  CALL getin('ysinus',ysinuss)
+
+!Config  Key  = clon
+!Config  Desc = centre du zoom, longitude
+!Config  Def  = 0
+!Config  Help = longitude en degres du centre 
+!Config         du zoom
+  clon = 0.
+  CALL getin('clon',clon)
+
+!Config  Key  = clat
+!Config  Desc = centre du zoom, latitude
+!Config  Def  = 0
+!Config  Help = latitude en degres du centre du zoom
+!Config         
+  clat = 0.
+  CALL getin('clat',clat)
+
+!Config  Key  = grossismx 
+!Config  Desc = zoom en longitude
+!Config  Def  = 1.0
+!Config  Help = facteur de grossissement du zoom,
+!Config         selon la longitude
+  grossismx = 1.0
+  CALL getin('grossismx',grossismx)
+
+!Config  Key  = grossismy
+!Config  Desc = zoom en latitude
+!Config  Def  = 1.0
+!Config  Help = facteur de grossissement du zoom,
+!Config         selon la latitude
+  grossismy = 1.0
+  CALL getin('grossismy',grossismy)
+
+!Config  Key  = fxyhypb
+!Config  Desc = Fonction  hyperbolique
+!Config  Def  = y
+!Config  Help = Fonction  f(y)  hyperbolique  si = .true.  
+!Config         sinon  sinusoidale
+  fxyhypb = .TRUE.
+  CALL getin('fxyhypb',fxyhypb)
+
+!Config  Key  = dzoomx
+!Config  Desc = extension en longitude
+!Config  Def  = 0
+!Config  Help = extension en longitude  de la zone du zoom  
+!Config         ( fraction de la zone totale)
+  dzoomx = 0.0
+  CALL getin('dzoomx',dzoomx)
+
+!Config  Key  = dzoomy
+!Config  Desc = extension en latitude
+!Config  Def  = 0
+!Config  Help = extension en latitude de la zone  du zoom  
+!Config         ( fraction de la zone totale)
+  dzoomy = 0.0
+  CALL getin('dzoomy',dzoomy)
+
+!Config  Key  = taux
+!Config  Desc = raideur du zoom en  X
+!Config  Def  = 3
+!Config  Help = raideur du zoom en  X
+  taux = 3.0
+  CALL getin('taux',taux)
+
+!Config  Key  = tauy
+!Config  Desc = raideur du zoom en  Y
+!Config  Def  = 3
+!Config  Help = raideur du zoom en  Y
+  tauy = 3.0
+  CALL getin('tauy',tauy)
+
+!Config  Key  = ysinus
+!Config  IF   = !fxyhypb
+!Config  Desc = Fonction en Sinus
+!Config  Def  = y
+!Config  Help = Fonction  f(y) avec y = Sin(latit.) si = .true. 
+!Config         sinon y = latit.
+  ysinus = .TRUE.
+  CALL getin('ysinus',ysinus)
+
+!!
+!!
+  CALL DATE_AND_TIME(big_ben(1), big_ben(2), big_ben(3), date_time)
+  date_end = date_time(8) + 1000*date_time(7) + 60*1000*date_time(7)
+  WRITE(*,*) 'Time before dump in milli-sec :', date_end - date_start
+!!
+  CALL getin_dump()
+
+!!
+  CALL DATE_AND_TIME(big_ben(1), big_ben(2), big_ben(3), date_time)
+  date_end = date_time(8) + 1000*date_time(7) + 60*1000*date_time(7)
+  WRITE(*,*) 'Total time in milli-sec :', date_end - date_start
+
+END PROGRAM testconfig2
Index: IOIPSL/tags/v2_1_1/example/example/testflio.f90
===================================================================
--- IOIPSL/tags/v2_1_1/example/example/testflio.f90	(revision 31)
+++ IOIPSL/tags/v2_1_1/example/example/testflio.f90	(revision 31)
@@ -0,0 +1,333 @@
+PROGRAM testflio
+!-
+!$Id$
+!---------------------------------------------------------------------
+!- This program is an example of how to use "fliocom".
+!---------------------------------------------------------------------
+  USE ioipsl
+  USE defprec
+!-
+  IMPLICIT NONE
+!-
+  INTEGER,PARAMETER :: iimf=3, jjmf=2, llmf=3, itmf=5
+!-
+  REAL,DIMENSION(iimf,jjmf,llmf,itmf) :: forcing
+  REAL,DIMENSION(iimf,jjmf)           :: lonf,latf
+  REAL,DIMENSION(llmf)                :: levf
+  INTEGER,DIMENSION(itmf)             :: itauf
+  REAL :: parf=7.
+!-
+! REAL,DIMENSION(iimf,jjmf,llmf,itmf) :: forcingw
+  REAL,DIMENSION(iimf)                :: lonw
+  REAL,DIMENSION(jjmf)                :: latw
+  REAL,DIMENSION(llmf)                :: levw
+  INTEGER,DIMENSION(itmf)             :: itauw
+! REAL :: parw
+!-
+  CHARACTER(LEN=10),DIMENSION(flio_max_dims) :: f_n_d
+  INTEGER,DIMENSION(flio_max_dims) :: f_l_d,f_i_d
+  INTEGER :: i_t_w,n_d_w,n_a_w
+  INTEGER,DIMENSION(flio_max_var_dims) :: l_d_w,i_d_w
+  LOGICAL :: exv,exa
+  INTEGER :: iim,jjm,llm,ttm
+  INTEGER :: i,j,l,it,fid,id_dom
+  CHARACTER(LEN=25) :: f_n,v_n,c_n,c_tmp=' '
+  INTEGER :: year,month,day
+  REAL :: date,datew,dt,dtw,sec
+  REAL,DIMENSION(10) :: r_w
+  CHARACTER(LEN=30),DIMENSION(:),ALLOCATABLE :: cn_d,cn_v,cn_a
+  CHARACTER(LEN=30) :: cn_u,f_n_c
+!---------------------------------------------------------------------
+!-
+! Create a file for the lateral forcing
+!-
+  DO i=1,iimf
+    DO j=1,jjmf
+      lonf(i,j) = (REAL(i-1)/REAL(MAX(iimf-1,1)))*180.
+      latf(i,j) = (REAL(j-1)/REAL(MAX(jjmf-1,1)))*90.
+    ENDDO
+  ENDDO
+!-
+  levf(1:3) = (/ 0.7, 0.5, 0.3 /)
+!-
+  DO it = 1,itmf
+    itauf(it) = it+10
+    DO i=1,iimf
+      DO j=1,jjmf
+        DO l=1,llmf
+          forcing(i,j,l,it) = 10.*(10.*((10.*it)+l)+j)+i
+        ENDDO
+      ENDDO
+    ENDDO
+  ENDDO
+!-
+  WRITE (*,'(" -----------------------------")')
+  WRITE (*,'(" ------- Using fliocom -------")')
+  WRITE (*,'(" -----------------------------")')
+  WRITE(*,'(/," ",A,3(1X,I5))') &
+ &  'flio_max_files,flio_max_dims,flio_max_var_dims : ', &
+ &   flio_max_files,flio_max_dims,flio_max_var_dims
+!-
+  year = 1997; month = 5; day = 10; sec = 0.;
+  CALL ymds2ju (year,month,day,sec,date)
+  dt = 86400./2.
+  WRITE (*,'(/," ----------------------------------")')
+  WRITE (*,'(/," t_init : ",F11.3)') date
+!-
+! Create a file and add variables and attributes
+!-
+  WRITE (*,'(/," ----------------------------------")')
+!-
+  f_n = 'testflio.nc'
+  f_l_d(1:5) = (/  iimf,  jjmf,  llmf,    -1,   10   /)
+  f_n_d(1:5) = (/ "lon ","lat ","lev ","time","ud1 " /)
+!-
+  CALL flio_dom_set &
+ & (1,1,(/1,2/),(/iimf,jjmf/),(/iimf,jjmf/), &
+ &  (/1,1/),(/iimf,jjmf/),(/0,0/),(/0,0/),"orange",id_dom)
+  WRITE (*,'(/," --> fliocrfd (",A,",...)")') TRIM(f_n)
+  CALL fliocrfd (TRIM(f_n),f_n_d(1:5),f_l_d(1:5),fid, &
+ &               id_dom=id_dom,c_f_n=f_n_c)
+  WRITE (*,'(/,"   created file name : ",A)') TRIM(f_n_c)
+  CALL flio_dom_unset (id_dom)
+!-
+  WRITE (*,'(/," --> fliopstc")')
+  CALL fliopstc (fid, &
+ &  x_axis_2d=lonf(:,:),y_axis_2d=latf(:,:),z_axis=levf(:), &
+ &  t_axis=itauf(:),t_init=date,t_step=dt,t_calendar="gregorian")
+!-
+  CALL fliodefv (fid,'forcing',(/ 1,2,3,4 /),units='_',v_t=flio_r4)
+  CALL flioputa (fid,'forcing','vecteur_3',(/3.,5.,7./))
+  CALL flioputa (fid,'forcing','text_n',"Text attribute")
+  CALL fliodefv (fid,'my_var_1',(/ 5 /), &
+ &               v_t=flio_r4,units='_',valid_min=-10.,valid_max=+20.)
+  CALL fliodefv (fid,'Var_vr4',v_t=flio_r4,units='_')
+  CALL flioputa (fid,'Var_vr4','att_1',735)
+  CALL flioputa (fid,'?','Param_a4',REAL(parf,KIND=4))
+  CALL fliodefv (fid,'Var_vr8',v_t=flio_r8,units='_')
+  CALL fliocpya (fid,'Var_vr4','att_1',fid,'Var_vr8')
+  CALL flioputa (fid,'?','Param_a8',REAL(parf,KIND=8))
+  CALL fliodefv (fid,'Var_vi2',v_t=flio_i2,units='_')
+  CALL flioputv (fid,'forcing',forcing)
+  CALL flioputv (fid,'my_var_1',(/3.,4.,5./),start=(/3/))
+  CALL flioputv (fid,'Var_vr4',parf)
+  CALL flioputv (fid,'Var_vr8',parf)
+  CALL flioputv (fid,'Var_vi2',INT(parf,KIND=i_2))
+!-
+  WRITE (*,'(/," --> flioclo")')
+  CALL flioclo (fid)
+!-
+! Inspect the file
+!-
+  WRITE (*,'(/," ----------------------------------")')
+!-
+  WRITE (*,'(/," --> fliodmpf")')
+  CALL fliodmpf (TRIM(f_n_c))
+!-
+! Open the file and obtain information about the file
+!-
+  WRITE (*,'(/," ----------------------------------")')
+!-
+  WRITE (*,'(/," --> flioopfd")')
+  i = 0; j = 0; l = 0;
+  CALL flioopfd (TRIM(f_n_c),fid,nb_dim=i,nb_var=j,nb_gat=l)
+  WRITE (*,'(" Number of dimensions        in the file : ",I2)') i
+  WRITE (*,'(" Number of variables         in the file : ",I2)') j
+  WRITE (*,'(" Number of global attributes in the file : ",I2)') l
+!-
+  WRITE (*,'(/," --> flioinqf")')
+  CALL flioinqf &
+ & (fid,id_dim=f_i_d,ln_dim=f_l_d)
+  IF (i > 0) THEN
+    WRITE (*,'(" Identifiers of the dimensions :",/,(5(1X,I7),:))') &
+ &    f_i_d(1:MIN(i,SIZE(f_i_d)))
+    WRITE (*,'(" Dimensions :",/,(5(1X,I7),:))') &
+ &    f_l_d(1:MIN(i,SIZE(f_l_d)))
+  ENDIF
+!-
+  WRITE (*,'(/," --> flioinqn")')
+  ALLOCATE(cn_d(i),cn_v(j),cn_a(l))
+  CALL flioinqn (fid,cn_dim=cn_d,cn_var=cn_v,cn_gat=cn_a,cn_uld=cn_u)
+  WRITE (*,'(" Names of the dimensions in the file : ")')
+  DO it=1,i
+    WRITE (*,'("   """,A,"""")') TRIM(cn_d(it))
+  ENDDO
+  WRITE (*,'(" Names of the variables in the file : ")')
+  DO it=1,j
+    WRITE (*,'("   """,A,"""")') TRIM(cn_v(it))
+  ENDDO
+  WRITE (*,'(" Names of the global attributes in the file : ")')
+  DO it=1,l
+    WRITE (*,'("   """,A,"""")') TRIM(cn_a(it))
+  ENDDO
+  WRITE (*,'(" Name of the unlimited dimension : ")')
+  WRITE (*,'("   """,A,"""")') TRIM(cn_u)
+  DEALLOCATE(cn_d,cn_v,cn_a)
+!-
+  WRITE (*,'(/," --> flioqstc")')
+  c_n = "x"
+  CALL flioqstc (fid,TRIM(c_n),exv,v_n)
+  IF (exv) THEN
+    WRITE (*,'(" Name of the """,A,""" coordinate : ",A)') &
+ &   TRIM(c_n),TRIM(v_n)
+    CALL flioinqv &
+ &   (fid,TRIM(v_n),exv,nb_dims=n_d_w,len_dims=l_d_w,nb_atts=n_a_w) 
+    IF (n_d_w > 0) THEN
+      WRITE (*,'(" Number of dimensions : ",I2)') n_d_w
+      WRITE (*,'(" Dimensions :",/,(5(1X,I7),:))') &
+ &      l_d_w(1:MIN(n_d_w,SIZE(l_d_w)))
+      iim=l_d_w(1)
+    ENDIF
+    IF (n_a_w > 0) THEN
+      WRITE (*,'(" Number of attributes : ",I2)') n_a_w
+    ENDIF
+  ELSE
+    WRITE (*,'(" Coordinate """,A,""" not found")') TRIM(c_n)
+  ENDIF
+!-
+  WRITE (*,'(/," --> flioqstc")')
+  c_n = "y"
+  CALL flioqstc (fid,TRIM(c_n),exv,v_n)
+  IF (exv) THEN
+    WRITE (*,'(" Name of the """,A,""" coordinate : ",A)') &
+ &   TRIM(c_n),TRIM(v_n)
+    CALL flioinqv &
+ &   (fid,TRIM(v_n),exv,nb_dims=n_d_w,len_dims=l_d_w,nb_atts=n_a_w) 
+    IF (n_d_w > 0) THEN
+      WRITE (*,'(" Number of dimensions : ",I2)') n_d_w
+      WRITE (*,'(" Dimensions :",/,(5(1X,I7),:))') &
+ &      l_d_w(1:MIN(n_d_w,SIZE(l_d_w)))
+      jjm=l_d_w(n_d_w)
+    ENDIF
+    IF (n_a_w > 0) THEN
+      WRITE (*,'(" Number of attributes : ",I2)') n_a_w
+    ENDIF
+  ELSE
+    WRITE (*,'(" Coordinate """,A,""" not found")') TRIM(c_n)
+  ENDIF
+!-
+  WRITE (*,'(/," --> flioqstc")')
+  c_n = "z"
+  CALL flioqstc (fid,TRIM(c_n),exv,v_n)
+  IF (exv) THEN
+    WRITE (*,'(" Name of the """,A,""" coordinate : ",A)') &
+ &   TRIM(c_n),TRIM(v_n)
+    CALL flioinqv &
+ &   (fid,TRIM(v_n),exv,nb_dims=n_d_w,len_dims=l_d_w,nb_atts=n_a_w) 
+    IF (n_d_w > 0) THEN
+      WRITE (*,'(" Number of dimensions : ",I2)') n_d_w
+      WRITE (*,'(" Dimensions :",/,(5(1X,I7),:))') &
+ &      l_d_w(1:MIN(n_d_w,SIZE(l_d_w)))
+      llm=l_d_w(1)
+    ENDIF
+    IF (n_a_w > 0) THEN
+      WRITE (*,'(" Number of attributes : ",I2)') n_a_w
+    ENDIF
+  ELSE
+    WRITE (*,'(" Coordinate """,A,""" not found")') TRIM(c_n)
+  ENDIF
+!-
+  WRITE (*,'(/," --> flioqstc")')
+  c_n = "t"
+  CALL flioqstc (fid,TRIM(c_n),exv,v_n)
+  IF (exv) THEN
+    WRITE (*,'(" Name of the """,A,""" coordinate : ",A)') &
+ &   TRIM(c_n),TRIM(v_n)
+    CALL flioinqv &
+ &   (fid,TRIM(v_n),exv,nb_dims=n_d_w,len_dims=l_d_w,nb_atts=n_a_w) 
+    IF (n_d_w > 0) THEN
+      WRITE (*,'(" Number of dimensions : ",I2)') n_d_w
+      WRITE (*,'(" Dimensions :",/,(5(1X,I7),:))') &
+ &      l_d_w(1:MIN(n_d_w,SIZE(l_d_w)))
+      ttm=l_d_w(1)
+    ENDIF
+    IF (n_a_w > 0) THEN
+      WRITE (*,'(" Number of attributes : ",I2)') n_a_w
+    ENDIF
+  ELSE
+    WRITE (*,'(" Coordinate """,A,""" not found")') TRIM(c_n)
+  ENDIF
+!-
+  WRITE (*,'(/," --> fliogstc")')
+  CALL fliogstc (fid, &
+ &  x_axis=lonw,y_axis=latw,z_axis=levw, &
+ &  t_axis=itauw(:),t_init=datew,t_step=dtw,t_calendar=c_tmp, &
+ &  t_count=3)
+  WRITE (*,'(" x_axis :",/,(5(1X,1PE11.3),:))') lonw(1:iim)
+  WRITE (*,'(" y_axis :",/,(5(1X,1PE11.3),:))') latw(1:jjm)
+  WRITE (*,'(" z_axis :",/,(5(1X,1PE11.3),:))') levw(1:llm)
+  WRITE (*,'(" t_axis(1:3) :",/,(5(1X,I5),:))') itauw(1:3)
+  WRITE (*,'(" t_calendar  : ",A)') '"'//TRIM(c_tmp)//'"'
+  WRITE (*,'(" t_init,t_step :",(2(1X,1PE15.7),:))') datew,dtw
+!-
+  v_n = 'forcing'
+  WRITE (*,'(/," Variable : """,A,"""")') TRIM(v_n)
+  WRITE (*,'(" --> flioinqv(...,""",A,""",...)")') TRIM(v_n)
+  CALL flioinqv &
+ & (fid,TRIM(v_n),exv,v_t=i_t_w, &
+ &  nb_dims=n_d_w,len_dims=l_d_w,id_dims=i_d_w,nb_atts=n_a_w)
+  IF (exv) THEN
+    WRITE (*,'(" External type        : ",I2)') i_t_w
+    WRITE (*,'(" Number of dimensions : ",I2)') n_d_w
+    WRITE (*,'(" Dimensions :",/,5(1X,I7,:))') l_d_w(1:n_d_w)
+    WRITE (*,'(" Identifiers :",/,5(1X,I7,:))') i_d_w(1:n_d_w)
+    WRITE (*,'(" Number of attributes : ",I2)') n_a_w
+!---
+    IF (n_a_w > 0) THEN
+      ALLOCATE(cn_a(5))
+      CALL flioinqv (fid,TRIM(v_n),exv,cn_atts=cn_a)
+      WRITE (*,'(" Names of the attributes : ")')
+      DO it=1,n_a_w
+        WRITE (*,'("   """,A,"""")') TRIM(cn_a(it))
+      ENDDO
+      DEALLOCATE(cn_a)
+    ENDIF
+!---
+    WRITE (*, &
+ &   '(" --> flioinqa(...,""",A,""",""text_n"",...)")') TRIM(v_n)
+    CALL flioinqa (fid,TRIM(v_n),"text_n",exa,a_l=l)
+    IF (exa) THEN
+      WRITE (*,'("  len(text_n) : ",I3)') l
+!-----
+      WRITE (*,'(" --> fliogeta(...,""",A,""",""text_n"",...)")') &
+ &     TRIM(v_n)
+      CALL fliogeta (fid,TRIM(v_n),"text_n",c_tmp)
+      WRITE (*,'("  ""text_n"" : """,A,"""")') TRIM(c_tmp)
+    ELSE
+      WRITE (*,'(" Attribute not found")')
+    ENDIF
+  ELSE
+    WRITE (*,'(" Variable not found")')
+  ENDIF
+!-
+  v_n = 'my_var_1'
+  WRITE (*,'(/," Variable : """,A,"""")') TRIM(v_n)
+  WRITE (*,'(" --> flioinqv(...,""",A,""",...)")') TRIM(v_n)
+  CALL flioinqv &
+ & (fid,TRIM(v_n),exv, &
+ &  nb_dims=n_d_w,len_dims=l_d_w,id_dims=i_d_w,nb_atts=n_a_w)
+  IF (exv) THEN
+    WRITE (*,'(" Number of dimensions : ",I2)') n_d_w
+    WRITE (*,'(" Dimensions :",/,5(1X,I7,:))') l_d_w(1:n_d_w)
+    WRITE (*,'(" Identifiers :",/,5(1X,I7,:))') i_d_w(1:n_d_w)
+    WRITE (*,'(" Number of attributes : ",I2)') n_a_w
+    WRITE (*,'(" --> fliogetv(...,""",A,""",...)")') TRIM(v_n)
+    CALL fliogetv (fid,TRIM(v_n),r_w)
+    WRITE (*, &
+ &   '("  Values :",/,(5(1X,1PE11.3),:))') r_w
+    i = 2; j = 5;
+    WRITE (*,'(" --> fliogetv(...,",A, &
+ &             ",start=(/",I2,"/),count=(/",I2,"/))")') &
+ &   '"'//TRIM(v_n)//'"',i,j
+    CALL fliogetv (fid,TRIM(v_n),r_w,start=(/i/),count=(/j/))
+    WRITE (*, &
+ &   '("  Values(",I2,":",I2,") :",/,(5(1X,1PE11.3),:))') &
+ &   i,i+j-1,r_w(1:j)
+  ENDIF
+!-
+  WRITE (*,'(/," --> flioclo")')
+  CALL flioclo (fid)
+!-
+  WRITE (*,'(/," ----------------------------------")')
+!-------------------
+END PROGRAM testflio
Index: IOIPSL/tags/v2_1_1/example/example/testhist1.f90
===================================================================
--- IOIPSL/tags/v2_1_1/example/example/testhist1.f90	(revision 31)
+++ IOIPSL/tags/v2_1_1/example/example/testhist1.f90	(revision 31)
@@ -0,0 +1,134 @@
+PROGRAM testhist1
+!-
+!$Id$
+!---------------------------------------------------------------------
+!- This program provide a an example of the basic usage of HIST.
+!- No secial features are used but just the basics.
+!---------------------------------------------------------------------
+  USE ioipsl
+!
+  IMPLICIT NONE
+!
+  INTEGER,PARAMETER :: iim=96, jjm=96, llm=12, nbreg=200
+!
+  REAL :: champ1(iim,jjm), champ2(iim,jjm,llm), champ3(iim,jjm)
+  REAL :: lon(iim,jjm),lat(iim,jjm), lev(llm)
+  REAL :: lon_test(iim),lat_test(jjm)
+  REAL :: x
+!
+  INTEGER :: i, j, l, id, it, ij, sig_id, hori_id
+  INTEGER :: day=15, month=2, year=1997
+  INTEGER :: itau=0, index(nbreg), start
+!
+  REAL :: julday
+  REAL :: deltat=60., dt_wrt, dt_op
+  CHARACTER(LEN=20) :: histname
+!
+  REAL :: pi=3.1415
+!---------------------------------------------------------------------
+!-
+! 1.0 Define a few variables we will need. These are the coordinates
+!     the file name and the date.
+!-
+  DO i=1,iim
+    DO j=1,jjm
+      lon(i,j) = ((float(iim/2)+0.5)-float(i))*pi/float(iim/2) &
+ &              *(-1.)*180./pi
+      lat(i,j) = 180./pi*ASIN(((float(jjm/2)+0.5)-float(j)) &
+ &              /float(jjm/2))
+    ENDDO
+  ENDDO
+!-
+  lon_test(:) = lon(:,1)
+  lat_test(:) = lat(1,:)
+!-
+  DO l=1,llm
+    lev(l) = REAL(l)/llm
+  ENDDO
+!
+  histname = 'testhist1.nc'
+!-
+! 1.1 The chosen date is 15 Feb. 1997 as stated above.
+!     It has to be transformed into julian days using
+!     the calendar provided by IOIPSL.
+!-
+  CALL ymds2ju(year, month, day, 0.,julday)
+  dt_wrt = 3*deltat
+  dt_op = 3*deltat
+!-
+! 2.0 Do all the declarations for hist. That is define the file,
+!     the vertical coordinate and the variables in the file.
+!-
+  CALL ioconf_modname('testhist1 produced this file')
+!-
+  CALL histbeg (histname,iim,lon_test,jjm,lat_test, &
+ &              1,iim,1,jjm,itau,julday,deltat,hori_id,id)
+!-
+  CALL histvert (id,"sigma","Sigma levels","-",llm,lev,sig_id)
+!-
+  CALL histdef (id,"champ1","Some field","m", &
+ &       iim,jjm,hori_id,1,1,1,-99,32,"inst(scatter(x))",dt_op,dt_wrt)
+!-
+  CALL histdef (id,"champ2","Another field","m", &
+ &       iim,jjm,hori_id,llm,1,llm,sig_id,32,"t_max(max(x,1.0)*2)", &
+ &       deltat,dt_wrt)
+!-
+  CALL histdef (id,"champ3","A field without time","m", &
+ &       iim,jjm,hori_id,1,1,1,-99, 32,"once", &
+ &       deltat,dt_wrt)
+!-
+  CALL histend (id)
+!-
+! 2.1 The filed we are going to write are computes
+!-
+  x = 10.
+  CALL RANDOM_NUMBER(HARVEST=x)
+  CALL RANDOM_NUMBER(champ1)
+  champ3 = champ1
+  DO l=1,llm
+    champ2(:,:,l) = champ1*l
+  ENDDO
+!-
+! 3.0 Start the time steping and write the data as we go along.
+!-
+  start = 1
+!-
+  DO it=1,12
+!---
+!   3.1 In the 2D filed we will have a set of random numbers
+!       which move through the map.
+!---
+    ij = 0
+    DO j=1,nbreg/10
+      DO i=1,10
+        ij = ij+1
+        index(ij) = iim*(j+20)+(i+start)
+      ENDDO
+    ENDDO
+!---
+    IF (start < iim-10) THEN
+      start = start+10
+    ELSE
+      start = 1
+    ENDIF
+!---
+    itau = itau + 1
+!---
+!   3.2 Pass the data to HIST for operation and writing.
+!---
+    CALL histwrite (id,"champ1",itau,champ1,nbreg,index)
+    CALL histwrite (id,"champ2",itau,champ2,iim*jjm*llm,index)
+    CALL histwrite (id,"champ3",itau,champ3,iim*jjm,index)
+    champ1 = champ1+1
+    champ2 = champ2+2
+  ENDDO
+!-
+! 4.0 The HIST routines are ended and netCDF is closed
+!-
+!   CALL histclo
+! This line should work but there seems to be a bug
+! in the optional argument on SUN !
+!-
+  CALL histclo(id)
+!--------------------
+END PROGRAM testhist1
Index: IOIPSL/tags/v2_1_1/example/example/testhist2.f90
===================================================================
--- IOIPSL/tags/v2_1_1/example/example/testhist2.f90	(revision 31)
+++ IOIPSL/tags/v2_1_1/example/example/testhist2.f90	(revision 31)
@@ -0,0 +1,133 @@
+PROGRAM testhist2
+!-
+!$Id$
+!---------------------------------------------------------------------
+!- This program provide a an example of the basic usage of HIST.
+!- Here the test the time sampling and averaging. Thus a long
+!- time-series is produced and sampled in different ways.
+!---------------------------------------------------------------------
+  USE ioipsl
+!
+  IMPLICIT NONE
+!
+  INTEGER,PARAMETER :: iim=12,jjm=10,llm=2
+!
+  REAL :: champ1(iim,jjm), champ(iim,jjm), champ2(iim,jjm)
+  REAL :: lon(iim,jjm),lat(iim,jjm), lev(llm)
+  REAL :: x
+!
+  INTEGER :: i, j, l, id, id2, t, ij, sig_id, hori_id, it
+  INTEGER :: day=1, month=1, year=1997
+  INTEGER :: itau=0, start, index(1)
+!
+  REAL :: julday, un_mois, un_an
+  REAL :: deltat=86400, dt_wrt, dt_op, dt_wrt2, dt_op2
+  CHARACTER(LEN=20) :: histname
+!
+  REAL :: pi=3.1415
+!---------------------------------------------------------------------
+!-
+! 0.0 Choose a 360 days calendar
+!-
+  CALL ioconf_calendar('gregorian')
+!-
+! 1.0 Define a few variables we will need.
+!     These are the coordinates the file name and the date.
+!-
+  DO i=1,iim
+    DO j=1,jjm
+      lon(i,j) = ((float(iim/2)+0.5)-float(i))*pi/float(iim/2) &
+ &              *(-1.)*180./pi
+      lat(i,j) = 180./pi * ASIN(((float(jjm/2)+0.5)-float(j)) &
+ &              /float(jjm/2))
+    ENDDO
+  ENDDO
+!-
+  DO l=1,llm
+    lev(l) = float(l)/llm
+  ENDDO
+!-
+  histname = 'testhist2.nc'
+!-
+! 1.1 The chosen date is 15 Feb. 1997 as stated above.
+!     It has to be transformed into julian days using
+!     the calendar provided by IOIPSL.
+!-
+  CALL ymds2ju(year, month, day, 0.,julday)
+  CALL ioget_calendar(un_an)
+  un_mois = un_an/12.
+  dt_wrt = un_mois*deltat
+  dt_op = deltat
+  dt_wrt2 = -1.
+  dt_op2 = deltat
+!-
+! 2.0 Do all the declarations for hist. That is define the file,
+!     the vertical coordinate and the variables in the file.
+!     Monthly means are written to test this feature
+!-
+  CALL ioconf_modname ('testhist1 produced this file')
+!-
+  CALL histbeg (histname,iim,lon,jjm,lat, &
+ &       1,iim,1,jjm,itau,julday,deltat,hori_id,id)
+!-
+  CALL histvert (id,"sigma","Sigma levels","-",llm,lev,sig_id)
+!-
+  CALL histdef (id,"champ1","Some field","m", &
+ &       iim,jjm,hori_id,1,1,1,-99,32,"t_sum",dt_op,dt_wrt)
+!-
+  CALL histdef (id,"champ2","summed field","m", &
+ &       iim,jjm,hori_id,1,1,1,-99,32,"t_sum",dt_op,dt_wrt)
+!-
+  CALL histend (id)
+!-
+! Open a second file which will do monthly means using the -1 notation.
+!-
+  histname = 'testhist2_bis.nc'
+  CALL histbeg (histname,iim,lon,jjm,lat, &
+ &       1,iim,1,jjm,itau,julday,deltat,hori_id,id2)
+!-
+  CALL histvert (id2,"sigma","Sigma levels","-",llm,lev,sig_id)
+!-
+  CALL histdef (id2,"champ1","Some field","m", &
+ &       iim,jjm,hori_id,1,1,1,-99,32,"t_sum",dt_op2,dt_wrt2)
+!-
+  CALL histdef (id2,"champ2","summed field","m", &
+ &       iim,jjm,hori_id,1,1,1,-99,32,"t_sum",dt_op2,dt_wrt2)
+!-
+  CALL histend (id2)
+!-
+! 2.1 The filed we are going to write are computes
+!-
+  CALL RANDOM_NUMBER(HARVEST=x)
+  CALL RANDOM_NUMBER(champ)
+  champ = champ*2*pi
+  champ1 = sin(champ)
+  champ2(:,:) = 1.
+!-
+! 3.0 Start the time steping and write the data as we go along.
+!-
+  start = 1
+!-
+  DO it=1,730
+!---
+!   3.1 In the 2D filed we will have a set of random numbers
+!       which move through the map.
+!---
+    itau = itau+1
+!---
+!   3.2 Pass the data to HIST for operation and writing.
+!---
+    CALL histwrite (id, "champ1",itau,champ1,iim*jjm,index)
+    CALL histwrite (id2,"champ1",itau,champ1,iim*jjm,index)
+    CALL histwrite (id, "champ2",itau,champ2,iim*jjm,index)
+    CALL histwrite (id2,"champ2",itau,champ2,iim*jjm,index)
+!---
+    champ1 = sin((it+1)*champ)
+  ENDDO
+!-
+! 4.0 The HIST routines are ended and netCDF is closed
+!-
+  CALL histclo (id)
+  CALL histclo (id2)
+!--------------------
+END PROGRAM testhist2
Index: IOIPSL/tags/v2_1_1/example/example/testopp.f90
===================================================================
--- IOIPSL/tags/v2_1_1/example/example/testopp.f90	(revision 31)
+++ IOIPSL/tags/v2_1_1/example/example/testopp.f90	(revision 31)
@@ -0,0 +1,44 @@
+PROGRAM testopp
+!-
+!$Id$
+!---------------------------------------------------------------------
+!- This program allows to test the syntaxic analyzer.
+!---------------------------------------------------------------------
+   USE mathelp
+!-
+   IMPLICIT NONE
+!-
+   INTEGER,PARAMETER :: nbopp_max=10
+   REAL,PARAMETER :: missing_val=1.e20
+!- Please list here all the operation you wish to test.
+!- Do not forget to change the value of nbtest.
+   INTEGER,PARAMETER :: nbtest=3
+   CHARACTER(LEN=30),DIMENSION(nbtest) :: test_opp = &
+  &  (/ "t_max(gather(x*2))            ", &
+  &     "(inst(sqrt(max(X,0)*2.0)))    ", &
+  &     "(once)                        " /)
+!-
+   CHARACTER(LEN=80) :: opp
+   CHARACTER(LEN=50) :: ex_topps = 'ave, inst, t_min, t_max, once'
+   REAL,DIMENSION(nbopp_max) :: tmp_scal
+   CHARACTER(LEN=7),DIMENSION(nbopp_max) :: tmp_sopp
+   CHARACTER(LEN=7) :: tmp_topp
+   INTEGER :: nbopp,i,io
+!---------------------------------------------------------------------
+   DO io=1,nbtest
+     opp = test_opp(io)
+     WRITE(*,*) '-------------------------'
+     WRITE(*,*) ' '
+     WRITE(*,*) 'String to be analyzed : ',TRIM(opp)
+     CALL buildop (opp,ex_topps,tmp_topp,nbopp_max,missing_val, &
+    &              tmp_sopp,tmp_scal,nbopp)
+!-
+     WRITE(*,*) 'Time operation : ',TRIM(tmp_topp)
+     WRITE(*,*) 'Other operations  :', nbopp
+     DO i=1,nbopp
+       WRITE(*,*) 'i = ',i,' opp : ',tmp_sopp(i), &
+      &           ' scalar : ',tmp_scal(i)
+     ENDDO
+   ENDDO
+!------------------
+END PROGRAM testopp
Index: IOIPSL/tags/v2_1_1/example/example/testrest.f90
===================================================================
--- IOIPSL/tags/v2_1_1/example/example/testrest.f90	(revision 31)
+++ IOIPSL/tags/v2_1_1/example/example/testrest.f90	(revision 31)
@@ -0,0 +1,132 @@
+PROGRAM testrest
+!-
+!$Id$
+  !
+  USE ioipsl
+  !
+  !     This program provide a an example of the basic usage of REST.
+  !     Here the test the time sampling and averaging. Thus a long
+  !     time-series is produced and sampled in different ways.
+  !
+  IMPLICIT NONE
+  !
+  INTEGER :: iim, jjm, llm
+  PARAMETER (iim=12,jjm=10,llm=2)
+  !
+  REAL :: champ1(iim,jjm,llm), champ2(iim,jjm,llm+1), champ3(iim,jjm,llm)
+  REAL :: champ4(iim,jjm)
+  REAL :: champ_read(iim,jjm,llm)
+  REAL :: lon(iim,jjm),lat(iim,jjm), lev(llm)
+  REAL :: x
+  !
+  INTEGER :: i, j, l, fid, t, ij, sig_id, hori_id, it
+  INTEGER :: day=1, month=1, year=1997
+  INTEGER :: itau=1, start, INDEX(1)
+  !
+  REAL :: julday, un_mois, un_an
+  REAL :: deltat=86400, dt_wrt, dt_op, dt_wrt2, dt_op2
+  CHARACTER*20 :: fnamein, fnameout, keyword, value
+  !
+  REAL :: pi=3.1415
+  !
+  !     0.0 Choose a  gregorian calendar
+  !
+  CALL ioconf_calendar('gregorian')
+  !
+  !     1.0 Define a few variables we will need. These are the coordinates
+  !         the file name and the date.
+  !
+  DO i = 1, iim
+    DO j = 1, jjm
+      lon(i,j) = ((float(iim/2)+0.5)-float(i))*pi/float(iim/2) &
+         &           *(-1.)*180./pi
+      lat(i,j) = 180./pi * ASIN(((float(jjm/2)+0.5) - float(j)) &
+         &           /float(jjm/2))
+    ENDDO
+  ENDDO
+  !
+  DO l=1,llm
+    lev(l) = float(l)/llm
+  ENDDO
+  !
+  !     1.1 The chosen date is 15 Feb. 1997 as stated above. It has to be 
+  !         transformed into julian days using the calendar provided by 
+  !         IOIPSL.
+  !
+  CALL ymds2ju(year, month, day, 0.,julday)
+  CALL ioget_calendar(un_an)
+  un_mois = un_an/12.
+  dt_wrt = un_mois*deltat
+  dt_op = deltat
+  dt_wrt2 = -1.
+  dt_op2 = deltat
+  !
+  !
+  fnamein = 'NONE'
+  fnameout = 'restfile'
+  !
+  ! 2.0 Create a restart file from nothing !
+  !
+  CALL restini(fnamein, iim, jjm, lon, lat, llm, lev, fnameout, &
+     &     itau, julday, deltat, fid)
+  !
+  champ1(:,:,:) = ASIN(1.0)
+  champ2(:,:,:) = EXP(ASIN(1.0))
+  !
+  CALL ioconf_setatt('units', '?')
+  CALL ioconf_setatt('long_name', 'Tests 1 for a real variable')
+  CALL restput(fid, 'test1', iim, jjm, llm, itau, champ1)
+  !
+  CALL ioconf_setatt('units', '?')
+  CALL ioconf_setatt('long_name', 'Tests 2 for a real variable')
+  CALL restput(fid, 'test2', iim, jjm, llm+1, itau, champ2)
+  !
+  CALL restclo()
+  !
+  WRITE(*,*) '============== FIRST FILE CLOSED =============='
+  !
+  !  3.0 Reopen the restart file and check that the values read are correct
+  !
+  fnamein = 'restfile'
+  fnameout = 'restfilebis'
+  !
+  ! 
+  CALL restini(fnamein, iim, jjm, lon, lat, llm, lev, fnameout, &
+     &     itau, julday, deltat, fid)
+  !
+  CALL restget(fid, 'test1', iim, jjm, llm,itau, .FALSE., champ_read)
+  !
+  itau = itau+10
+  CALL restput(fid, 'test1', iim, jjm, llm, itau, champ_read)
+  CALL restput(fid, 'test2', iim, jjm, llm+1, itau, champ2)
+  !
+  itau = itau + 10
+  champ3(:,:,:) = champ_read(:,:,:) + champ2(:,:,1:llm) 
+  CALL restput(fid, 'test1', iim, jjm, llm, itau, champ3)
+  !
+  CALL restclo()
+  !
+  WRITE(*,'(a25,e36.30)') 'The input data : ',champ1(1,1,1)
+  WRITE(*,'(a25,e36.30)') 'The restart data : ',champ_read(1,1,1)
+  !
+  !  4.0 Reopen the restart file and add another time step
+  !
+  fnamein = 'restfilebis'
+  fnameout = 'restfilebis'
+  !
+  ! 
+  CALL restini(fnamein, iim, jjm, lon, lat, llm, lev, fnameout, &
+     &     itau, julday, deltat, fid)
+  !
+  itau = itau + 10
+  CALL restput(fid, 'test1', iim, jjm, llm, itau, champ1)
+  CALL ioconf_setatt('units', '?')
+  CALL ioconf_setatt('long_name', 'Test a variable with another dimension')
+  CALL restput(fid, 'test4', iim, jjm, 0, itau, champ4)
+  !
+  CALL restclo()
+  !
+  STOP
+  !
+END PROGRAM testrest
+
