Index: trunk/src/dm2dd.pro
===================================================================
--- trunk/src/dm2dd.pro	(revision 4)
+++ trunk/src/dm2dd.pro	(revision 5)
@@ -1,2 +1,3 @@
+;
 ;+
 ;
@@ -9,9 +10,9 @@
 ;    Calculate the decimal degree for a given degree and minute
 ;
-;    :param degree: degree 
+;    :param degree: degree
 ;    :type degree: integer
 ;    :raise degree: required
 ;
-;    :param minute: minute 
+;    :param minute: minute
 ;    :type minute: float
 ;    :raise minute: required
Index: trunk/src/dmean_mld.pro
===================================================================
--- trunk/src/dmean_mld.pro	(revision 4)
+++ trunk/src/dmean_mld.pro	(revision 5)
@@ -36,5 +36,5 @@
 ; :func:`file_prn_to_mem`
 ; :func:`join_mean_asc`
-; 
+;
 ; :restrictions:
 ;
@@ -99,5 +99,5 @@
 ndays=n_elements(days)
 ;
-; initialize dimension of the returned structure 
+; initialize dimension of the returned structure
 result = replicate(resultstruct, ndays)
 result.doy=days
Index: trunk/src/dms2dd.pro
===================================================================
--- trunk/src/dms2dd.pro	(revision 4)
+++ trunk/src/dms2dd.pro	(revision 5)
@@ -9,13 +9,13 @@
 ;    Calculate the decimal degree for a given degree minute and second
 ;
-;    :param degree: degree 
+;    :param degree: degree
 ;    :type degree: integer
 ;    :raise degree: required
 ;
-;    :param minute: minute 
+;    :param minute: minute
 ;    :type minute: integer
 ;    :raise minute: required
 ;
-;    :param second: second 
+;    :param second: second
 ;    :type second: integer
 ;    :raise second: required
Index: trunk/src/fig_mld.pro
===================================================================
--- trunk/src/fig_mld.pro	(revision 4)
+++ trunk/src/fig_mld.pro	(revision 5)
@@ -16,4 +16,5 @@
 ; location
 ; - plot ++
+; - write file:`${POMME_OD}/fig_mld.txt`
 ;
 ; :examples:
@@ -38,4 +39,6 @@
 ; :func:`join_dmean_asc`
 ;
+; :func:`reform`
+;
 ; :todo:
 ;
@@ -44,5 +47,5 @@
 ; consolidate
 ;
-; delta array of 2 : .5 1
+; better organisation of output files
 ;
 ; noter dans la doc data que l'axe des temps des fichiers modeles est incorrect
@@ -52,4 +55,6 @@
 ; - fplod 20101129T151939Z aedon.locean-ipsl.upmc.fr (Darwin)
 ;
+;   * loop on delta
+;   * create output file
 ;   * use http://www.dfanning.com/math_tips/nans.html to test *equality* to NaN
 ;
@@ -94,5 +99,5 @@
 data_insitu=join_dmean_asc(data_dmean,data_asc)
 ;
-; calcul du temps des données insitu avec comme 0 le 20000927
+; calcul du temps des données insitu avec comme 0 le 20000927 ++
 time_insitu=julday(1,1,2001) - julday(09,27,2000) - 1 + data_insitu.doy
 ;
@@ -109,5 +114,4 @@
    indice_insitu=WHERE(time_insitu EQ iday,count)
    IF (count EQ 0) THEN BEGIN
-      print, '1 ', iday, ' no insitu data'
       mld1[iday] = !VALUES.F_NAN
       mld2[iday] = !VALUES.F_NAN
@@ -118,5 +122,4 @@
       ylat[iday] = !VALUES.F_NAN
    ENDIF ELSE BEGIN
-      print, '2 ', iday, ' 1 insitu data'
       mld1[iday] = data_insitu[indice_insitu].mean_zhom001
       mld2[iday] = data_insitu[indice_insitu].mean_zhom002
@@ -141,40 +144,72 @@
 delta[0] = 0.5
 delta[1] = 1.
-;
-; loop on idelta ++
-idelta = 0
-;
-; loop on days
+ndelta=n_elements(delta)
+;
+; loop on delta
+FOR idelta=0, ndelta - 1 DO BEGIN
+   ; loop on days
+   FOR iday=0, ndays - 1 DO BEGIN
+      IF (finite(mld1[iday]) NE 0) THEN BEGIN
+         print, ' 3 iday xlon', iday, xlon[iday]
+         domdef
+         mybox = [ xlon[iday]-delta[idelta] $
+                 , xlon[iday]+delta[idelta] $
+                 , ylat[iday]-delta[idelta] $
+                 , ylat[iday]+delta[idelta] $
+                 ]
+         help, mybox
+         print, mybox
+
+         ; ++ verifier que la moyenne est bien faite dans la boite et pas dans tout le domaine
+         ;++ pb t point
+         ;mldm_box = reform(read_ncdf('mld', iday, /timestep, file=iodir+'eddy_mld.nc',  /nostruct, box = mybox))
+         ;mldr_box = reform(read_ncdf('mld', iday, /timestep, file=iodir+'noeddy_mld.nc',  /nostruct, box = mybox))
+
+         ;++mymldm[idelta,iday] = moyenne(mldm_box, box = mybox, 'xy')
+         ;++mymldr[idelta,iday] = moyenne(mldr_box, box = mybox, 'xy')
+         ;++myvarm[idelta,iday] = stddev(mldm_box)
+         ;++myvarr[idelta,iday] = stddev(mldr_box)
+      ENDIF ELSE BEGIN
+         ; print, '4 ',iday, ' no insitu data'
+         mymldm[idelta,iday] = !VALUES.F_NAN
+         mymldr[idelta,iday] = !VALUES.F_NAN
+         myvarm[idelta,iday] = !VALUES.F_NAN
+         myvarr[idelta,iday] = !VALUES.F_NAN
+      ENDELSE
+   ENDFOR
+ENDFOR
+;
+; Write results in ${POMME_OD}/fig_mld.txt
+filename=pomme_od_env+'fig_mld.txt'
+OPENW,lun, filename, /GET_LUN
+;++ hanlde error
+;
+header='jt xlon xlat mld1 mld2 mld3 mld4 mld5 mymldm_0 mymldr_0 myvarm_0 myvarr_0 mymldm_1 mymldr_1 myvarm_1 myvarr_1'
+; write header
+printf, lun, header
+;
+; write data lines
 FOR iday=0, ndays - 1 DO BEGIN
-      print, ' 0 iday mld1 xlon', iday, mld1[iday], xlon[iday]
-   IF (finite(mld1[iday]) NE 0) THEN BEGIN
-      print, ' 3 ', iday, ' insitu data'
-      print, ' 3a ', iday, xlon[iday]
-      domdef
-      mybox = [ xlon[iday]-delta[idelta] $
-              , xlon[iday]+delta[idelta] $
-              , ylat[iday]-delta[idelta] $
-              , ylat[iday]+delta[idelta] $
-              ]
-      help, mybox
-      print, mybox
-
-      ; ++ verifier que la moyenne est bien faite dans la boite et pas dans tout le domaine
-      mldm_box = reform(read_ncdf('mld', iday, /timestep, file=iodir+'eddy_mld.nc',  /nostruct, box = mybox))
-      mldr_box = reform(read_ncdf('mld', iday, /timestep, file=iodir+'noeddy_mld.nc',  /nostruct, box = mybox))
-
-      mymldm[idelta,iday] = moyenne(mldm_box, box = mybox, 'xy')
-      mymldr[idelta,iday] = moyenne(mldr_box, box = mybox, 'xy')
-      myvarm[idelta,iday] = stddev(mldm)
-      myvarr[idelta,iday] = stddev(mldr)
-   ENDIF ELSE BEGIN
-      print, '4 ',iday, ' no insitu data'
-      mymldm[idelta,iday] = !VALUES.F_NAN
-      mymldr[idelta,iday] = !VALUES.F_NAN
-      myvarm[idelta,iday] = !VALUES.F_NAN
-      myvarr[idelta,iday] = !VALUES.F_NAN
-   ENDELSE
+   printf, lun $
+         , iday $
+         , xlon[iday] $
+         , ylat[iday] $
+         , mld1[iday] $
+         , mld2[iday] $
+         , mld3[iday] $
+         , mld4[iday] $
+         , mld5[iday] $
+         , mymldm[0,iday] $
+         , mymldr[0,iday] $
+         , myvarm[0,iday] $
+         , myvarr[0,iday] $
+         , mymldm[1,iday] $
+         , mymldr[1,iday] $
+         , myvarm[1,iday] $
+         , myvarr[1,iday]
 ENDFOR
 ;
-;write, jt, xlon, ylat, mld1, mld2, mld3, mld4, mld5, mymldm, mymldr,myvarm, myvarr,mymldm[1], mymldr[1],myvarm[1], myvarr[1]
+; close file
+FREE_LUN, lun
+;
 END
Index: trunk/src/file_asc_p1l1_to_mem.pro
===================================================================
--- trunk/src/file_asc_p1l1_to_mem.pro	(revision 4)
+++ trunk/src/file_asc_p1l1_to_mem.pro	(revision 5)
@@ -96,5 +96,5 @@
 ;
 resultstruct = { station:0L $
-                 , prof :0L $ 
+                 , prof :0L $
                  , zctd : 0L $
                  , an: 0L $
@@ -106,6 +106,6 @@
                  , deg_lat_begin : 0L $
                  , mm_lat_begin: 0.0 $
-                 , deg_lon_begin: 0L $ 
-                 , mm_lon_begin: 0.0 $ 
+                 , deg_lon_begin: 0L $
+                 , mm_lon_begin: 0.0 $
                }
 nrows = file_lines(filename) - N_ELEMENTS(header);
Index: trunk/src/file_asc_p2l2_to_mem.pro
===================================================================
--- trunk/src/file_asc_p2l2_to_mem.pro	(revision 4)
+++ trunk/src/file_asc_p2l2_to_mem.pro	(revision 5)
@@ -17,5 +17,5 @@
 ;
 ; notes
-; decalage 
+; decalage
 ; xx
 ;
Index: trunk/src/file_prn_to_mem.pro
===================================================================
--- trunk/src/file_prn_to_mem.pro	(revision 4)
+++ trunk/src/file_prn_to_mem.pro	(revision 5)
@@ -17,5 +17,5 @@
 ;
 ; Realistic example with POMME files::
-;    
+;
 ;    IDL> result=file_prn_to_mem()
 ;
Index: trunk/src/init_pom.pro
===================================================================
--- trunk/src/init_pom.pro	(revision 4)
+++ trunk/src/init_pom.pro	(revision 5)
@@ -11,5 +11,5 @@
 ; - ++
 ; - ++
-; 
+;
 ; Read :file:`${POMME_ID}/meshmak.nc`.
 ;
@@ -63,4 +63,5 @@
 ;
 pomme_id_env=GETENV('POMME_ID')
+pomme_od_env=GETENV('POMME_OD')
 ;
 iodir = isadirectory(pomme_id_env)
Index: trunk/src/join_dmean_asc.pro
===================================================================
--- trunk/src/join_dmean_asc.pro	(revision 4)
+++ trunk/src/join_dmean_asc.pro	(revision 5)
@@ -9,5 +9,5 @@
 ;    Join information from mean (++details) and asc (++detail) structures
 ;
-;    If station is not found in data_asc structure, latitude and longitude are set 
+;    If station is not found in data_asc structure, latitude and longitude are set
 ;    to NaN.
 ;
