Index: /LMDZ5/trunk/libf/cosp/phys_cosp.F90
===================================================================
--- /LMDZ5/trunk/libf/cosp/phys_cosp.F90	(revision 1538)
+++ /LMDZ5/trunk/libf/cosp/phys_cosp.F90	(revision 1539)
@@ -148,4 +148,5 @@
   integer                         :: itap,k,ip
   real                            :: dtime,freq_cosp
+  logical, parameter              :: lCOSP=.FALSE.
 
 !
Index: /LMDZ5/trunk/libf/cosp/write_histdayCOSP.h
===================================================================
--- /LMDZ5/trunk/libf/cosp/write_histdayCOSP.h	(revision 1538)
+++ /LMDZ5/trunk/libf/cosp/write_histdayCOSP.h	(revision 1539)
@@ -10,33 +10,42 @@
        if (cfg%Llidar_sim) then
          if (cfg%Lcllcalipso) then
-          CALL histwrite_phy(nid_day_cosp,"cllcalipso",itau_wcosp,stlidar%cldlayer(:,1))
+          CALL histwrite_phy(nid_day_cosp,lCOSP,"cllcalipso", &
+     itau_wcosp,stlidar%cldlayer(:,1))
          endif
          if (cfg%Lclhcalipso) then
-          CALL histwrite_phy(nid_day_cosp,"clhcalipso",itau_wcosp,stlidar%cldlayer(:,3))
+          CALL histwrite_phy(nid_day_cosp,lCOSP,"clhcalipso", &
+     itau_wcosp,stlidar%cldlayer(:,3))
          endif
          if (cfg%Lclmcalipso) then
-          CALL histwrite_phy(nid_day_cosp,"clmcalipso",itau_wcosp,stlidar%cldlayer(:,2))
+          CALL histwrite_phy(nid_day_cosp,lCOSP,"clmcalipso", &
+     itau_wcosp,stlidar%cldlayer(:,2))
          endif
          if (cfg%Lcltcalipso) then
-          CALL histwrite_phy(nid_day_cosp,"cltcalipso",itau_wcosp,stlidar%cldlayer(:,4)) 
+          CALL histwrite_phy(nid_day_cosp,lCOSP,"cltcalipso", &
+     itau_wcosp,stlidar%cldlayer(:,4)) 
          endif
          if (cfg%Lclcalipso) then
-          CALL histwrite_phy(nid_day_cosp,"clcalipso",itau_wcosp,stlidar%lidarcld)
+          CALL histwrite_phy(nid_day_cosp,lCOSP,"clcalipso", &
+     itau_wcosp,stlidar%lidarcld)
          endif
          if (cfg%Lcfad_lidarsr532) then
            do ii=1,SR_BINS
-            CALL histwrite_phy(nid_day_cosp,"cfad_lidarsr532_"//chcol(ii),itau_wcosp,stlidar%cfad_sr(:,ii,:))
+            CALL histwrite_phy(nid_day_cosp,lCOSP, &
+     "cfad_lidarsr532_"//chcol(ii),itau_wcosp,stlidar%cfad_sr(:,ii,:))
            enddo
          endif
          if (cfg%Lparasol_refl) then
-           CALL histwrite_phy(nid_day_cosp,"parasol_refl",itau_wcosp,stlidar%parasolrefl)
+           CALL histwrite_phy(nid_day_cosp,lCOSP,"parasol_refl", &
+     itau_wcosp,stlidar%parasolrefl)
          endif
          if (cfg%Latb532) then
            do ii=1,Ncolumns
-            CALL histwrite_phy(nid_day_cosp,"atb532_"//chcol(ii),itau_wcosp,sglidar%beta_tot(:,ii,:))
+            CALL histwrite_phy(nid_day_cosp,lCOSP,"atb532_"//chcol(ii), &
+     itau_wcosp,sglidar%beta_tot(:,ii,:))
            enddo
          endif
          if (cfg%Lbeta_mol532) then
-           CALL histwrite_phy(nid_day_cosp,"beta_mol532",itau_wcosp,sglidar%beta_mol)
+           CALL histwrite_phy(nid_day_cosp,lCOSP,"beta_mol532", &
+     itau_wcosp,sglidar%beta_mol)
          endif
         endif ! Lidar
@@ -84,30 +93,39 @@
           if (cfg%Lclisccp2) then
             do ii=1,7
-              CALL histwrite_phy(nid_day_cosp,"clisccp2_"//chcol(ii),itau_wcosp,isccp%fq_isccp(:,ii,:))
+              CALL histwrite_phy(nid_day_cosp,lCOSP, &
+     "clisccp2_"//chcol(ii),itau_wcosp,isccp%fq_isccp(:,ii,:))
             enddo
           endif
           if (cfg%Lboxtauisccp) then
-             CALL histwrite_phy(nid_day_cosp,"boxtauisccp",itau_wcosp,isccp%boxtau)
+             CALL histwrite_phy(nid_day_cosp,lCOSP,"boxtauisccp", &
+     itau_wcosp,isccp%boxtau)
           endif
           if (cfg%Lboxptopisccp) then
-             CALL histwrite_phy(nid_day_cosp,"boxptopisccp",itau_wcosp,isccp%boxptop)
+             CALL histwrite_phy(nid_day_cosp,lCOSP,"boxptopisccp", &
+     itau_wcosp,isccp%boxptop)
           endif
           if (cfg%Ltclisccp) then
-             CALL histwrite_phy(nid_day_cosp,"tclisccp",itau_wcosp,isccp%totalcldarea)
+             CALL histwrite_phy(nid_day_cosp,lCOSP,"tclisccp", &
+     itau_wcosp,isccp%totalcldarea)
           endif
           if (cfg%Lctpisccp) then
-             CALL histwrite_phy(nid_day_cosp,"ctpisccp",itau_wcosp,isccp%meanptop)
+             CALL histwrite_phy(nid_day_cosp,lCOSP,"ctpisccp", &
+     itau_wcosp,isccp%meanptop)
           endif
           if (cfg%Ltauisccp) then
-             CALL histwrite_phy(nid_day_cosp,"tauisccp",itau_wcosp,isccp%meantaucld)
+             CALL histwrite_phy(nid_day_cosp,lCOSP,"tauisccp", &
+     itau_wcosp,isccp%meantaucld)
           endif
           if (cfg%Lalbisccp) then
-             CALL histwrite_phy(nid_day_cosp,"albisccp",itau_wcosp,isccp%meanalbedocld)
+             CALL histwrite_phy(nid_day_cosp,lCOSP,"albisccp", &
+     itau_wcosp,isccp%meanalbedocld)
           endif
           if (cfg%Lmeantbisccp) then
-             CALL histwrite_phy(nid_day_cosp,"meantbisccp",itau_wcosp,isccp%meantb)
+             CALL histwrite_phy(nid_day_cosp,lCOSP,"meantbisccp", &
+     itau_wcosp,isccp%meantb)
           endif
           if (cfg%Lmeantbclrisccp) then
-             CALL histwrite_phy(nid_day_cosp,"meantbclrisccp",itau_wcosp,isccp%meantbclr)
+             CALL histwrite_phy(nid_day_cosp,lCOSP,"meantbclrisccp", &
+     itau_wcosp,isccp%meantbclr)
           endif
         endif ! Isccp
Index: /LMDZ5/trunk/libf/cosp/write_histhfCOSP.h
===================================================================
--- /LMDZ5/trunk/libf/cosp/write_histhfCOSP.h	(revision 1538)
+++ /LMDZ5/trunk/libf/cosp/write_histhfCOSP.h	(revision 1539)
@@ -10,33 +10,42 @@
        if (cfg%Llidar_sim) then
          if (cfg%Lcllcalipso) then
-          CALL histwrite_phy(nid_hf_cosp,"cllcalipso",itau_wcosp,stlidar%cldlayer(:,1))
+          CALL histwrite_phy(nid_hf_cosp,lCOSP,"cllcalipso", &
+     itau_wcosp,stlidar%cldlayer(:,1))
          endif
          if (cfg%Lclhcalipso) then
-          CALL histwrite_phy(nid_hf_cosp,"clhcalipso",itau_wcosp,stlidar%cldlayer(:,3))
+          CALL histwrite_phy(nid_hf_cosp,lCOSP,"clhcalipso", &
+     itau_wcosp,stlidar%cldlayer(:,3))
          endif
          if (cfg%Lclmcalipso) then
-          CALL histwrite_phy(nid_hf_cosp,"clmcalipso",itau_wcosp,stlidar%cldlayer(:,2))
+          CALL histwrite_phy(nid_hf_cosp,lCOSP,"clmcalipso", &
+     itau_wcosp,stlidar%cldlayer(:,2))
          endif
          if (cfg%Lcltcalipso) then
-          CALL histwrite_phy(nid_hf_cosp,"cltcalipso",itau_wcosp,stlidar%cldlayer(:,4)) 
+          CALL histwrite_phy(nid_hf_cosp,lCOSP,"cltcalipso", &
+     itau_wcosp,stlidar%cldlayer(:,4)) 
          endif
          if (cfg%Lclcalipso) then
-          CALL histwrite_phy(nid_hf_cosp,"clcalipso",itau_wcosp,stlidar%lidarcld)
+          CALL histwrite_phy(nid_hf_cosp,lCOSP,"clcalipso", &
+     itau_wcosp,stlidar%lidarcld)
          endif
          if (cfg%Lcfad_lidarsr532) then
            do ii=1,SR_BINS
-            CALL histwrite_phy(nid_hf_cosp,"cfad_lidarsr532_"//chcol(ii),itau_wcosp,stlidar%cfad_sr(:,ii,:))
+            CALL histwrite_phy(nid_hf_cosp,lCOSP, &
+     "cfad_lidarsr532_"//chcol(ii),itau_wcosp,stlidar%cfad_sr(:,ii,:))
            enddo
          endif
          if (cfg%Lparasol_refl) then
-           CALL histwrite_phy(nid_hf_cosp,"parasol_refl",itau_wcosp,stlidar%parasolrefl)
+           CALL histwrite_phy(nid_hf_cosp,lCOSP,"parasol_refl", &
+     itau_wcosp,stlidar%parasolrefl)
          endif
          if (cfg%Latb532) then
            do ii=1,Ncolumns
-            CALL histwrite_phy(nid_hf_cosp,"atb532_"//chcol(ii),itau_wcosp,sglidar%beta_tot(:,ii,:))
+            CALL histwrite_phy(nid_hf_cosp,lCOSP,"atb532_"//chcol(ii), &
+     itau_wcosp,sglidar%beta_tot(:,ii,:))
            enddo
          endif
          if (cfg%Lbeta_mol532) then
-           CALL histwrite_phy(nid_hf_cosp,"beta_mol532",itau_wcosp,sglidar%beta_mol)
+           CALL histwrite_phy(nid_hf_cosp,lCOSP,"beta_mol532", &
+     itau_wcosp,sglidar%beta_mol)
          endif
         endif ! Lidar
@@ -84,31 +93,40 @@
           if (cfg%Lclisccp2) then
             do ii=1,7
-              CALL histwrite_phy(nid_hf_cosp,"clisccp2_"//chcol(ii),itau_wcosp,isccp%fq_isccp(:,ii,:))
+              CALL histwrite_phy(nid_hf_cosp,lCOSP, &
+     "clisccp2_"//chcol(ii),itau_wcosp,isccp%fq_isccp(:,ii,:))
             enddo
           endif
           if (cfg%Lboxtauisccp) then
-             CALL histwrite_phy(nid_hf_cosp,"boxtauisccp",itau_wcosp,isccp%boxtau)
+             CALL histwrite_phy(nid_hf_cosp,lCOSP,"boxtauisccp", &
+     itau_wcosp,isccp%boxtau)
           endif
           if (cfg%Lboxptopisccp) then
-             CALL histwrite_phy(nid_hf_cosp,"boxptopisccp",itau_wcosp,isccp%boxptop)
+             CALL histwrite_phy(nid_hf_cosp,lCOSP,"boxptopisccp", &
+     itau_wcosp,isccp%boxptop)
           endif
           if (cfg%Ltclisccp) then
-             CALL histwrite_phy(nid_hf_cosp,"tclisccp",itau_wcosp,isccp%totalcldarea)
+             CALL histwrite_phy(nid_hf_cosp,lCOSP,"tclisccp", &
+     itau_wcosp,isccp%totalcldarea)
           endif
           if (cfg%Lctpisccp) then
-             CALL histwrite_phy(nid_hf_cosp,"ctpisccp",itau_wcosp,isccp%meanptop)
+             CALL histwrite_phy(nid_hf_cosp,lCOSP,"ctpisccp", &
+     itau_wcosp,isccp%meanptop)
 
           endif
           if (cfg%Ltauisccp) then
-             CALL histwrite_phy(nid_hf_cosp,"tauisccp",itau_wcosp,isccp%meantaucld)
+             CALL histwrite_phy(nid_hf_cosp,lCOSP,"tauisccp", &
+     itau_wcosp,isccp%meantaucld)
           endif
           if (cfg%Lalbisccp) then
-             CALL histwrite_phy(nid_hf_cosp,"albisccp",itau_wcosp,isccp%meanalbedocld)
+             CALL histwrite_phy(nid_hf_cosp,lCOSP,"albisccp", &
+     itau_wcosp,isccp%meanalbedocld)
           endif
           if (cfg%Lmeantbisccp) then
-             CALL histwrite_phy(nid_hf_cosp,"meantbisccp",itau_wcosp,isccp%meantb)
+             CALL histwrite_phy(nid_hf_cosp,lCOSP,"meantbisccp", &
+     itau_wcosp,isccp%meantb)
           endif
           if (cfg%Lmeantbclrisccp) then
-             CALL histwrite_phy(nid_hf_cosp,"meantbclrisccp",itau_wcosp,isccp%meantbclr)
+             CALL histwrite_phy(nid_hf_cosp,lCOSP,"meantbclrisccp", &
+     itau_wcosp,isccp%meantbclr)
           endif
         endif ! Isccp
Index: /LMDZ5/trunk/libf/cosp/write_histmthCOSP.h
===================================================================
--- /LMDZ5/trunk/libf/cosp/write_histmthCOSP.h	(revision 1538)
+++ /LMDZ5/trunk/libf/cosp/write_histmthCOSP.h	(revision 1539)
@@ -10,33 +10,42 @@
        if (cfg%Llidar_sim) then
          if (cfg%Lcllcalipso) then
-          CALL histwrite_phy(nid_mth_cosp,"cllcalipso",itau_wcosp,stlidar%cldlayer(:,1))
+          CALL histwrite_phy(nid_mth_cosp,lCOSP,"cllcalipso",itau_wcosp, &
+     stlidar%cldlayer(:,1))
          endif
          if (cfg%Lclhcalipso) then
-          CALL histwrite_phy(nid_mth_cosp,"clhcalipso",itau_wcosp,stlidar%cldlayer(:,3))
+          CALL histwrite_phy(nid_mth_cosp,lCOSP,"clhcalipso",itau_wcosp, &
+     stlidar%cldlayer(:,3))
          endif
          if (cfg%Lclmcalipso) then
-          CALL histwrite_phy(nid_mth_cosp,"clmcalipso",itau_wcosp,stlidar%cldlayer(:,2))
+          CALL histwrite_phy(nid_mth_cosp,lCOSP,"clmcalipso",itau_wcosp, &
+     stlidar%cldlayer(:,2))
          endif
          if (cfg%Lcltcalipso) then
-          CALL histwrite_phy(nid_mth_cosp,"cltcalipso",itau_wcosp,stlidar%cldlayer(:,4)) 
+          CALL histwrite_phy(nid_mth_cosp,lCOSP,"cltcalipso",itau_wcosp, &
+     stlidar%cldlayer(:,4)) 
          endif
          if (cfg%Lclcalipso) then
-          CALL histwrite_phy(nid_mth_cosp,"clcalipso",itau_wcosp,stlidar%lidarcld)
+          CALL histwrite_phy(nid_mth_cosp,lCOSP,"clcalipso",itau_wcosp, &
+     stlidar%lidarcld)
          endif
          if (cfg%Lcfad_lidarsr532) then
            do ii=1,SR_BINS
-            CALL histwrite_phy(nid_mth_cosp,"cfad_lidarsr532_"//chcol(ii),itau_wcosp,stlidar%cfad_sr(:,ii,:))
+            CALL histwrite_phy(nid_mth_cosp,lCOSP, &
+     "cfad_lidarsr532_"//chcol(ii),itau_wcosp,stlidar%cfad_sr(:,ii,:))
            enddo
          endif
          if (cfg%Lparasol_refl) then
-           CALL histwrite_phy(nid_mth_cosp,"parasol_refl",itau_wcosp,stlidar%parasolrefl)
+           CALL histwrite_phy(nid_mth_cosp,lCOSP,"parasol_refl", &
+     itau_wcosp,stlidar%parasolrefl)
          endif
          if (cfg%Latb532) then
            do ii=1,Ncolumns
-            CALL histwrite_phy(nid_mth_cosp,"atb532_"//chcol(ii),itau_wcosp,sglidar%beta_tot(:,ii,:))
+            CALL histwrite_phy(nid_mth_cosp,lCOSP, &
+     "atb532_"//chcol(ii),itau_wcosp,sglidar%beta_tot(:,ii,:))
            enddo
          endif
          if (cfg%Lbeta_mol532) then
-           CALL histwrite_phy(nid_mth_cosp,"beta_mol532",itau_wcosp,sglidar%beta_mol)
+           CALL histwrite_phy(nid_mth_cosp,lCOSP,"beta_mol532", &
+     itau_wcosp,sglidar%beta_mol)
          endif
         endif ! Lidar
@@ -84,30 +93,39 @@
           if (cfg%Lclisccp2) then
             do ii=1,7
-              CALL histwrite_phy(nid_mth_cosp,"clisccp2_"//chcol(ii),itau_wcosp,isccp%fq_isccp(:,ii,:))
+              CALL histwrite_phy(nid_mth_cosp,lCOSP,"clisccp2_"//chcol(ii), &
+     itau_wcosp,isccp%fq_isccp(:,ii,:))
             enddo
           endif
           if (cfg%Lboxtauisccp) then
-             CALL histwrite_phy(nid_mth_cosp,"boxtauisccp",itau_wcosp,isccp%boxtau)
+             CALL histwrite_phy(nid_mth_cosp,lCOSP,"boxtauisccp", &
+     itau_wcosp,isccp%boxtau)
           endif
           if (cfg%Lboxptopisccp) then
-             CALL histwrite_phy(nid_mth_cosp,"boxptopisccp",itau_wcosp,isccp%boxptop)
+             CALL histwrite_phy(nid_mth_cosp,lCOSP,"boxptopisccp", &
+     itau_wcosp,isccp%boxptop)
           endif
           if (cfg%Ltclisccp) then
-             CALL histwrite_phy(nid_mth_cosp,"tclisccp",itau_wcosp,isccp%totalcldarea)
+             CALL histwrite_phy(nid_mth_cosp,lCOSP,"tclisccp", &
+     itau_wcosp,isccp%totalcldarea)
           endif
           if (cfg%Lctpisccp) then
-             CALL histwrite_phy(nid_mth_cosp,"ctpisccp",itau_wcosp,isccp%meanptop)
+             CALL histwrite_phy(nid_mth_cosp,lCOSP,"ctpisccp", &
+     itau_wcosp,isccp%meanptop)
           endif
           if (cfg%Ltauisccp) then
-             CALL histwrite_phy(nid_mth_cosp,"tauisccp",itau_wcosp,isccp%meantaucld)
+             CALL histwrite_phy(nid_mth_cosp,lCOSP,"tauisccp", &
+     itau_wcosp,isccp%meantaucld)
           endif
           if (cfg%Lalbisccp) then
-             CALL histwrite_phy(nid_mth_cosp,"albisccp",itau_wcosp,isccp%meanalbedocld)
+             CALL histwrite_phy(nid_mth_cosp,lCOSP,"albisccp", &
+     itau_wcosp,isccp%meanalbedocld)
           endif
           if (cfg%Lmeantbisccp) then
-             CALL histwrite_phy(nid_mth_cosp,"meantbisccp",itau_wcosp,isccp%meantb)
+             CALL histwrite_phy(nid_mth_cosp,lCOSP,"meantbisccp", &
+     itau_wcosp,isccp%meantb)
           endif
           if (cfg%Lmeantbclrisccp) then
-             CALL histwrite_phy(nid_mth_cosp,"meantbclrisccp",itau_wcosp,isccp%meantbclr)
+             CALL histwrite_phy(nid_mth_cosp,lCOSP,"meantbclrisccp", &
+     itau_wcosp,isccp%meantbclr)
           endif
         endif ! Isccp
Index: /LMDZ5/trunk/libf/phylmd/clesphys.h
===================================================================
--- /LMDZ5/trunk/libf/phylmd/clesphys.h	(revision 1538)
+++ /LMDZ5/trunk/libf/phylmd/clesphys.h	(revision 1539)
@@ -15,5 +15,10 @@
        REAL co2_ppm, co2_ppm0, solaire
        REAL(kind=8) RCO2, RCH4, RN2O, RCFC11, RCFC12  
+       REAL(kind=8) RCO2_act, RCH4_act, RN2O_act, RCFC11_act, RCFC12_act  
        REAL(kind=8) CH4_ppb, N2O_ppb, CFC11_ppt, CFC12_ppt
+!IM ajout CFMIP2/CMIP5
+       REAL co2_ppm_per
+       REAL(kind=8) RCO2_per,RCH4_per,RN2O_per,RCFC11_per,RCFC12_per
+       REAL(kind=8) CH4_ppb_per,N2O_ppb_per,CFC11_ppt_per,CFC12_ppt_per
 
 !OM ---> correction du bilan d'eau global
@@ -49,6 +54,4 @@
        INTEGER lev_histdayNMC
        Integer lev_histins, lev_histLES  
-
-
 !IM ok_histNMC  : sortie fichiers niveaux de pression (histmthNMC, histdayNMC, histhfNMC)
 !IM freq_outNMC : frequences de sortie fichiers niveaux de pression (histmthNMC, histdayNMC, histhfNMC)
@@ -58,5 +61,4 @@
        LOGICAL ok_histNMC(3)
        REAL freq_outNMC(3) , freq_calNMC(3)
-
        CHARACTER(len=4) type_run
 ! aer_type: pour utiliser un fichier constant dans readaerosol 
@@ -76,11 +78,14 @@
        COMMON/clesphys/cycle_diurne, soil_model, new_oliq,              &
      &     ok_orodr, ok_orolf, ok_limitvrai, nbapp_rad, iflag_con       &
-     &     , co2_ppm, solaire, RCO2, RCH4, RN2O, RCFC11, RCFC12         &
+     &     , co2_ppm, solaire                                           &
+     &     , RCO2, RCH4, RN2O, RCFC11, RCFC12                           &
+     &     , RCO2_act, RCH4_act, RN2O_act, RCFC11_act, RCFC12_act       &
+     &     , RCO2_per, RCH4_per, RN2O_per, RCFC11_per, RCFC12_per       &
      &     , CH4_ppb, N2O_ppb, CFC11_ppt, CFC12_ppt                     &
+     &     , CH4_ppb_per, N2O_ppb_per, CFC11_ppt_per, CFC12_ppt_per     &
      &     , top_height, overlap, cdmmax, cdhmax, ksta, ksta_ter        &
      &     , ok_kzmin, fmagic, pmagic                                   &
      &     , f_cdrag_ter,f_cdrag_oce,f_rugoro                           &
      &     , lev_histhf, lev_histday, lev_histmth                       &
-
      &     , lev_histins, lev_histLES, lev_histdayNMC                   &
      &     , pasphys, ok_histNMC, freq_outNMC, freq_calNMC              &
Index: /LMDZ5/trunk/libf/phylmd/conf_phys.F90
===================================================================
--- /LMDZ5/trunk/libf/phylmd/conf_phys.F90	(revision 1538)
+++ /LMDZ5/trunk/libf/phylmd/conf_phys.F90	(revision 1539)
@@ -118,7 +118,11 @@
   real, save :: scut_omp, qqa1_omp, qqa2_omp, gammas_omp, Fmax_omp, alphas_omp
 
-  REAL,SAVE :: R_ecc_omp,R_peri_omp,R_incl_omp,solaire_omp,co2_ppm_omp
-  REAL,SAVE :: RCO2_omp,CH4_ppb_omp,RCH4_omp,N2O_ppb_omp,RN2O_omp,CFC11_ppt_omp
-  REAL,SAVE :: RCFC11_omp,CFC12_ppt_omp,RCFC12_omp,epmax_omp
+  REAL,SAVE :: R_ecc_omp,R_peri_omp,R_incl_omp,solaire_omp
+  REAL,SAVE :: co2_ppm_omp, RCO2_omp, co2_ppm_per_omp, RCO2_per_omp
+  REAL,SAVE :: CH4_ppb_omp, RCH4_omp, CH4_ppb_per_omp, RCH4_per_omp
+  REAL,SAVE :: N2O_ppb_omp, RN2O_omp, N2O_ppb_per_omp, RN2O_per_omp
+  REAL,SAVE :: CFC11_ppt_omp,RCFC11_omp,CFC11_ppt_per_omp,RCFC11_per_omp
+  REAL,SAVE :: CFC12_ppt_omp,RCFC12_omp,CFC12_ppt_per_omp,RCFC12_per_omp
+  REAL,SAVE :: epmax_omp
   LOGICAL,SAVE :: ok_adj_ema_omp
   INTEGER,SAVE :: iflag_clw_omp
@@ -496,5 +500,62 @@
 !OK call getin('RCFC12', RCFC12)
 
-
+!ajout CFMIP begin
+!!
+!Config Key  = co2_ppm_per
+!Config Desc = concentration du co2_ppm_per
+!Config Def  = 348.
+!Config Help = 
+!               
+  co2_ppm_per_omp = co2_ppm_omp
+  call getin('co2_ppm_per', co2_ppm_per_omp)
+!!
+!Config Key  = RCO2_per
+!Config Desc = Concentration du CO2_per
+!Config Def  = co2_ppm_per * 1.0e-06  * 44.011/28.97
+!Config Def  = 348. * 1.0e-06  * 44.011/28.97
+!Config Help = 
+!               
+  RCO2_per_omp = co2_ppm_per_omp * 1.0e-06  * 44.011/28.97
+
+!Config Key  = RCH4_per
+!Config Desc = Concentration du CH4_per
+!Config Def  = 1.65E-06* 16.043/28.97
+!Config Help = 
+!               
+  zzz = CH4_ppb_omp
+  call getin('CH4_ppb_per', zzz)
+  CH4_ppb_per_omp = zzz
+  RCH4_per_omp = CH4_ppb_per_omp * 1.0E-09 * 16.043/28.97
+!!
+!Config Key  = RN2O_per
+!Config Desc = Concentration du N2O_per
+!Config Def  = 306.E-09* 44.013/28.97
+!Config Help = 
+!               
+  zzz = N2O_ppb_omp
+  call getin('N2O_ppb_per', zzz)
+  N2O_ppb_per_omp = zzz
+  RN2O_per_omp = N2O_ppb_per_omp * 1.0E-09 * 44.013/28.97
+!!
+!Config Key  = RCFC11_per
+!Config Desc = Concentration du CFC11_per
+!Config Def  = 280.E-12* 137.3686/28.97
+!Config Help = 
+!               
+  zzz = CFC11_ppt_omp
+  call getin('CFC11_ppt_per',zzz)
+  CFC11_ppt_per_omp = zzz
+  RCFC11_per_omp=CFC11_ppt_per_omp* 1.0E-12 * 137.3686/28.97
+!!
+!Config Key  = RCFC12_per
+!Config Desc = Concentration du CFC12_per
+!Config Def  = 484.E-12* 120.9140/28.97
+!Config Help = 
+!               
+  zzz = CFC12_ppt_omp
+  call getin('CFC12_ppt_per',zzz)
+  CFC12_ppt_per_omp = zzz
+  RCFC12_per_omp = CFC12_ppt_per_omp * 1.0E-12 * 120.9140/28.97
+!ajout CFMIP end
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -1489,5 +1550,15 @@
     CFC12_ppt = CFC12_ppt_omp
     RCFC12 = RCFC12_omp
-
+    RCO2_act = RCO2
+    RCH4_act = RCH4
+    RN2O_act = RN2O
+    RCFC11_act = RCFC11
+    RCFC12_act = RCFC12
+    RCO2_per = RCO2_per_omp
+    RCH4_per = RCH4_per_omp
+    RN2O_per = RN2O_per_omp
+    RCFC11_per = RCFC11_per_omp
+    RCFC12_per = RCFC12_per_omp
+    
     cycle_diurne = cycle_diurne_omp
     soil_model = soil_model_omp
@@ -1664,9 +1735,12 @@
   write(numout,*)' Constante solaire =',solaire
   write(numout,*)' co2_ppm =',co2_ppm
-  write(numout,*)' RCO2 = ',RCO2
-  write(numout,*)' CH4_ppb =',CH4_ppb,' RCH4 = ',RCH4
-  write(numout,*)' N2O_ppb =',N2O_ppb,' RN2O =  ',RN2O
-  write(numout,*)' CFC11_ppt=',CFC11_ppt,' RCFC11 =  ',RCFC11
-  write(numout,*)' CFC12_ppt=',CFC12_ppt,' RCFC12 =  ',RCFC12
+  write(numout,*)' RCO2_act = ',RCO2_act
+  write(numout,*)' CH4_ppb =',CH4_ppb,' RCH4_act = ',RCH4_act
+  write(numout,*)' N2O_ppb =',N2O_ppb,' RN2O_act=  ',RN2O_act
+  write(numout,*)' CFC11_ppt=',CFC11_ppt,' RCFC11_act=  ',RCFC11_act
+  write(numout,*)' CFC12_ppt=',CFC12_ppt,' RCFC12_act=  ',RCFC12_act
+  write(numout,*)' RCO2_per = ',RCO2_per,' RCH4_per = ', RCH4_per
+  write(numout,*)' RN2O_per = ',RN2O_per,' RCFC11_per = ', RCFC11_per
+  write(numout,*)' RCFC12_per = ',RCFC12_per
   write(numout,*)' cvl_corr=', cvl_corr
   write(numout,*)'ok_lic_melt=', ok_lic_melt
Index: /LMDZ5/trunk/libf/phylmd/iophy.F90
===================================================================
--- /LMDZ5/trunk/libf/phylmd/iophy.F90	(revision 1538)
+++ /LMDZ5/trunk/libf/phylmd/iophy.F90	(revision 1539)
@@ -9,7 +9,13 @@
   REAL,allocatable,dimension(:),save :: io_lon
   INTEGER, save :: phys_domain_id
+  INTEGER, save :: npstn
+  INTEGER, allocatable, dimension(:), save :: nptabij
   
   INTERFACE histwrite_phy
     MODULE PROCEDURE histwrite2d_phy,histwrite3d_phy
+  END INTERFACE
+
+  INTERFACE histbeg_phy_all
+    MODULE PROCEDURE histbeg_phy,histbeg_phy_points
   END INTERFACE
 
@@ -144,6 +150,177 @@
   
   end subroutine histbeg_phy
-  
-  subroutine histwrite2d_phy(nid,name,itau,field)
+
+  subroutine histbeg_phy_points(rlon,rlat,pim,tabij,ipt,jpt, &
+             plon,plat,plon_bounds,plat_bounds, &
+             nname,itau0,zjulian,dtime,nnhori,nnid_day)
+  USE dimphy
+  USE mod_phys_lmdz_para
+  USE mod_grid_phy_lmdz
+  use ioipsl
+  use write_field
+  implicit none
+  include 'dimensions.h' 
+
+    real,dimension(klon),intent(in) :: rlon
+    real,dimension(klon),intent(in) :: rlat
+    integer, intent(in) :: itau0
+    real,intent(in) :: zjulian
+    real,intent(in) :: dtime
+    integer, intent(in) :: pim
+    integer, intent(out) :: nnhori
+    character(len=20), intent(in) :: nname
+    INTEGER, intent(out) :: nnid_day
+    integer :: i
+    REAL,dimension(klon_glo)        :: rlat_glo
+    REAL,dimension(klon_glo)        :: rlon_glo
+    INTEGER, DIMENSION(pim), intent(in)  :: tabij
+    REAL,dimension(pim), intent(in) :: plat, plon
+    INTEGER,dimension(pim), intent(in) :: ipt, jpt
+    REAL,dimension(pim,2), intent(out) :: plat_bounds, plon_bounds
+
+    INTEGER, SAVE :: tabprocbeg, tabprocend
+!$OMP THREADPRIVATE(tabprocbeg, tabprocend)
+    INTEGER :: ip
+    INTEGER, PARAMETER :: nip=1
+    INTEGER :: npproc
+    REAL, allocatable, dimension(:) :: npplat, npplon
+    REAL, allocatable, dimension(:,:) :: npplat_bounds, npplon_bounds
+    INTEGER, PARAMETER :: jjmp1=jjm+1-1/jjm
+    REAL, dimension(iim,jjmp1) :: zx_lon, zx_lat
+
+    CALL gather(rlat,rlat_glo)
+    CALL bcast(rlat_glo)
+    CALL gather(rlon,rlon_glo)
+    CALL bcast(rlon_glo)
+
+!$OMP MASTER
+    DO i=1,pim
+
+!    print*,'CFMIP_iophy i tabij lon lat',i,tabij(i),plon(i),plat(i)
+
+     plon_bounds(i,1)=rlon_glo(tabij(i)-1)
+     plon_bounds(i,2)=rlon_glo(tabij(i)+1)
+     if(plon_bounds(i,2).LE.0..AND.plon_bounds(i,1).GE.0.) THEN
+      if(rlon_glo(tabij(i)).GE.0.) THEN
+       plon_bounds(i,2)=-1*plon_bounds(i,2)
+      endif
+     endif
+     if(plon_bounds(i,2).GE.0..AND.plon_bounds(i,1).LE.0.) THEN
+      if(rlon_glo(tabij(i)).LE.0.) THEN
+       plon_bounds(i,2)=-1*plon_bounds(i,2)
+      endif
+     endif
+!
+     IF ( tabij(i).LE.iim) THEN
+      plat_bounds(i,1)=rlat_glo(tabij(i))
+     ELSE
+      plat_bounds(i,1)=rlat_glo(tabij(i)-iim)
+     ENDIF
+     plat_bounds(i,2)=rlat_glo(tabij(i)+iim)
+!
+!    print*,'CFMIP_iophy point i lon lon_bds',i,plon_bounds(i,1),rlon_glo(tabij(i)),plon_bounds(i,2) 
+!    print*,'CFMIP_iophy point i lat lat_bds',i,plat_bounds(i,1),rlat_glo(tabij(i)),plat_bounds(i,2) 
+!
+    ENDDO
+    if (is_sequential) then
+
+     npstn=pim
+     IF(.NOT. ALLOCATED(nptabij)) THEN
+      ALLOCATE(nptabij(pim))
+     ENDIF 
+     DO i=1,pim
+      nptabij(i)=tabij(i)
+     ENDDO
+
+       CALL gr_fi_ecrit(1,klon,iim,jjmp1,rlon_glo,zx_lon)
+       if (iim.gt.1) then
+       DO i = 1, iim
+         zx_lon(i,1) = rlon_glo(i+1)
+         zx_lon(i,jjmp1) = rlon_glo(i+1)
+       ENDDO
+       endif
+       CALL gr_fi_ecrit(1,klon,iim,jjmp1,rlat_glo,zx_lat)
+
+    DO i=1,pim
+!    print*,'CFMIP_iophy i tabij lon lat',i,tabij(i),plon(i),plat(i)
+
+     plon_bounds(i,1)=zx_lon(ipt(i)-1,jpt(i))
+     plon_bounds(i,2)=zx_lon(ipt(i)+1,jpt(i))
+
+     if (ipt(i).EQ.1) then
+      plon_bounds(i,1)=zx_lon(iim,jpt(i))
+      plon_bounds(i,2)=360.+zx_lon(ipt(i)+1,jpt(i))
+     endif
+ 
+     if (ipt(i).EQ.iim) then
+      plon_bounds(i,2)=360.+zx_lon(1,jpt(i))
+     endif
+
+     plat_bounds(i,1)=zx_lat(ipt(i),jpt(i)-1)
+     plat_bounds(i,2)=zx_lat(ipt(i),jpt(i)+1)
+
+     if (jpt(i).EQ.1) then
+      plat_bounds(i,1)=zx_lat(ipt(i),1)+0.001
+      plat_bounds(i,2)=zx_lat(ipt(i),1)-0.001
+     endif
+ 
+     if (jpt(i).EQ.jjmp1) then
+      plat_bounds(i,1)=zx_lat(ipt(i),jjmp1)+0.001
+      plat_bounds(i,2)=zx_lat(ipt(i),jjmp1)-0.001
+     endif
+!
+!    print*,'CFMIP_iophy point i lon lon_bds',i,plon_bounds(i,1),rlon(tabij(i)),plon_bounds(i,2) 
+!    print*,'CFMIP_iophy point i lat lat_bds',i,plat_bounds(i,1),rlat(tabij(i)),plat_bounds(i,2) 
+!
+    ENDDO
+!    print*,'iophy is_sequential nname, nnhori, nnid_day=',trim(nname),nnhori,nnid_day
+     call histbeg(nname,pim,plon,plon_bounds, & 
+                           plat,plat_bounds, &
+                           itau0, zjulian, dtime, nnhori, nnid_day)
+    else
+     npproc=0
+     DO ip=1, pim
+      tabprocbeg=klon_mpi_begin
+      tabprocend=klon_mpi_end
+      IF(tabij(ip).GE.tabprocbeg.AND.tabij(ip).LE.tabprocend) THEN
+       npproc=npproc+1
+       npstn=npproc
+      ENDIF 
+     ENDDO
+!    print*,'CFMIP_iophy mpi_rank npstn',mpi_rank,npstn
+     IF(.NOT. ALLOCATED(nptabij)) THEN
+      ALLOCATE(nptabij(npstn))
+      ALLOCATE(npplon(npstn), npplat(npstn))
+      ALLOCATE(npplon_bounds(npstn,2), npplat_bounds(npstn,2))
+     ENDIF
+     npproc=0
+     DO ip=1, pim
+      IF(tabij(ip).GE.tabprocbeg.AND.tabij(ip).LE.tabprocend) THEN
+       npproc=npproc+1
+       nptabij(npproc)=tabij(ip)
+!      print*,'mpi_rank npproc ip plon plat tabij=',mpi_rank,npproc,ip, &
+!      plon(ip),plat(ip),tabij(ip)
+       npplon(npproc)=plon(ip)
+       npplat(npproc)=plat(ip)
+       npplon_bounds(npproc,1)=plon_bounds(ip,1)
+       npplon_bounds(npproc,2)=plon_bounds(ip,2)
+       npplat_bounds(npproc,1)=plat_bounds(ip,1)
+       npplat_bounds(npproc,2)=plat_bounds(ip,2)
+!!!
+!!! print qui sert a reordonner les points stations selon l'ordre CFMIP
+!!! ne pas enlever
+        print*,'iophy_mpi rank ip lon lat',mpi_rank,ip,plon(ip),plat(ip)
+!!!
+      ENDIF
+     ENDDO
+     call histbeg(nname,npstn,npplon,npplon_bounds, &
+                            npplat,npplat_bounds, &
+                            itau0,zjulian,dtime,nnhori,nnid_day,phys_domain_id)
+    endif
+!$OMP END MASTER
+
+  end subroutine histbeg_phy_points
+ 
+  subroutine histwrite2d_phy(nid,lpoint,name,itau,field)
   USE dimphy
   USE mod_phys_lmdz_para
@@ -153,10 +330,14 @@
     
     integer,intent(in) :: nid
+    logical,intent(in) :: lpoint 
     character*(*), intent(IN) :: name
     integer, intent(in) :: itau
     real,dimension(:),intent(in) :: field
     REAL,dimension(klon_mpi) :: buffer_omp
-    INTEGER :: index2d(iim*jj_nb)
+    INTEGER, allocatable, dimension(:) :: index2d
     REAL :: Field2d(iim,jj_nb)
+
+    integer :: ip
+    real,allocatable,dimension(:) :: fieldok
 
     IF (size(field)/=klon) CALL abort_gcm('iophy::histwrite2d','Field first dimension not equal to klon',1)
@@ -165,11 +346,36 @@
 !$OMP MASTER
     CALL grid1Dto2D_mpi(buffer_omp,Field2d)
-    CALL histwrite(nid,name,itau,Field2d,iim*jj_nb,index2d)
+    if(.NOT.lpoint) THEN
+     ALLOCATE(index2d(iim*jj_nb))
+     ALLOCATE(fieldok(iim*jj_nb))
+     CALL histwrite(nid,name,itau,Field2d,iim*jj_nb,index2d)
+    else
+     ALLOCATE(fieldok(npstn))
+     ALLOCATE(index2d(npstn))
+
+     if(is_sequential) then
+!     klon_mpi_begin=1
+!     klon_mpi_end=klon
+      DO ip=1, npstn
+       fieldok(ip)=buffer_omp(nptabij(ip))
+      ENDDO
+     else
+      DO ip=1, npstn
+!     print*,'histwrite2d is_sequential npstn ip name nptabij',npstn,ip,name,nptabij(ip)
+       IF(nptabij(ip).GE.klon_mpi_begin.AND. &
+          nptabij(ip).LE.klon_mpi_end) THEN
+         fieldok(ip)=buffer_omp(nptabij(ip)-klon_mpi_begin+1)
+       ENDIF
+      ENDDO
+     endif
+     CALL histwrite(nid,name,itau,fieldok,npstn,index2d)
+!
+    endif
+    deallocate(index2d)
+    deallocate(fieldok)
 !$OMP END MASTER    
   end subroutine histwrite2d_phy
 
-
-  
-  subroutine histwrite3d_phy(nid,name,itau,field)
+  subroutine histwrite3d_phy(nid,lpoint,name,itau,field)
   USE dimphy
   USE mod_phys_lmdz_para
@@ -180,23 +386,59 @@
     
     integer,intent(in) :: nid
+    logical,intent(in) :: lpoint
     character*(*), intent(IN) :: name
     integer, intent(in) :: itau
     real,dimension(:,:),intent(in) :: field  ! --> field(klon,:)
     REAL,dimension(klon_mpi,size(field,2)) :: buffer_omp
-    INTEGER :: nlev
-    INTEGER :: index3d(iim*jj_nb*size(field,2))
     REAL :: Field3d(iim,jj_nb,size(field,2))
-    
+    INTEGER :: ip, n, nlev
+    INTEGER, ALLOCATABLE, dimension(:) :: index3d
+    real,allocatable, dimension(:,:) :: fieldok
+
     IF (size(field,1)/=klon) CALL abort_gcm('iophy::histwrite3d','Field first dimension not equal to klon',1)
     nlev=size(field,2)
-    
+
+!   print*,'hist3d_phy mpi_rank npstn=',mpi_rank,npstn
+
+!   DO ip=1, npstn
+!    print*,'hist3d_phy mpi_rank nptabij',mpi_rank,nptabij(ip)
+!   ENDDO
+
     CALL Gather_omp(field,buffer_omp)
 !$OMP MASTER
     CALL grid1Dto2D_mpi(buffer_omp,field3d)
-    CALL histwrite(nid,name,itau,Field3d,iim*jj_nb*nlev,index3d)
+    if(.NOT.lpoint) THEN
+     ALLOCATE(index3d(iim*jj_nb*nlev))
+     ALLOCATE(fieldok(iim*jj_nb,nlev))
+     CALL histwrite(nid,name,itau,Field3d,iim*jj_nb*nlev,index3d)
+    else
+      nlev=size(field,2)
+      ALLOCATE(index3d(npstn*nlev))
+      ALLOCATE(fieldok(npstn,nlev))
+
+      if(is_sequential) then
+!      klon_mpi_begin=1
+!      klon_mpi_end=klon
+       DO n=1, nlev
+       DO ip=1, npstn
+        fieldok(ip,n)=buffer_omp(nptabij(ip),n)
+       ENDDO
+       ENDDO
+      else
+       DO n=1, nlev
+       DO ip=1, npstn
+        IF(nptabij(ip).GE.klon_mpi_begin.AND. &
+         nptabij(ip).LE.klon_mpi_end) THEN
+         fieldok(ip,n)=buffer_omp(nptabij(ip)-klon_mpi_begin+1,n)
+        ENDIF
+       ENDDO
+       ENDDO
+      endif
+      CALL histwrite(nid,name,itau,fieldok,npstn*nlev,index3d)
+    endif 
+  deallocate(index3d)
+  deallocate(fieldok)
 !$OMP END MASTER    
   end subroutine histwrite3d_phy
   
-  
-
 end module iophy
Index: /LMDZ5/trunk/libf/phylmd/pbl_surface_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/phylmd/pbl_surface_mod.F90	(revision 1538)
+++ /LMDZ5/trunk/libf/phylmd/pbl_surface_mod.F90	(revision 1539)
@@ -177,5 +177,5 @@
        zxtsol,    zxfluxlat, zt2m,     qsat2m,        &
        d_t,       d_q,       d_u,      d_v,           & 
-       zcoefh,    slab_wfbils,                        &
+       zcoefh,    zcoefm,    slab_wfbils,             &
        qsol_d,    zq2m,      s_pblh,   s_plcl,        &
        s_capCL,   s_oliqCL,  s_cteiCL, s_pblT,        &
@@ -313,4 +313,5 @@
     REAL, DIMENSION(klon, klev),  INTENT(OUT)       :: d_v        ! change in v speed
     REAL, DIMENSION(klon, klev),  INTENT(OUT)       :: zcoefh     ! coef for turbulent diffusion of T and Q, mean for each grid point
+    REAL, DIMENSION(klon, klev),  INTENT(OUT)       :: zcoefm     ! coef for turbulent diffusion of U and V (?), mean for each grid point
 
 ! Output only for diagnostics
@@ -547,4 +548,6 @@
     zcoefh(:,:) = 0.0
     zcoefh(:,1) = 999999. ! zcoefh(:,k=1) should never be used
+    zcoefm(:,:) = 0.0
+    zcoefm(:,1) = 999999. !
     ytsoil = 999999. 
 
@@ -971,4 +974,5 @@
              i = ni(j)
              zcoefh(i,k) = zcoefh(i,k) + ycoefh(j,k)*ypct(j)
+             zcoefm(i,k) = zcoefm(i,k) + ycoefm(j,k)*ypct(j)
           END DO
        END DO
Index: /LMDZ5/trunk/libf/phylmd/phys_local_var_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/phylmd/phys_local_var_mod.F90	(revision 1538)
+++ /LMDZ5/trunk/libf/phylmd/phys_local_var_mod.F90	(revision 1539)
@@ -169,4 +169,18 @@
       !$OMP THREADPRIVATE(load_tmp7) 
 
+!IM ajout variables CFMIP2/CMIP5
+      REAL,ALLOCATABLE,SAVE :: topswad_aerop(:), solswad_aerop(:)
+!$OMP THREADPRIVATE(topswad_aerop, solswad_aerop)
+      REAL,ALLOCATABLE,SAVE :: topswai_aerop(:), solswai_aerop(:)
+!$OMP THREADPRIVATE(topswai_aerop, solswai_aerop)
+      REAL,ALLOCATABLE,SAVE :: topswad0_aerop(:), solswad0_aerop(:)
+!$OMP THREADPRIVATE(topswad0_aerop, solswad0_aerop)
+      REAL,ALLOCATABLE,SAVE :: topsw_aerop(:,:), topsw0_aerop(:,:)  
+!$OMP THREADPRIVATE(topsw_aerop, topsw0_aerop)
+      REAL,ALLOCATABLE,SAVE :: solsw_aerop(:,:), solsw0_aerop(:,:)
+!$OMP THREADPRIVATE(solsw_aerop, solsw0_aerop)
+      REAL,ALLOCATABLE,SAVE :: topswcf_aerop(:,:), solswcf_aerop(:,:)
+!$OMP THREADPRIVATE(topswcf_aerop, solswcf_aerop)
+
 CONTAINS
 
@@ -252,4 +266,12 @@
       allocate(load_tmp7(klon))
 
+!IM ajout variables CFMIP2/CMIP5
+      ALLOCATE(topswad_aerop(klon), solswad_aerop(klon))
+      ALLOCATE(topswai_aerop(klon), solswai_aerop(klon))
+      ALLOCATE(topswad0_aerop(klon), solswad0_aerop(klon))
+      ALLOCATE(topsw_aerop(klon,naero_grp), topsw0_aerop(klon,naero_grp))
+      ALLOCATE(solsw_aerop(klon,naero_grp), solsw0_aerop(klon,naero_grp))
+      ALLOCATE(topswcf_aerop(klon,naero_grp), solswcf_aerop(klon,naero_grp))
+
 END SUBROUTINE phys_local_var_init
 
@@ -332,4 +354,12 @@
       deallocate(d_u_hin,d_v_hin,d_t_hin)
 
+!IM ajout variables CFMIP2/CMIP5
+      deallocate(topswad_aerop, solswad_aerop)
+      deallocate(topswai_aerop, solswai_aerop)
+      deallocate(topswad0_aerop, solswad0_aerop)
+      deallocate(topsw_aerop, topsw0_aerop)
+      deallocate(solsw_aerop, solsw0_aerop)
+      deallocate(topswcf_aerop, solswcf_aerop)
+
 END SUBROUTINE phys_local_var_end
 
Index: /LMDZ5/trunk/libf/phylmd/phys_output_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/phylmd/phys_output_mod.F90	(revision 1538)
+++ /LMDZ5/trunk/libf/phylmd/phys_output_mod.F90	(revision 1539)
@@ -17,9 +17,12 @@
 
 
-   integer, parameter                           :: nfiles = 5
+   integer, parameter                           :: nfiles = 6
    logical, dimension(nfiles), save             :: clef_files
+   logical, dimension(nfiles), save             :: clef_stations
    integer, dimension(nfiles), save             :: lev_files
    integer, dimension(nfiles), save             :: nid_files
-!!$OMP THREADPRIVATE(clef_files, lev_files,nid_files)
+   integer, dimension(nfiles), save  :: nnid_files
+!!$OMP THREADPRIVATE(clef_files, clef_stations, lev_files,nid_files,nnid_files)
+   integer, dimension(nfiles), private, save :: nnhorim
  
    integer, dimension(nfiles), private, save :: nhorim, nvertm
@@ -42,5 +45,5 @@
 
   TYPE ctrl_out
-   integer,dimension(5) :: flag
+   integer,dimension(6) :: flag
    character(len=20)     :: name
   END TYPE ctrl_out
@@ -48,499 +51,555 @@
 !!! Comosentes de la coordonnee sigma-hybride
 !!! Ap et Bp
-  type(ctrl_out),save :: o_Ahyb         = ctrl_out((/ 1, 1, 1, 1, 1 /), 'Ap')
-  type(ctrl_out),save :: o_Bhyb         = ctrl_out((/ 1, 1, 1, 1, 1 /), 'Bp')
-  type(ctrl_out),save :: o_Alt          = ctrl_out((/ 1, 1, 1, 1, 1 /), 'Alt')
+  type(ctrl_out),save :: o_Ahyb         = ctrl_out((/ 1, 1, 1, 1, 1, 1 /), 'Ap')
+  type(ctrl_out),save :: o_Bhyb         = ctrl_out((/ 1, 1, 1, 1, 1, 1 /), 'Bp')
+  type(ctrl_out),save :: o_Alt          = ctrl_out((/ 1, 1, 1, 1, 1, 1 /), 'Alt')
 
 !!! 1D
-  type(ctrl_out),save :: o_phis         = ctrl_out((/ 1, 1, 10, 5, 1 /), 'phis') 
-  type(ctrl_out),save :: o_aire         = ctrl_out((/ 1, 1, 10,  10, 1 /),'aire')
-  type(ctrl_out),save :: o_contfracATM  = ctrl_out((/ 10, 1,  1, 10, 10 /),'contfracATM')
-  type(ctrl_out),save :: o_contfracOR   = ctrl_out((/ 10, 1,  1, 10, 10 /),'contfracOR')
-  type(ctrl_out),save :: o_aireTER      = ctrl_out((/ 10, 10, 1, 10, 10 /),'aireTER')
+  type(ctrl_out),save :: o_phis         = ctrl_out((/ 1, 1, 10, 5, 1, 1 /), 'phis') 
+  type(ctrl_out),save :: o_aire         = ctrl_out((/ 1, 1, 10,  10, 1, 1 /),'aire')
+  type(ctrl_out),save :: o_contfracATM  = ctrl_out((/ 10, 1,  1, 10, 10, 10 /),'contfracATM')
+  type(ctrl_out),save :: o_contfracOR   = ctrl_out((/ 10, 1,  1, 10, 10, 10 /),'contfracOR')
+  type(ctrl_out),save :: o_aireTER      = ctrl_out((/ 10, 10, 1, 10, 10, 10 /),'aireTER')
   
 !!! 2D
-
-  type(ctrl_out),save :: o_flat         = ctrl_out((/ 5, 1, 10, 5, 1 /),'flat')
-  type(ctrl_out),save :: o_slp          = ctrl_out((/ 1, 1, 1, 10, 1 /),'slp')
-  type(ctrl_out),save :: o_tsol         = ctrl_out((/ 1, 1, 1, 5, 1 /),'tsol')
-  type(ctrl_out),save :: o_t2m          = ctrl_out((/ 1, 1, 1, 5, 1 /),'t2m')
-  type(ctrl_out),save :: o_t2m_min      = ctrl_out((/ 1, 1, 10, 10, 10 /),'t2m_min')
-  type(ctrl_out),save :: o_t2m_max      = ctrl_out((/ 1, 1, 10, 10, 10 /),'t2m_max')
-  type(ctrl_out),save,dimension(4) :: o_t2m_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'t2m_ter'), &
-                                                 ctrl_out((/ 10, 4, 10, 10, 10 /),'t2m_lic'), &
-                                                 ctrl_out((/ 10, 4, 10, 10, 10 /),'t2m_oce'), &
-                                                 ctrl_out((/ 10, 4, 10, 10, 10 /),'t2m_sic') /)
-
-  type(ctrl_out),save :: o_wind10m      = ctrl_out((/ 1, 1, 1, 10, 10 /),'wind10m')
-  type(ctrl_out),save :: o_wind10max    = ctrl_out((/ 10, 1, 10, 10, 10 /),'wind10max')
-  type(ctrl_out),save :: o_sicf         = ctrl_out((/ 1, 1, 10, 10, 10 /),'sicf')
-  type(ctrl_out),save :: o_q2m          = ctrl_out((/ 1, 1, 1, 5, 1 /),'q2m')
-  type(ctrl_out),save :: o_u10m         = ctrl_out((/ 1, 1, 1, 5, 1 /),'u10m')
-  type(ctrl_out),save :: o_v10m         = ctrl_out((/ 1, 1, 1, 5, 1 /),'v10m')
-  type(ctrl_out),save :: o_psol         = ctrl_out((/ 1, 1, 1, 5, 1 /),'psol')
-  type(ctrl_out),save :: o_qsurf        = ctrl_out((/ 1, 10, 10, 10, 10 /),'qsurf')
-
-  type(ctrl_out),save,dimension(4) :: o_u10m_srf     = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'u10m_ter'), &
-                                              ctrl_out((/ 10, 4, 10, 10, 10 /),'u10m_lic'), &
-                                              ctrl_out((/ 10, 4, 10, 10, 10 /),'u10m_oce'), &
-                                              ctrl_out((/ 10, 4, 10, 10, 10 /),'u10m_sic') /)
-
-  type(ctrl_out),save,dimension(4) :: o_v10m_srf     = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'v10m_ter'), &
-                                              ctrl_out((/ 10, 4, 10, 10, 10 /),'v10m_lic'), &
-                                              ctrl_out((/ 10, 4, 10, 10, 10 /),'v10m_oce'), &
-                                              ctrl_out((/ 10, 4, 10, 10, 10 /),'v10m_sic') /)
-
-  type(ctrl_out),save :: o_qsol         = ctrl_out((/ 1, 10, 10, 10, 10 /),'qsol')
-
-  type(ctrl_out),save :: o_ndayrain     = ctrl_out((/ 1, 10, 10, 10, 10 /),'ndayrain')
-  type(ctrl_out),save :: o_precip       = ctrl_out((/ 1, 1, 1, 5, 10 /),'precip')
-  type(ctrl_out),save :: o_plul         = ctrl_out((/ 1, 1, 1, 10, 10 /),'plul')
-
-  type(ctrl_out),save :: o_pluc         = ctrl_out((/ 1, 1, 1, 5, 10 /),'pluc')
-  type(ctrl_out),save :: o_snow         = ctrl_out((/ 1, 1, 10, 5, 10 /),'snow') 
-  type(ctrl_out),save :: o_evap         = ctrl_out((/ 1, 1, 10, 10, 10 /),'evap')
-  type(ctrl_out),save,dimension(4) :: o_evap_srf     = (/ ctrl_out((/ 1, 1, 10, 10, 10 /),'evap_ter'), &
-                                           ctrl_out((/ 1, 1, 10, 10, 10 /),'evap_lic'), &
-                                           ctrl_out((/ 1, 1, 10, 10, 10 /),'evap_oce'), &
-                                           ctrl_out((/ 1, 1, 10, 10, 10 /),'evap_sic') /)
-  type(ctrl_out),save :: o_msnow       = ctrl_out((/ 1, 10, 10, 10, 10 /),'msnow')
-  type(ctrl_out),save :: o_fsnow       = ctrl_out((/ 1, 10, 10, 10, 10 /),'fsnow')
-
-  type(ctrl_out),save :: o_tops         = ctrl_out((/ 1, 1, 10, 10, 10 /),'tops')
-  type(ctrl_out),save :: o_tops0        = ctrl_out((/ 1, 5, 10, 10, 10 /),'tops0')
-  type(ctrl_out),save :: o_topl         = ctrl_out((/ 1, 1, 10, 5, 10 /),'topl')
-  type(ctrl_out),save :: o_topl0        = ctrl_out((/ 1, 5, 10, 10, 10 /),'topl0')
-  type(ctrl_out),save :: o_SWupTOA      = ctrl_out((/ 1, 4, 10, 10, 10 /),'SWupTOA')
-  type(ctrl_out),save :: o_SWupTOAclr   = ctrl_out((/ 1, 4, 10, 10, 10 /),'SWupTOAclr')
-  type(ctrl_out),save :: o_SWdnTOA      = ctrl_out((/ 1, 4, 10, 10, 10 /),'SWdnTOA')
-  type(ctrl_out),save :: o_SWdnTOAclr   = ctrl_out((/ 1, 4, 10, 10, 10 /),'SWdnTOAclr')
-  type(ctrl_out),save :: o_nettop       = ctrl_out((/ 1, 4, 10, 10, 10 /),'nettop')
-
-  type(ctrl_out),save :: o_SWup200      = ctrl_out((/ 1, 10, 10, 10, 10 /),'SWup200')
-  type(ctrl_out),save :: o_SWup200clr   = ctrl_out((/ 10, 1, 10, 10, 10 /),'SWup200clr')
-  type(ctrl_out),save :: o_SWdn200      = ctrl_out((/ 1, 10, 10, 10, 10 /),'SWdn200')
-  type(ctrl_out),save :: o_SWdn200clr   = ctrl_out((/ 10, 1, 10, 10, 10 /),'SWdn200clr')
+  type(ctrl_out),save :: o_flat         = ctrl_out((/ 5, 1, 10, 10, 5, 10 /),'flat')
+  type(ctrl_out),save :: o_slp          = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'slp')
+  type(ctrl_out),save :: o_tsol         = ctrl_out((/ 1, 1, 1, 5, 10, 10 /),'tsol')
+  type(ctrl_out),save :: o_t2m          = ctrl_out((/ 1, 1, 1, 5, 10, 10 /),'t2m')
+  type(ctrl_out),save :: o_t2m_min      = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'t2m_min')
+  type(ctrl_out),save :: o_t2m_max      = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'t2m_max')
+  type(ctrl_out),save,dimension(4) :: o_t2m_srf      = (/ ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'t2m_ter'), &
+                                                 ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'t2m_lic'), &
+                                                 ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'t2m_oce'), &
+                                                 ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'t2m_sic') /)
+
+  type(ctrl_out),save :: o_wind10m      = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'wind10m')
+  type(ctrl_out),save :: o_wind10max    = ctrl_out((/ 10, 1, 10, 10, 10, 10 /),'wind10max')
+  type(ctrl_out),save :: o_sicf         = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'sicf')
+  type(ctrl_out),save :: o_q2m          = ctrl_out((/ 1, 1, 1, 5, 10, 10 /),'q2m')
+  type(ctrl_out),save :: o_u10m         = ctrl_out((/ 1, 1, 1, 5, 10, 10 /),'u10m')
+  type(ctrl_out),save :: o_v10m         = ctrl_out((/ 1, 1, 1, 5, 10, 10 /),'v10m')
+  type(ctrl_out),save :: o_psol         = ctrl_out((/ 1, 1, 1, 5, 10, 10 /),'psol')
+  type(ctrl_out),save :: o_qsurf        = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'qsurf')
+
+  type(ctrl_out),save,dimension(4) :: o_u10m_srf     = (/ ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'u10m_ter'), &
+                                              ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'u10m_lic'), &
+                                              ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'u10m_oce'), &
+                                              ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'u10m_sic') /)
+
+  type(ctrl_out),save,dimension(4) :: o_v10m_srf     = (/ ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'v10m_ter'), &
+                                              ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'v10m_lic'), &
+                                              ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'v10m_oce'), &
+                                              ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'v10m_sic') /)
+
+  type(ctrl_out),save :: o_qsol         = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'qsol')
+
+  type(ctrl_out),save :: o_ndayrain     = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'ndayrain')
+  type(ctrl_out),save :: o_precip       = ctrl_out((/ 1, 1, 1, 10, 5, 10 /),'precip')
+  type(ctrl_out),save :: o_plul         = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'plul')
+
+  type(ctrl_out),save :: o_pluc         = ctrl_out((/ 1, 1, 1, 10, 5, 10 /),'pluc')
+  type(ctrl_out),save :: o_snow         = ctrl_out((/ 1, 1, 10, 10, 5, 10 /),'snow') 
+  type(ctrl_out),save :: o_evap         = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'evap')
+  type(ctrl_out),save,dimension(4) :: o_evap_srf     = (/ ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'evap_ter'), &
+                                           ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'evap_lic'), &
+                                           ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'evap_oce'), &
+                                           ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'evap_sic') /)
+  type(ctrl_out),save :: o_msnow       = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'msnow')
+  type(ctrl_out),save :: o_fsnow       = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsnow')
+
+  type(ctrl_out),save :: o_tops         = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'tops')
+  type(ctrl_out),save :: o_tops0        = ctrl_out((/ 1, 5, 10, 10, 10, 10 /),'tops0')
+  type(ctrl_out),save :: o_topl         = ctrl_out((/ 1, 1, 10, 5, 10, 10 /),'topl')
+  type(ctrl_out),save :: o_topl0        = ctrl_out((/ 1, 5, 10, 10, 10, 10 /),'topl0')
+  type(ctrl_out),save :: o_SWupTOA      = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'SWupTOA')
+  type(ctrl_out),save :: o_SWupTOAclr   = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'SWupTOAclr')
+  type(ctrl_out),save :: o_SWdnTOA      = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'SWdnTOA')
+  type(ctrl_out),save :: o_SWdnTOAclr   = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'SWdnTOAclr')
+  type(ctrl_out),save :: o_nettop       = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'nettop')
+
+  type(ctrl_out),save :: o_SWup200      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'SWup200')
+  type(ctrl_out),save :: o_SWup200clr   = ctrl_out((/ 10, 1, 10, 10, 10, 10 /),'SWup200clr')
+  type(ctrl_out),save :: o_SWdn200      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'SWdn200')
+  type(ctrl_out),save :: o_SWdn200clr   = ctrl_out((/ 10, 1, 10, 10, 10, 10 /),'SWdn200clr')
 
 ! arajouter
-!  type(ctrl_out),save :: o_LWupTOA     = ctrl_out((/ 1, 4, 10, 10, 10 /),'LWupTOA')
-!  type(ctrl_out),save :: o_LWupTOAclr  = ctrl_out((/ 1, 4, 10, 10, 10 /),'LWupTOAclr')
-!  type(ctrl_out),save :: o_LWdnTOA     = ctrl_out((/ 1, 4, 10, 10, 10 /),'LWdnTOA')
-!  type(ctrl_out),save :: o_LWdnTOAclr  = ctrl_out((/ 1, 4, 10, 10, 10 /),'LWdnTOAclr')
-
-  type(ctrl_out),save :: o_LWup200      = ctrl_out((/ 1, 10, 10, 10, 10 /),'LWup200')
-  type(ctrl_out),save :: o_LWup200clr   = ctrl_out((/ 1, 10, 10, 10, 10 /),'LWup200clr')
-  type(ctrl_out),save :: o_LWdn200      = ctrl_out((/ 1, 10, 10, 10, 10 /),'LWdn200')
-  type(ctrl_out),save :: o_LWdn200clr   = ctrl_out((/ 1, 10, 10, 10, 10 /),'LWdn200clr')
-  type(ctrl_out),save :: o_sols         = ctrl_out((/ 1, 1, 10, 10, 10 /),'sols')
-  type(ctrl_out),save :: o_sols0        = ctrl_out((/ 1, 5, 10, 10, 10 /),'sols0')
-  type(ctrl_out),save :: o_soll         = ctrl_out((/ 1, 1, 10, 10, 10 /),'soll')
-  type(ctrl_out),save :: o_soll0        = ctrl_out((/ 1, 5, 10, 10, 10 /),'soll0')
-  type(ctrl_out),save :: o_radsol       = ctrl_out((/ 1, 1, 10, 10, 10 /),'radsol')
-  type(ctrl_out),save :: o_SWupSFC      = ctrl_out((/ 1, 4, 10, 5, 10 /),'SWupSFC')
-  type(ctrl_out),save :: o_SWupSFCclr   = ctrl_out((/ 1, 4, 10, 10, 10 /),'SWupSFCclr')
-  type(ctrl_out),save :: o_SWdnSFC      = ctrl_out((/ 1, 1, 10, 5, 10 /),'SWdnSFC') 
-  type(ctrl_out),save :: o_SWdnSFCclr   = ctrl_out((/ 1, 4, 10, 5, 10 /),'SWdnSFCclr')
-  type(ctrl_out),save :: o_LWupSFC      = ctrl_out((/ 1, 4, 10, 10, 10 /),'LWupSFC')
-  type(ctrl_out),save :: o_LWupSFCclr   = ctrl_out((/ 1, 4, 10, 5, 10 /),'LWupSFCclr')
-  type(ctrl_out),save :: o_LWdnSFC      = ctrl_out((/ 1, 4, 10, 5, 10 /),'LWdnSFC')
-  type(ctrl_out),save :: o_LWdnSFCclr   = ctrl_out((/ 1, 4, 10, 5, 10 /),'LWdnSFCclr')
-  type(ctrl_out),save :: o_bils         = ctrl_out((/ 1, 2, 10, 5, 10 /),'bils')
-  type(ctrl_out),save :: o_sens         = ctrl_out((/ 1, 1, 10, 5, 10 /),'sens')
-  type(ctrl_out),save :: o_fder         = ctrl_out((/ 1, 2, 10, 10, 10 /),'fder')
-  type(ctrl_out),save :: o_ffonte       = ctrl_out((/ 1, 10, 10, 10, 10 /),'ffonte')
-  type(ctrl_out),save :: o_fqcalving    = ctrl_out((/ 1, 10, 10, 10, 10 /),'fqcalving')
-  type(ctrl_out),save :: o_fqfonte      = ctrl_out((/ 1, 10, 10, 10, 10 /),'fqfonte')
-
-  type(ctrl_out),save :: o_taux         = ctrl_out((/ 1, 10, 10, 10, 10 /),'taux')
-  type(ctrl_out),save :: o_tauy         = ctrl_out((/ 1, 10, 10, 10, 10 /),'tauy')
-  type(ctrl_out),save,dimension(4) :: o_taux_srf     = (/ ctrl_out((/ 1, 4, 10, 10, 10 /),'taux_ter'), &
-                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'taux_lic'), &
-                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'taux_oce'), &
-                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'taux_sic') /)
-
-  type(ctrl_out),save,dimension(4) :: o_tauy_srf     = (/ ctrl_out((/ 1, 4, 10, 10, 10 /),'tauy_ter'), &
-                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'tauy_lic'), &
-                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'tauy_oce'), &
-                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'tauy_sic') /)
-
-
-  type(ctrl_out),save,dimension(4) :: o_pourc_srf    = (/ ctrl_out((/ 1, 4, 10, 10, 10 /),'pourc_ter'), &
-                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'pourc_lic'), &
-                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'pourc_oce'), &
-                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'pourc_sic') /)     
-
-  type(ctrl_out),save,dimension(4) :: o_fract_srf    = (/ ctrl_out((/ 1, 4, 10, 10, 10 /),'fract_ter'), &
-                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'fract_lic'), &
-                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'fract_oce'), &
-                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'fract_sic') /)
-
-  type(ctrl_out),save,dimension(4) :: o_tsol_srf     = (/ ctrl_out((/ 1, 4, 10, 10, 10 /),'tsol_ter'), &
-                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'tsol_lic'), &
-                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'tsol_oce'), &
-                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'tsol_sic') /)
-
-  type(ctrl_out),save,dimension(4) :: o_sens_srf     = (/ ctrl_out((/ 1, 4, 10, 1, 10 /),'sens_ter'), &
-                                                 ctrl_out((/ 1, 4, 10, 1, 10 /),'sens_lic'), &
-                                                 ctrl_out((/ 1, 4, 10, 1, 10 /),'sens_oce'), &
-                                                 ctrl_out((/ 1, 4, 10, 1, 10 /),'sens_sic') /)
-
-  type(ctrl_out),save,dimension(4) :: o_lat_srf      = (/ ctrl_out((/ 1, 4, 10, 1, 10 /),'lat_ter'), &
-                                                 ctrl_out((/ 1, 4, 10, 1, 10 /),'lat_lic'), &
-                                                 ctrl_out((/ 1, 4, 10, 1, 10 /),'lat_oce'), &
-                                                 ctrl_out((/ 1, 4, 10, 1, 10 /),'lat_sic') /)
-
-  type(ctrl_out),save,dimension(4) :: o_flw_srf      = (/ ctrl_out((/ 1, 10, 10, 10, 10 /),'flw_ter'), &
-                                                 ctrl_out((/ 1, 10, 10, 10, 10 /),'flw_lic'), &
-                                                 ctrl_out((/ 1, 10, 10, 10, 10 /),'flw_oce'), &
-                                                 ctrl_out((/ 1, 10, 10, 10, 10 /),'flw_sic') /)
+!  type(ctrl_out),save :: o_LWupTOA     = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'LWupTOA')
+!  type(ctrl_out),save :: o_LWupTOAclr  = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'LWupTOAclr')
+!  type(ctrl_out),save :: o_LWdnTOA     = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'LWdnTOA')
+!  type(ctrl_out),save :: o_LWdnTOAclr  = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'LWdnTOAclr')
+
+  type(ctrl_out),save :: o_LWup200      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'LWup200')
+  type(ctrl_out),save :: o_LWup200clr   = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'LWup200clr')
+  type(ctrl_out),save :: o_LWdn200      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'LWdn200')
+  type(ctrl_out),save :: o_LWdn200clr   = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'LWdn200clr')
+  type(ctrl_out),save :: o_sols         = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'sols')
+  type(ctrl_out),save :: o_sols0        = ctrl_out((/ 1, 5, 10, 10, 10, 10 /),'sols0')
+  type(ctrl_out),save :: o_soll         = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'soll')
+  type(ctrl_out),save :: o_soll0        = ctrl_out((/ 1, 5, 10, 10, 10, 10 /),'soll0')
+  type(ctrl_out),save :: o_radsol       = ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'radsol')
+  type(ctrl_out),save :: o_SWupSFC      = ctrl_out((/ 1, 4, 10, 10, 5, 10 /),'SWupSFC')
+  type(ctrl_out),save :: o_SWupSFCclr   = ctrl_out((/ 1, 4, 10, 10, 5, 10 /),'SWupSFCclr')
+  type(ctrl_out),save :: o_SWdnSFC      = ctrl_out((/ 1, 1, 10, 10, 5, 10 /),'SWdnSFC') 
+  type(ctrl_out),save :: o_SWdnSFCclr   = ctrl_out((/ 1, 4, 10, 10, 5, 10 /),'SWdnSFCclr')
+  type(ctrl_out),save :: o_LWupSFC      = ctrl_out((/ 1, 4, 10, 10, 5, 10 /),'LWupSFC')
+  type(ctrl_out),save :: o_LWupSFCclr   = ctrl_out((/ 1, 4, 10, 10, 5, 10 /),'LWupSFCclr')
+  type(ctrl_out),save :: o_LWdnSFC      = ctrl_out((/ 1, 4, 10, 10, 5, 10 /),'LWdnSFC')
+  type(ctrl_out),save :: o_LWdnSFCclr   = ctrl_out((/ 1, 4, 10, 10, 5, 10 /),'LWdnSFCclr')
+  type(ctrl_out),save :: o_bils         = ctrl_out((/ 1, 2, 10, 5, 10, 10 /),'bils')
+  type(ctrl_out),save :: o_sens         = ctrl_out((/ 1, 1, 10, 10, 5, 10 /),'sens')
+  type(ctrl_out),save :: o_fder         = ctrl_out((/ 1, 2, 10, 10, 10, 10 /),'fder')
+  type(ctrl_out),save :: o_ffonte       = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'ffonte')
+  type(ctrl_out),save :: o_fqcalving    = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fqcalving')
+  type(ctrl_out),save :: o_fqfonte      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fqfonte')
+
+  type(ctrl_out),save :: o_taux         = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'taux')
+  type(ctrl_out),save :: o_tauy         = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'tauy')
+  type(ctrl_out),save,dimension(4) :: o_taux_srf     = (/ ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'taux_ter'), &
+                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'taux_lic'), &
+                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'taux_oce'), &
+                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'taux_sic') /)
+
+  type(ctrl_out),save,dimension(4) :: o_tauy_srf     = (/ ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tauy_ter'), &
+                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tauy_lic'), &
+                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tauy_oce'), &
+                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tauy_sic') /)
+
+
+  type(ctrl_out),save,dimension(4) :: o_pourc_srf    = (/ ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'pourc_ter'), &
+                                                 ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'pourc_lic'), &
+                                                 ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'pourc_oce'), &
+                                                 ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'pourc_sic') /)     
+
+  type(ctrl_out),save,dimension(4) :: o_fract_srf    = (/ ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'fract_ter'), &
+                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'fract_lic'), &
+                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'fract_oce'), &
+                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'fract_sic') /)
+
+  type(ctrl_out),save,dimension(4) :: o_tsol_srf     = (/ ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tsol_ter'), &
+                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tsol_lic'), &
+                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tsol_oce'), &
+                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tsol_sic') /)
+
+  type(ctrl_out),save,dimension(4) :: o_sens_srf     = (/ ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'sens_ter'), &
+                                                 ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'sens_lic'), &
+                                                 ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'sens_oce'), &
+                                                 ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'sens_sic') /)
+
+  type(ctrl_out),save,dimension(4) :: o_lat_srf      = (/ ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'lat_ter'), &
+                                                 ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'lat_lic'), &
+                                                 ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'lat_oce'), &
+                                                 ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'lat_sic') /)
+
+  type(ctrl_out),save,dimension(4) :: o_flw_srf      = (/ ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'flw_ter'), &
+                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'flw_lic'), &
+                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'flw_oce'), &
+                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'flw_sic') /)
                                                  
-  type(ctrl_out),save,dimension(4) :: o_fsw_srf      = (/ ctrl_out((/ 1, 10, 10, 10, 10 /),'fsw_ter'), &
-                                                  ctrl_out((/ 1, 10, 10, 10, 10 /),'fsw_lic'), &
-                                                  ctrl_out((/ 1, 10, 10, 10, 10 /),'fsw_oce'), &
-                                                  ctrl_out((/ 1, 10, 10, 10, 10 /),'fsw_sic') /)
-
-  type(ctrl_out),save,dimension(4) :: o_wbils_srf    = (/ ctrl_out((/ 1, 10, 10, 10, 10 /),'wbils_ter'), &
-                                                 ctrl_out((/ 1, 10, 10, 10, 10 /),'wbils_lic'), &
-                                                 ctrl_out((/ 1, 10, 10, 10, 10 /),'wbils_oce'), &
-                                                 ctrl_out((/ 1, 10, 10, 10, 10 /),'wbils_sic') /)
-
-  type(ctrl_out),save,dimension(4) :: o_wbilo_srf    = (/ ctrl_out((/ 1, 10, 10, 10, 10 /),'wbilo_ter'), &
-                                                     ctrl_out((/ 1, 10, 10, 10, 10 /),'wbilo_lic'), &
-                                                 ctrl_out((/ 1, 10, 10, 10, 10 /),'wbilo_oce'), &
-                                                 ctrl_out((/ 1, 10, 10, 10, 10 /),'wbilo_sic') /)
-
-
-  type(ctrl_out),save :: o_cdrm         = ctrl_out((/ 1, 10, 10, 10, 10 /),'cdrm')
-  type(ctrl_out),save :: o_cdrh         = ctrl_out((/ 1, 10, 10, 1, 10 /),'cdrh')
-  type(ctrl_out),save :: o_cldl         = ctrl_out((/ 1, 1, 10, 10, 10 /),'cldl')
-  type(ctrl_out),save :: o_cldm         = ctrl_out((/ 1, 1, 10, 10, 10 /),'cldm')
-  type(ctrl_out),save :: o_cldh         = ctrl_out((/ 1, 1, 10, 10, 10 /),'cldh')
-  type(ctrl_out),save :: o_cldt         = ctrl_out((/ 1, 1, 2, 5, 10 /),'cldt')
-  type(ctrl_out),save :: o_cldq         = ctrl_out((/ 1, 1, 10, 10, 10 /),'cldq')
-  type(ctrl_out),save :: o_lwp          = ctrl_out((/ 1, 5, 10, 10, 10 /),'lwp')
-  type(ctrl_out),save :: o_iwp          = ctrl_out((/ 1, 5, 10, 10, 10 /),'iwp')
-  type(ctrl_out),save :: o_ue           = ctrl_out((/ 1, 10, 10, 10, 10 /),'ue')
-  type(ctrl_out),save :: o_ve           = ctrl_out((/ 1, 10, 10, 10, 10 /),'ve')
-  type(ctrl_out),save :: o_uq           = ctrl_out((/ 1, 10, 10, 10, 10 /),'uq')
-  type(ctrl_out),save :: o_vq           = ctrl_out((/ 1, 10, 10, 10, 10 /),'vq')
+  type(ctrl_out),save,dimension(4) :: o_fsw_srf      = (/ ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsw_ter'), &
+                                                  ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsw_lic'), &
+                                                  ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsw_oce'), &
+                                                  ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsw_sic') /)
+
+  type(ctrl_out),save,dimension(4) :: o_wbils_srf    = (/ ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbils_ter'), &
+                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbils_lic'), &
+                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbils_oce'), &
+                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbils_sic') /)
+
+  type(ctrl_out),save,dimension(4) :: o_wbilo_srf    = (/ ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbilo_ter'), &
+                                                     ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbilo_lic'), &
+                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbilo_oce'), &
+                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbilo_sic') /)
+
+
+  type(ctrl_out),save :: o_cdrm         = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'cdrm')
+  type(ctrl_out),save :: o_cdrh         = ctrl_out((/ 1, 10, 10, 7, 10, 10 /),'cdrh')
+  type(ctrl_out),save :: o_cldl         = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'cldl')
+  type(ctrl_out),save :: o_cldm         = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'cldm')
+  type(ctrl_out),save :: o_cldh         = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'cldh')
+  type(ctrl_out),save :: o_cldt         = ctrl_out((/ 1, 1, 2, 10, 5, 10 /),'cldt')
+  type(ctrl_out),save :: o_cldq         = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'cldq')
+  type(ctrl_out),save :: o_lwp          = ctrl_out((/ 1, 5, 10, 10, 10, 10 /),'lwp')
+  type(ctrl_out),save :: o_iwp          = ctrl_out((/ 1, 5, 10, 10, 10, 10 /),'iwp')
+  type(ctrl_out),save :: o_ue           = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'ue')
+  type(ctrl_out),save :: o_ve           = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'ve')
+  type(ctrl_out),save :: o_uq           = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'uq')
+  type(ctrl_out),save :: o_vq           = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'vq')
  
-  type(ctrl_out),save :: o_cape         = ctrl_out((/ 1, 10, 10, 10, 10 /),'cape')
-  type(ctrl_out),save :: o_pbase        = ctrl_out((/ 1, 5, 10, 10, 10 /),'pbase')
-  type(ctrl_out),save :: o_ptop         = ctrl_out((/ 1, 5, 10, 10, 10 /),'ptop')
-  type(ctrl_out),save :: o_fbase        = ctrl_out((/ 1, 10, 10, 10, 10 /),'fbase')
-  type(ctrl_out),save :: o_plcl        = ctrl_out((/ 1, 10, 10, 10, 10 /),'plcl')
-  type(ctrl_out),save :: o_plfc        = ctrl_out((/ 1, 10, 10, 10, 10 /),'plfc')
-  type(ctrl_out),save :: o_wbeff        = ctrl_out((/ 1, 10, 10, 10, 10 /),'wbeff')
-  type(ctrl_out),save :: o_prw          = ctrl_out((/ 1, 1, 10, 10, 10 /),'prw')
-
-  type(ctrl_out),save :: o_s_pblh       = ctrl_out((/ 1, 10, 10, 10, 1 /),'s_pblh')
-  type(ctrl_out),save :: o_s_pblt       = ctrl_out((/ 1, 10, 10, 10, 1 /),'s_pblt')
-  type(ctrl_out),save :: o_s_lcl        = ctrl_out((/ 1, 10, 10, 10, 10 /),'s_lcl')
-  type(ctrl_out),save :: o_s_capCL      = ctrl_out((/ 1, 10, 10, 10, 10 /),'s_capCL')
-  type(ctrl_out),save :: o_s_oliqCL     = ctrl_out((/ 1, 10, 10, 10, 10 /),'s_oliqCL')
-  type(ctrl_out),save :: o_s_cteiCL     = ctrl_out((/ 1, 10, 10, 10, 1 /),'s_cteiCL')
-  type(ctrl_out),save :: o_s_therm      = ctrl_out((/ 1, 10, 10, 10, 1 /),'s_therm')
-  type(ctrl_out),save :: o_s_trmb1      = ctrl_out((/ 1, 10, 10, 10, 10 /),'s_trmb1')
-  type(ctrl_out),save :: o_s_trmb2      = ctrl_out((/ 1, 10, 10, 10, 10 /),'s_trmb2')
-  type(ctrl_out),save :: o_s_trmb3      = ctrl_out((/ 1, 10, 10, 10, 10 /),'s_trmb3')
-
-  type(ctrl_out),save :: o_slab_bils    = ctrl_out((/ 1, 1, 10, 10, 10 /),'slab_bils_oce')
-
-  type(ctrl_out),save :: o_ale_bl       = ctrl_out((/ 1, 1, 1, 10, 10 /),'ale_bl')
-  type(ctrl_out),save :: o_alp_bl       = ctrl_out((/ 1, 1, 1, 10, 10 /),'alp_bl')
-  type(ctrl_out),save :: o_ale_wk       = ctrl_out((/ 1, 1, 1, 10, 10 /),'ale_wk')
-  type(ctrl_out),save :: o_alp_wk       = ctrl_out((/ 1, 1, 1, 10, 10 /),'alp_wk')
-
-  type(ctrl_out),save :: o_ale          = ctrl_out((/ 1, 1, 1, 10, 10 /),'ale')
-  type(ctrl_out),save :: o_alp          = ctrl_out((/ 1, 1, 1, 10, 10 /),'alp')
-  type(ctrl_out),save :: o_cin          = ctrl_out((/ 1, 1, 1, 10, 10 /),'cin')
-  type(ctrl_out),save :: o_wape         = ctrl_out((/ 1, 1, 1, 10, 10 /),'wape')
+  type(ctrl_out),save :: o_cape         = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'cape')
+  type(ctrl_out),save :: o_pbase        = ctrl_out((/ 1, 5, 10, 10, 10, 10 /),'pbase')
+  type(ctrl_out),save :: o_ptop         = ctrl_out((/ 1, 5, 10, 10, 10, 10 /),'ptop')
+  type(ctrl_out),save :: o_fbase        = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fbase')
+  type(ctrl_out),save :: o_plcl        = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'plcl')
+  type(ctrl_out),save :: o_plfc        = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'plfc')
+  type(ctrl_out),save :: o_wbeff        = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbeff')
+  type(ctrl_out),save :: o_prw          = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'prw')
+
+  type(ctrl_out),save :: o_s_pblh       = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_pblh')
+  type(ctrl_out),save :: o_s_pblt       = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_pblt')
+  type(ctrl_out),save :: o_s_lcl        = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_lcl')
+  type(ctrl_out),save :: o_s_therm      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_therm')
+!IM : Les champs suivants (s_capCL, s_oliqCL, s_cteiCL, s_trmb1, s_trmb2, s_trmb3) ne sont pas definis dans HBTM.F
+! type(ctrl_out),save :: o_s_capCL      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_capCL')
+! type(ctrl_out),save :: o_s_oliqCL     = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_oliqCL')
+! type(ctrl_out),save :: o_s_cteiCL     = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_cteiCL')
+! type(ctrl_out),save :: o_s_trmb1      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_trmb1')
+! type(ctrl_out),save :: o_s_trmb2      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_trmb2')
+! type(ctrl_out),save :: o_s_trmb3      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_trmb3')
+
+  type(ctrl_out),save :: o_slab_bils    = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'slab_bils_oce')
+
+  type(ctrl_out),save :: o_ale_bl       = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'ale_bl')
+  type(ctrl_out),save :: o_alp_bl       = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'alp_bl')
+  type(ctrl_out),save :: o_ale_wk       = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'ale_wk')
+  type(ctrl_out),save :: o_alp_wk       = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'alp_wk')
+
+  type(ctrl_out),save :: o_ale          = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'ale')
+  type(ctrl_out),save :: o_alp          = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'alp')
+  type(ctrl_out),save :: o_cin          = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'cin')
+  type(ctrl_out),save :: o_wape         = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'wape')
 
 
 ! Champs interpolles sur des niveaux de pression ??? a faire correctement
                                               
-  type(ctrl_out),save,dimension(6) :: o_uSTDlevs     = (/ ctrl_out((/ 1, 1, 3, 10, 10 /),'u850'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'u700'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'u500'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'u200'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'u50'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'u10') /) 
+  type(ctrl_out),save,dimension(7) :: o_uSTDlevs     = (/ ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u850'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u700'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u500'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u200'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u100'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u50'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u10') /) 
                                                      
 
-  type(ctrl_out),save,dimension(6) :: o_vSTDlevs     = (/ ctrl_out((/ 1, 1, 3, 10, 10 /),'v850'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'v700'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'v500'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'v200'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'v50'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'v10') /)
-
-  type(ctrl_out),save,dimension(6) :: o_wSTDlevs     = (/ ctrl_out((/ 1, 1, 3, 10, 10 /),'w850'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'w700'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'w500'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'w200'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'w50'), & 
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'w10') /)
-
-  type(ctrl_out),save,dimension(6) :: o_tSTDlevs     = (/ ctrl_out((/ 1, 1, 3, 10, 10 /),'t850'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'t700'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'t500'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'t200'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'t50'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'t10') /)
-
-  type(ctrl_out),save,dimension(6) :: o_qSTDlevs     = (/ ctrl_out((/ 1, 1, 3, 10, 10 /),'q850'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'q700'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'q500'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'q200'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'q50'), & 
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'q10') /)
-
-  type(ctrl_out),save,dimension(6) :: o_zSTDlevs   = (/ ctrl_out((/ 1, 1, 3, 10, 10 /),'z850'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'z700'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'z500'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'z200'), &
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'z50'), & 
-                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'z10') /)
-
-
-  type(ctrl_out),save :: o_t_oce_sic    = ctrl_out((/ 1, 10, 10, 10, 10 /),'t_oce_sic')
-
-  type(ctrl_out),save :: o_weakinv      = ctrl_out((/ 10, 1, 10, 10, 10 /),'weakinv')
-  type(ctrl_out),save :: o_dthmin       = ctrl_out((/ 10, 1, 10, 10, 10 /),'dthmin')
-  type(ctrl_out),save,dimension(4) :: o_u10_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'u10_ter'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'u10_lic'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'u10_oce'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'u10_sic') /)
-
-  type(ctrl_out),save,dimension(4) :: o_v10_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'v10_ter'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'v10_lic'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'v10_oce'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'v10_sic') /)
-
-  type(ctrl_out),save :: o_cldtau       = ctrl_out((/ 10, 5, 10, 10, 10 /),'cldtau')                     
-  type(ctrl_out),save :: o_cldemi       = ctrl_out((/ 10, 5, 10, 10, 10 /),'cldemi')
-  type(ctrl_out),save :: o_rh2m         = ctrl_out((/ 5, 5, 10, 10, 10 /),'rh2m')
-  type(ctrl_out),save :: o_rh2m_min     = ctrl_out((/ 10, 5, 10, 10, 10 /),'rh2m_min')
-  type(ctrl_out),save :: o_rh2m_max     = ctrl_out((/ 10, 5, 10, 10, 10 /),'rh2m_max')
-  type(ctrl_out),save :: o_qsat2m       = ctrl_out((/ 10, 5, 10, 10, 10 /),'qsat2m')
-  type(ctrl_out),save :: o_tpot         = ctrl_out((/ 10, 5, 10, 10, 10 /),'tpot')
-  type(ctrl_out),save :: o_tpote        = ctrl_out((/ 10, 5, 10, 10, 10 /),'tpote')
-  type(ctrl_out),save :: o_tke          = ctrl_out((/ 4, 10, 10, 10, 10 /),'tke ')
-  type(ctrl_out),save :: o_tke_max      = ctrl_out((/ 4, 10, 10, 10, 10 /),'tke_max')
-
-  type(ctrl_out),save,dimension(4) :: o_tke_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_ter'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_lic'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_oce'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_sic') /)
-
-  type(ctrl_out),save,dimension(4) :: o_tke_max_srf  = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_max_ter'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_max_lic'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_max_oce'), &
-                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_max_sic') /)
-
-  type(ctrl_out),save :: o_kz           = ctrl_out((/ 4, 10, 10, 10, 10 /),'kz')
-  type(ctrl_out),save :: o_kz_max       = ctrl_out((/ 4, 10, 10, 10, 10 /),'kz_max')
-  type(ctrl_out),save :: o_SWnetOR      = ctrl_out((/ 10, 10, 2, 10, 10 /),'SWnetOR')
-  type(ctrl_out),save :: o_SWdownOR     = ctrl_out((/ 10, 10, 2, 10, 10 /),'SWdownOR')
-  type(ctrl_out),save :: o_LWdownOR     = ctrl_out((/ 10, 10, 2, 10, 10 /),'LWdownOR')
-
-  type(ctrl_out),save :: o_snowl        = ctrl_out((/ 10, 1, 10, 10, 10 /),'snowl')
-  type(ctrl_out),save :: o_cape_max     = ctrl_out((/ 10, 1, 10, 10, 10 /),'cape_max')
-  type(ctrl_out),save :: o_solldown     = ctrl_out((/ 10, 1, 10, 10, 10 /),'solldown')
-
-  type(ctrl_out),save :: o_dtsvdfo      = ctrl_out((/ 10, 10, 10, 10, 10 /),'dtsvdfo')
-  type(ctrl_out),save :: o_dtsvdft      = ctrl_out((/ 10, 10, 10, 10, 10 /),'dtsvdft')
-  type(ctrl_out),save :: o_dtsvdfg      = ctrl_out((/ 10, 10, 10, 10, 10 /),'dtsvdfg')
-  type(ctrl_out),save :: o_dtsvdfi      = ctrl_out((/ 10, 10, 10, 10, 10 /),'dtsvdfi')
-  type(ctrl_out),save :: o_rugs         = ctrl_out((/ 10, 10, 10, 10, 10 /),'rugs')
-
-  type(ctrl_out),save :: o_topswad      = ctrl_out((/ 2, 10, 10, 10, 10 /),'topswad')
-  type(ctrl_out),save :: o_topswai      = ctrl_out((/ 2, 10, 10, 10, 10 /),'topswai')
-  type(ctrl_out),save :: o_solswad      = ctrl_out((/ 2, 10, 10, 10, 10 /),'solswad')
-  type(ctrl_out),save :: o_solswai      = ctrl_out((/ 2, 10, 10, 10, 10 /),'solswai')
-
-  type(ctrl_out),save,dimension(10) :: o_tausumaero  = (/ ctrl_out((/ 4, 4, 10, 10, 10 /),'OD550_ASBCM'), &
-                                                     ctrl_out((/ 4, 4, 10, 10, 10 /),'OD550_ASPOMM'), &
-                                                     ctrl_out((/ 4, 4, 10, 10, 10 /),'OD550_ASSO4M'), &
-                                                     ctrl_out((/ 4, 4, 10, 10, 10 /),'OD550_CSSO4M'), &
-                                                     ctrl_out((/ 4, 4, 10, 10, 10 /),'OD550_SSSSM'), &
-                                                     ctrl_out((/ 4, 4, 10, 10, 10 /),'OD550_ASSSM'), &
-                                                     ctrl_out((/ 4, 4, 10, 10, 10 /),'OD550_CSSSM'), &
-                                                     ctrl_out((/ 4, 4, 10, 10, 10 /),'OD550_CIDUSTM'), &
-                                                     ctrl_out((/ 4, 4, 10, 10, 10 /),'OD550_AIBCM'), &
-                                                     ctrl_out((/ 4, 4, 10, 10, 10 /),'OD550_AIPOMM') /)
-
-  type(ctrl_out),save :: o_od550aer         = ctrl_out((/ 4, 4, 10, 10, 10 /),'od550aer')
-  type(ctrl_out),save :: o_od865aer         = ctrl_out((/ 4, 4, 10, 10, 10 /),'od865aer')
-  type(ctrl_out),save :: o_absvisaer        = ctrl_out((/ 4, 4, 10, 10, 10 /),'absvisaer')
-  type(ctrl_out),save :: o_od550lt1aer      = ctrl_out((/ 4, 4, 10, 10, 10 /),'od550lt1aer')
-
-  type(ctrl_out),save :: o_sconcso4         = ctrl_out((/ 4, 4, 10, 10, 10 /),'sconcso4')
-  type(ctrl_out),save :: o_sconcoa          = ctrl_out((/ 4, 4, 10, 10, 10 /),'sconcoa')
-  type(ctrl_out),save :: o_sconcbc          = ctrl_out((/ 4, 4, 10, 10, 10 /),'sconcbc')
-  type(ctrl_out),save :: o_sconcss          = ctrl_out((/ 4, 4, 10, 10, 10 /),'sconcss')
-  type(ctrl_out),save :: o_sconcdust        = ctrl_out((/ 4, 4, 10, 10, 10 /),'sconcdust')
-  type(ctrl_out),save :: o_concso4          = ctrl_out((/ 4, 4, 10, 10, 10 /),'concso4')
-  type(ctrl_out),save :: o_concoa           = ctrl_out((/ 4, 4, 10, 10, 10 /),'concoa')
-  type(ctrl_out),save :: o_concbc           = ctrl_out((/ 4, 4, 10, 10, 10 /),'concbc')
-  type(ctrl_out),save :: o_concss           = ctrl_out((/ 4, 4, 10, 10, 10 /),'concss')
-  type(ctrl_out),save :: o_concdust         = ctrl_out((/ 4, 4, 10, 10, 10 /),'concdust')
-  type(ctrl_out),save :: o_loadso4          = ctrl_out((/ 4, 4, 10, 10, 10 /),'loadso4')
-  type(ctrl_out),save :: o_loadoa           = ctrl_out((/ 4, 4, 10, 10, 10 /),'loadoa')
-  type(ctrl_out),save :: o_loadbc           = ctrl_out((/ 4, 4, 10, 10, 10 /),'loadbc')
-  type(ctrl_out),save :: o_loadss           = ctrl_out((/ 4, 4, 10, 10, 10 /),'loadss')
-  type(ctrl_out),save :: o_loaddust         = ctrl_out((/ 4, 4, 10, 10, 10 /),'loaddust')
-
-
-  type(ctrl_out),save :: o_swtoaas_nat      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swtoaas_nat')
-  type(ctrl_out),save :: o_swsrfas_nat      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swsrfas_nat')
-  type(ctrl_out),save :: o_swtoacs_nat      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swtoacs_nat')
-  type(ctrl_out),save :: o_swsrfcs_nat      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swsrfcs_nat')
-
-  type(ctrl_out),save :: o_swtoaas_ant      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swtoaas_ant')
-  type(ctrl_out),save :: o_swsrfas_ant      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swsrfas_ant')
-  type(ctrl_out),save :: o_swtoacs_ant      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swtoacs_ant')
-  type(ctrl_out),save :: o_swsrfcs_ant      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swsrfcs_ant')
-  type(ctrl_out),save :: o_swtoacf_nat      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swtoacf_nat')
-  type(ctrl_out),save :: o_swsrfcf_nat      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swsrfcf_nat')
-  type(ctrl_out),save :: o_swtoacf_ant      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swtoacf_ant')
-  type(ctrl_out),save :: o_swsrfcf_ant      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swsrfcf_ant')
-  type(ctrl_out),save :: o_swtoacf_zero     = ctrl_out((/ 4, 4, 10, 10, 10 /),'swtoacf_zero')
-  type(ctrl_out),save :: o_swsrfcf_zero     = ctrl_out((/ 4, 4, 10, 10, 10 /),'swsrfcf_zero')
-
-  type(ctrl_out),save :: o_cldncl          = ctrl_out((/ 4, 4, 10, 10, 10 /),'cldncl')
-  type(ctrl_out),save :: o_reffclwtop      = ctrl_out((/ 4, 4, 10, 10, 10 /),'reffclwtop')
-  type(ctrl_out),save :: o_cldnvi          = ctrl_out((/ 4, 4, 10, 10, 10 /),'cldnvi')
-  type(ctrl_out),save :: o_lcc             = ctrl_out((/ 4, 4, 10, 10, 10 /),'lcc')
+  type(ctrl_out),save,dimension(7) :: o_vSTDlevs     = (/ ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v850'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v700'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v500'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v200'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v100'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v50'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v10') /)
+
+  type(ctrl_out),save,dimension(7) :: o_wSTDlevs     = (/ ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w850'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w700'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w500'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w200'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w100'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w50'), & 
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w10') /)
+
+  type(ctrl_out),save,dimension(7) :: o_tSTDlevs     = (/ ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t850'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t700'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t500'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t200'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t100'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t50'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t10') /)
+
+  type(ctrl_out),save,dimension(7) :: o_qSTDlevs     = (/ ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q850'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q700'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q500'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q200'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q100'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q50'), & 
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q10') /)
+
+  type(ctrl_out),save,dimension(7) :: o_zSTDlevs   = (/ ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z850'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z700'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z500'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z200'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z100'), &
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z50'), & 
+                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z10') /)
+
+
+  type(ctrl_out),save :: o_t_oce_sic    = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'t_oce_sic')
+
+  type(ctrl_out),save :: o_weakinv      = ctrl_out((/ 10, 1, 10, 10, 10, 10 /),'weakinv')
+  type(ctrl_out),save :: o_dthmin       = ctrl_out((/ 10, 1, 10, 10, 10, 10 /),'dthmin')
+  type(ctrl_out),save,dimension(4) :: o_u10_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'u10_ter'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'u10_lic'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'u10_oce'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'u10_sic') /)
+
+  type(ctrl_out),save,dimension(4) :: o_v10_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'v10_ter'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'v10_lic'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'v10_oce'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'v10_sic') /)
+
+  type(ctrl_out),save :: o_cldtau       = ctrl_out((/ 10, 5, 10, 10, 10, 10 /),'cldtau')                     
+  type(ctrl_out),save :: o_cldemi       = ctrl_out((/ 10, 5, 10, 10, 10, 10 /),'cldemi')
+  type(ctrl_out),save :: o_rh2m         = ctrl_out((/ 5, 5, 10, 10, 10, 10 /),'rh2m')
+  type(ctrl_out),save :: o_rh2m_min     = ctrl_out((/ 10, 5, 10, 10, 10, 10 /),'rh2m_min')
+  type(ctrl_out),save :: o_rh2m_max     = ctrl_out((/ 10, 5, 10, 10, 10, 10 /),'rh2m_max')
+  type(ctrl_out),save :: o_qsat2m       = ctrl_out((/ 10, 5, 10, 10, 10, 10 /),'qsat2m')
+  type(ctrl_out),save :: o_tpot         = ctrl_out((/ 10, 5, 10, 10, 10, 10 /),'tpot')
+  type(ctrl_out),save :: o_tpote        = ctrl_out((/ 10, 5, 10, 10, 10, 10 /),'tpote')
+  type(ctrl_out),save :: o_tke          = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'tke ')
+  type(ctrl_out),save :: o_tke_max      = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'tke_max')
+
+  type(ctrl_out),save,dimension(4) :: o_tke_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_ter'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_lic'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_oce'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_sic') /)
+
+  type(ctrl_out),save,dimension(4) :: o_tke_max_srf  = (/ ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_max_ter'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_max_lic'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_max_oce'), &
+                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_max_sic') /)
+
+  type(ctrl_out),save :: o_kz           = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'kz')
+  type(ctrl_out),save :: o_kz_max       = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'kz_max')
+  type(ctrl_out),save :: o_SWnetOR      = ctrl_out((/ 10, 10, 2, 10, 10, 10 /),'SWnetOR')
+  type(ctrl_out),save :: o_SWdownOR     = ctrl_out((/ 10, 10, 2, 10, 10, 10 /),'SWdownOR')
+  type(ctrl_out),save :: o_LWdownOR     = ctrl_out((/ 10, 10, 2, 10, 10, 10 /),'LWdownOR')
+
+  type(ctrl_out),save :: o_snowl        = ctrl_out((/ 10, 1, 10, 10, 10, 10 /),'snowl')
+  type(ctrl_out),save :: o_cape_max     = ctrl_out((/ 10, 1, 10, 10, 10, 10 /),'cape_max')
+  type(ctrl_out),save :: o_solldown     = ctrl_out((/ 10, 1, 10, 10, 10, 10 /),'solldown')
+
+  type(ctrl_out),save :: o_dtsvdfo      = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'dtsvdfo')
+  type(ctrl_out),save :: o_dtsvdft      = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'dtsvdft')
+  type(ctrl_out),save :: o_dtsvdfg      = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'dtsvdfg')
+  type(ctrl_out),save :: o_dtsvdfi      = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'dtsvdfi')
+  type(ctrl_out),save :: o_rugs         = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'rugs')
+
+  type(ctrl_out),save :: o_topswad      = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'topswad')
+  type(ctrl_out),save :: o_topswai      = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'topswai')
+  type(ctrl_out),save :: o_solswad      = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'solswad')
+  type(ctrl_out),save :: o_solswai      = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'solswai')
+
+  type(ctrl_out),save,dimension(10) :: o_tausumaero  = (/ ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_ASBCM'), &
+                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_ASPOMM'), &
+                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_ASSO4M'), &
+                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_CSSO4M'), &
+                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_SSSSM'), &
+                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_ASSSM'), &
+                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_CSSSM'), &
+                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_CIDUSTM'), &
+                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_AIBCM'), &
+                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_AIPOMM') /)
+
+  type(ctrl_out),save :: o_od550aer     = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'od550aer')
+  type(ctrl_out),save :: o_od865aer     = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'od865aer')
+  type(ctrl_out),save :: o_absvisaer    = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'absvisaer')
+  type(ctrl_out),save :: o_od550lt1aer  = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'od550lt1aer')
+
+  type(ctrl_out),save :: o_sconcso4     = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'sconcso4')
+  type(ctrl_out),save :: o_sconcoa      = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'sconcoa')
+  type(ctrl_out),save :: o_sconcbc      = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'sconcbc')
+  type(ctrl_out),save :: o_sconcss      = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'sconcss')
+  type(ctrl_out),save :: o_sconcdust    = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'sconcdust')
+  type(ctrl_out),save :: o_concso4      = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'concso4')
+  type(ctrl_out),save :: o_concoa       = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'concoa')
+  type(ctrl_out),save :: o_concbc       = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'concbc')
+  type(ctrl_out),save :: o_concss       = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'concss')
+  type(ctrl_out),save :: o_concdust     = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'concdust')
+  type(ctrl_out),save :: o_loadso4      = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'loadso4')
+  type(ctrl_out),save :: o_loadoa       = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'loadoa')
+  type(ctrl_out),save :: o_loadbc       = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'loadbc')
+  type(ctrl_out),save :: o_loadss       = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'loadss')
+  type(ctrl_out),save :: o_loaddust     = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'loaddust')
+
+  type(ctrl_out),save :: o_swtoaas_nat  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swtoaas_nat')
+  type(ctrl_out),save :: o_swsrfas_nat  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swsrfas_nat')
+  type(ctrl_out),save :: o_swtoacs_nat  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swtoacs_nat')
+  type(ctrl_out),save :: o_swsrfcs_nat  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swsrfcs_nat')
+
+  type(ctrl_out),save :: o_swtoaas_ant  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swtoaas_ant')
+  type(ctrl_out),save :: o_swsrfas_ant  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swsrfas_ant')
+  type(ctrl_out),save :: o_swtoacs_ant  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swtoacs_ant')
+  type(ctrl_out),save :: o_swsrfcs_ant  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swsrfcs_ant')
+
+  type(ctrl_out),save :: o_swtoacf_nat  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swtoacf_nat')
+  type(ctrl_out),save :: o_swsrfcf_nat  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swsrfcf_nat')
+  type(ctrl_out),save :: o_swtoacf_ant  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swtoacf_ant')
+  type(ctrl_out),save :: o_swsrfcf_ant  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swsrfcf_ant')
+  type(ctrl_out),save :: o_swtoacf_zero = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swtoacf_zero')
+  type(ctrl_out),save :: o_swsrfcf_zero = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swsrfcf_zero')
+
+  type(ctrl_out),save :: o_cldncl       = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'cldncl')
+  type(ctrl_out),save :: o_reffclwtop   = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'reffclwtop')
+  type(ctrl_out),save :: o_cldnvi       = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'cldnvi')
+  type(ctrl_out),save :: o_lcc          = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'lcc')
 
 
 !!!!!!!!!!!!!!!!!!!!!! 3D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
-  type(ctrl_out),save :: o_ec550aer     = ctrl_out((/ 4,  4, 10, 10, 1 /),'ec550aer')
-  type(ctrl_out),save :: o_lwcon        = ctrl_out((/ 2, 5, 10, 10, 1 /),'lwcon')
-  type(ctrl_out),save :: o_iwcon        = ctrl_out((/ 2, 5, 10, 10, 10 /),'iwcon')
-  type(ctrl_out),save :: o_temp         = ctrl_out((/ 2, 3, 4, 10, 1 /),'temp')
-  type(ctrl_out),save :: o_theta        = ctrl_out((/ 2, 3, 4, 10, 1 /),'theta')
-  type(ctrl_out),save :: o_ovap         = ctrl_out((/ 2, 3, 4, 10, 1 /),'ovap')
-  type(ctrl_out),save :: o_ovapinit         = ctrl_out((/ 2, 3, 10, 10, 1 /),'ovapinit')
-  type(ctrl_out),save :: o_wvapp        = ctrl_out((/ 2, 10, 10, 10, 10 /),'wvapp')
-  type(ctrl_out),save :: o_geop         = ctrl_out((/ 2, 3, 10, 10, 1 /),'geop')
-  type(ctrl_out),save :: o_vitu         = ctrl_out((/ 2, 3, 4, 5, 1 /),'vitu')
-  type(ctrl_out),save :: o_vitv         = ctrl_out((/ 2, 3, 4, 5, 1 /),'vitv')
-  type(ctrl_out),save :: o_vitw         = ctrl_out((/ 2, 3, 10, 5, 1 /),'vitw')
-  type(ctrl_out),save :: o_pres         = ctrl_out((/ 2, 3, 10, 10, 1 /),'pres')
-  type(ctrl_out),save :: o_paprs        = ctrl_out((/ 2, 3, 10, 10, 1 /),'paprs')
-  type(ctrl_out),save :: o_mass        = ctrl_out((/ 2, 3, 10, 10, 1 /),'mass')
-
-  type(ctrl_out),save :: o_rneb         = ctrl_out((/ 2, 5, 10, 10, 1 /),'rneb')
-  type(ctrl_out),save :: o_rnebcon      = ctrl_out((/ 2, 5, 10, 10, 1 /),'rnebcon')
-  type(ctrl_out),save :: o_rhum         = ctrl_out((/ 2, 5, 10, 10, 10 /),'rhum')
-  type(ctrl_out),save :: o_ozone        = ctrl_out((/ 2, 10, 10, 10, 10 /),'ozone')
-  type(ctrl_out),save :: o_ozone_light  = ctrl_out((/ 2, 10, 10, 10, 10 /),'ozone_daylight')
-  type(ctrl_out),save :: o_upwd         = ctrl_out((/ 2, 10, 10, 10, 10 /),'upwd')
-  type(ctrl_out),save :: o_dtphy        = ctrl_out((/ 2, 10, 10, 10, 10 /),'dtphy')
-  type(ctrl_out),save :: o_dqphy        = ctrl_out((/ 2, 10, 10, 10, 10 /),'dqphy')
-  type(ctrl_out),save :: o_pr_con_l     = ctrl_out((/ 2, 10, 10, 10, 10 /),'pr_con_l')
-  type(ctrl_out),save :: o_pr_con_i     = ctrl_out((/ 2, 10, 10, 10, 10 /),'pr_con_i')
-  type(ctrl_out),save :: o_pr_lsc_l     = ctrl_out((/ 2, 10, 10, 10, 10 /),'pr_lsc_l')
-  type(ctrl_out),save :: o_pr_lsc_i     = ctrl_out((/ 2, 10, 10, 10, 10 /),'pr_lsc_i')
-  type(ctrl_out),save :: o_re           = ctrl_out((/ 5, 10, 10, 10, 10 /),'re')
-  type(ctrl_out),save :: o_fl           = ctrl_out((/ 5, 10, 10, 10, 10 /),'fl')
-  type(ctrl_out),save :: o_scdnc        =ctrl_out((/ 4,  4, 10, 10, 1 /),'scdnc')
-  type(ctrl_out),save :: o_reffclws     =ctrl_out((/ 4,  4, 10, 10, 1 /),'reffclws')
-  type(ctrl_out),save :: o_reffclwc     =ctrl_out((/ 4,  4, 10, 10, 1 /),'reffclwc')
-  type(ctrl_out),save :: o_lcc3d        =ctrl_out((/ 4,  4, 10, 10, 1 /),'lcc3d')
-  type(ctrl_out),save :: o_lcc3dcon     =ctrl_out((/ 4,  4, 10, 10, 1 /),'lcc3dcon')
-  type(ctrl_out),save :: o_lcc3dstra    =ctrl_out((/ 4,  4, 10, 10, 1 /),'lcc3dstra')
+  type(ctrl_out),save :: o_ec550aer     = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'ec550aer')
+  type(ctrl_out),save :: o_lwcon        = ctrl_out((/ 2, 5, 10, 10, 10, 10 /),'lwcon')
+  type(ctrl_out),save :: o_iwcon        = ctrl_out((/ 2, 5, 10, 10, 10, 10 /),'iwcon')
+  type(ctrl_out),save :: o_temp         = ctrl_out((/ 2, 3, 4, 10, 10, 10 /),'temp')
+  type(ctrl_out),save :: o_theta        = ctrl_out((/ 2, 3, 4, 10, 10, 10 /),'theta')
+  type(ctrl_out),save :: o_ovap         = ctrl_out((/ 2, 3, 4, 10, 10, 10 /),'ovap')
+  type(ctrl_out),save :: o_ovapinit     = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'ovapinit')
+  type(ctrl_out),save :: o_wvapp        = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'wvapp')
+  type(ctrl_out),save :: o_geop         = ctrl_out((/ 2, 3, 10, 10, 10, 10 /),'geop')
+  type(ctrl_out),save :: o_vitu         = ctrl_out((/ 2, 3, 4, 6, 10, 10 /),'vitu')
+  type(ctrl_out),save :: o_vitv         = ctrl_out((/ 2, 3, 4, 6, 10, 10 /),'vitv')
+  type(ctrl_out),save :: o_vitw         = ctrl_out((/ 2, 3, 10, 6, 10, 10 /),'vitw')
+  type(ctrl_out),save :: o_pres         = ctrl_out((/ 2, 3, 10, 10, 10, 10 /),'pres')
+  type(ctrl_out),save :: o_paprs        = ctrl_out((/ 2, 3, 10, 10, 10, 10 /),'paprs')
+  type(ctrl_out),save :: o_mass        = ctrl_out((/ 2, 3, 10, 10, 10, 10 /),'mass')
+  type(ctrl_out),save :: o_zfull       = ctrl_out((/ 2, 3, 10, 10, 10, 10 /),'zfull')
+  type(ctrl_out),save :: o_zhalf       = ctrl_out((/ 2, 3, 10, 10, 10, 10 /),'zhalf')
+  type(ctrl_out),save :: o_rneb         = ctrl_out((/ 2, 5, 10, 10, 10, 10 /),'rneb')
+  type(ctrl_out),save :: o_rnebcon      = ctrl_out((/ 2, 5, 10, 10, 10, 10 /),'rnebcon')
+  type(ctrl_out),save :: o_rhum         = ctrl_out((/ 2, 5, 10, 10, 10, 10 /),'rhum')
+  type(ctrl_out),save :: o_ozone        = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'ozone')
+  type(ctrl_out),save :: o_ozone_light  = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'ozone_daylight')
+  type(ctrl_out),save :: o_upwd         = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'upwd')
+  type(ctrl_out),save :: o_dtphy        = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'dtphy')
+  type(ctrl_out),save :: o_dqphy        = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'dqphy')
+  type(ctrl_out),save :: o_pr_con_l     = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'pr_con_l')
+  type(ctrl_out),save :: o_pr_con_i     = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'pr_con_i')
+  type(ctrl_out),save :: o_pr_lsc_l     = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'pr_lsc_l')
+  type(ctrl_out),save :: o_pr_lsc_i     = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'pr_lsc_i')
+  type(ctrl_out),save :: o_re           = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'re')
+  type(ctrl_out),save :: o_fl           = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'fl')
+  type(ctrl_out),save :: o_scdnc        = ctrl_out((/ 2,  6, 10, 10, 10, 10 /),'scdnc')
+  type(ctrl_out),save :: o_reffclws     = ctrl_out((/ 2,  6, 10, 10, 10, 10 /),'reffclws')
+  type(ctrl_out),save :: o_reffclwc     = ctrl_out((/ 2,  6, 10, 10, 10, 10 /),'reffclwc')
+  type(ctrl_out),save :: o_lcc3d        = ctrl_out((/ 2,  6, 10, 10, 10, 10 /),'lcc3d')
+  type(ctrl_out),save :: o_lcc3dcon     = ctrl_out((/ 2,  6, 10, 10, 10, 10 /),'lcc3dcon')
+  type(ctrl_out),save :: o_lcc3dstra    = ctrl_out((/ 2,  6, 10, 10, 10, 10 /),'lcc3dstra')
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-  type(ctrl_out),save,dimension(4) :: o_albe_srf     = (/ ctrl_out((/ 3, 4, 10, 1, 10 /),'albe_ter'), &
-                                                     ctrl_out((/ 3, 4, 10, 1, 10 /),'albe_lic'), &
-                                                     ctrl_out((/ 3, 4, 10, 1, 10 /),'albe_oce'), &
-                                                     ctrl_out((/ 3, 4, 10, 1, 10 /),'albe_sic') /) 
-
-  type(ctrl_out),save,dimension(4) :: o_ages_srf     = (/ ctrl_out((/ 10, 10, 10, 10, 10 /),'ages_ter'), &
-                                                     ctrl_out((/ 3, 10, 10, 10, 10 /),'ages_lic'), &
-                                                     ctrl_out((/ 10, 10, 10, 10, 10 /),'ages_oce'), &
-                                                     ctrl_out((/ 3, 10, 10, 10, 10 /),'ages_sic') /)
-
-  type(ctrl_out),save,dimension(4) :: o_rugs_srf     = (/ ctrl_out((/ 3, 4, 10, 10, 10 /),'rugs_ter'), &
-                                                     ctrl_out((/ 3, 4, 10, 10, 10 /),'rugs_lic'), &
-                                                     ctrl_out((/ 3, 4, 10, 10, 10 /),'rugs_oce'), &
-                                                     ctrl_out((/ 3, 4, 10, 10, 10 /),'rugs_sic') /)
-
-  type(ctrl_out),save :: o_alb1         = ctrl_out((/ 3, 10, 10, 10, 10 /),'albs')
-  type(ctrl_out),save :: o_alb2       = ctrl_out((/ 3, 10, 10, 10, 10 /),'albslw')
-
-  type(ctrl_out),save :: o_clwcon       = ctrl_out((/ 4, 10, 10, 10, 10 /),'clwcon')
-  type(ctrl_out),save :: o_Ma           = ctrl_out((/ 4, 10, 10, 10, 10 /),'Ma')
-  type(ctrl_out),save :: o_dnwd         = ctrl_out((/ 4, 10, 10, 10, 10 /),'dnwd')
-  type(ctrl_out),save :: o_dnwd0        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dnwd0')
-  type(ctrl_out),save :: o_mc           = ctrl_out((/ 4, 10, 10, 10, 10 /),'mc')
-  type(ctrl_out),save :: o_ftime_con    = ctrl_out((/ 4, 10, 10, 10, 10 /),'ftime_con')
-  type(ctrl_out),save :: o_dtdyn        = ctrl_out((/ 4, 10, 10, 10, 1 /),'dtdyn')
-  type(ctrl_out),save :: o_dqdyn        = ctrl_out((/ 4, 10, 10, 10, 1 /),'dqdyn')
-  type(ctrl_out),save :: o_dudyn        = ctrl_out((/ 4, 10, 10, 10, 1 /),'dudyn')  !AXC
-  type(ctrl_out),save :: o_dvdyn        = ctrl_out((/ 4, 10, 10, 10, 1 /),'dvdyn')  !AXC
-  type(ctrl_out),save :: o_dtcon        = ctrl_out((/ 4, 5, 10, 10, 10 /),'dtcon')
-  type(ctrl_out),save :: o_ducon        = ctrl_out((/ 4, 10, 10, 10, 10 /),'ducon')
-  type(ctrl_out),save :: o_dqcon        = ctrl_out((/ 4, 5, 10, 10, 10 /),'dqcon')
-  type(ctrl_out),save :: o_dtwak        = ctrl_out((/ 4, 5, 10, 10, 10 /),'dtwak')
-  type(ctrl_out),save :: o_dqwak        = ctrl_out((/ 4, 5, 10, 10, 10 /),'dqwak')
-  type(ctrl_out),save :: o_wake_h       = ctrl_out((/ 4, 5, 10, 10, 10 /),'wake_h')
-  type(ctrl_out),save :: o_wake_s       = ctrl_out((/ 4, 5, 10, 10, 10 /),'wake_s')
-  type(ctrl_out),save :: o_wake_deltat  = ctrl_out((/ 4, 5, 10, 10, 10 /),'wake_deltat')
-  type(ctrl_out),save :: o_wake_deltaq  = ctrl_out((/ 4, 5, 10, 10, 10 /),'wake_deltaq')
-  type(ctrl_out),save :: o_wake_omg     = ctrl_out((/ 4, 5, 10, 10, 10 /),'wake_omg')
-  type(ctrl_out),save :: o_Vprecip      = ctrl_out((/ 10, 10, 10, 10, 10 /),'Vprecip')
-  type(ctrl_out),save :: o_ftd          = ctrl_out((/ 4, 5, 10, 10, 10 /),'ftd')
-  type(ctrl_out),save :: o_fqd          = ctrl_out((/ 4, 5, 10, 10, 10 /),'fqd')
-  type(ctrl_out),save :: o_dtlsc        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtlsc')
-  type(ctrl_out),save :: o_dtlschr      = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtlschr')
-  type(ctrl_out),save :: o_dqlsc        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dqlsc')
-  type(ctrl_out),save :: o_dtvdf        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtvdf')
-  type(ctrl_out),save :: o_dqvdf        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dqvdf')
-  type(ctrl_out),save :: o_dteva        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dteva')
-  type(ctrl_out),save :: o_dqeva        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dqeva')
+  type(ctrl_out),save,dimension(4) :: o_albe_srf     = (/ ctrl_out((/ 3, 7, 10, 7, 10, 10 /),'albe_ter'), &
+                                                     ctrl_out((/ 3, 7, 10, 7, 10, 10 /),'albe_lic'), &
+                                                     ctrl_out((/ 3, 7, 10, 7, 10, 10 /),'albe_oce'), &
+                                                     ctrl_out((/ 3, 7, 10, 7, 10, 10 /),'albe_sic') /) 
+
+  type(ctrl_out),save,dimension(4) :: o_ages_srf     = (/ ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'ages_ter'), &
+                                                     ctrl_out((/ 3, 10, 10, 10, 10, 10 /),'ages_lic'), &
+                                                     ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'ages_oce'), &
+                                                     ctrl_out((/ 3, 10, 10, 10, 10, 10 /),'ages_sic') /)
+
+  type(ctrl_out),save,dimension(4) :: o_rugs_srf     = (/ ctrl_out((/ 3, 6, 10, 10, 10, 10 /),'rugs_ter'), &
+                                                     ctrl_out((/ 3, 6, 10, 10, 10, 10 /),'rugs_lic'), &
+                                                     ctrl_out((/ 3, 6, 10, 10, 10, 10 /),'rugs_oce'), &
+                                                     ctrl_out((/ 3, 6, 10, 10, 10, 10 /),'rugs_sic') /)
+
+  type(ctrl_out),save :: o_alb1         = ctrl_out((/ 3, 10, 10, 10, 10, 10 /),'alb1')
+  type(ctrl_out),save :: o_alb2       = ctrl_out((/ 3, 10, 10, 10, 10, 10 /),'alb2')
+
+  type(ctrl_out),save :: o_clwcon       = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'clwcon')
+  type(ctrl_out),save :: o_Ma           = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'Ma')
+  type(ctrl_out),save :: o_dnwd         = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dnwd')
+  type(ctrl_out),save :: o_dnwd0        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dnwd0')
+  type(ctrl_out),save :: o_mc           = ctrl_out((/ 4, 5, 10, 10, 10, 10 /),'mc')
+  type(ctrl_out),save :: o_ftime_con    = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'ftime_con')
+  type(ctrl_out),save :: o_dtdyn        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtdyn')
+  type(ctrl_out),save :: o_dqdyn        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dqdyn')
+  type(ctrl_out),save :: o_dudyn        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dudyn')  !AXC
+  type(ctrl_out),save :: o_dvdyn        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dvdyn')  !AXC
+  type(ctrl_out),save :: o_dtcon        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtcon')
+  type(ctrl_out),save :: o_ducon        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'ducon')
+  type(ctrl_out),save :: o_dqcon        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dqcon')
+  type(ctrl_out),save :: o_dtwak        = ctrl_out((/ 4, 5, 10, 10, 10, 10 /),'dtwak')
+  type(ctrl_out),save :: o_dqwak        = ctrl_out((/ 4, 5, 10, 10, 10, 10 /),'dqwak')
+  type(ctrl_out),save :: o_wake_h       = ctrl_out((/ 4, 5, 10, 10, 10, 10 /),'wake_h')
+  type(ctrl_out),save :: o_wake_s       = ctrl_out((/ 4, 5, 10, 10, 10, 10 /),'wake_s')
+  type(ctrl_out),save :: o_wake_deltat  = ctrl_out((/ 4, 5, 10, 10, 10, 10 /),'wake_deltat')
+  type(ctrl_out),save :: o_wake_deltaq  = ctrl_out((/ 4, 5, 10, 10, 10, 10 /),'wake_deltaq')
+  type(ctrl_out),save :: o_wake_omg     = ctrl_out((/ 4, 5, 10, 10, 10, 10 /),'wake_omg')
+  type(ctrl_out),save :: o_Vprecip      = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'Vprecip')
+  type(ctrl_out),save :: o_ftd          = ctrl_out((/ 4, 5, 10, 10, 10, 10 /),'ftd')
+  type(ctrl_out),save :: o_fqd          = ctrl_out((/ 4, 5, 10, 10, 10, 10 /),'fqd')
+  type(ctrl_out),save :: o_dtlsc        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtlsc')
+  type(ctrl_out),save :: o_dtlschr      = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtlschr')
+  type(ctrl_out),save :: o_dqlsc        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dqlsc')
+  type(ctrl_out),save :: o_dtvdf        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtvdf')
+  type(ctrl_out),save :: o_dqvdf        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dqvdf')
+  type(ctrl_out),save :: o_dteva        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dteva')
+  type(ctrl_out),save :: o_dqeva        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dqeva')
 
 !!!!!!!!!!!!!!!! Specifique thermiques
-  type(ctrl_out),save :: o_dqlscth        = ctrl_out((/ 10, 10, 10, 10, 10 /),'dqlscth')
-  type(ctrl_out),save :: o_dqlscst        = ctrl_out((/ 10, 10, 10, 10, 10 /),'dqlscst')
-  type(ctrl_out),save :: o_dtlscth        = ctrl_out((/ 10, 10, 10, 10, 10 /),'dtlscth')
-  type(ctrl_out),save :: o_dtlscst        = ctrl_out((/ 10, 10, 10, 10, 10 /),'dtlscst')
-  type(ctrl_out),save :: o_plulth        = ctrl_out((/ 10, 10, 10, 10, 10 /),'plulth')
-  type(ctrl_out),save :: o_plulst        = ctrl_out((/ 10, 10, 10, 10, 10 /),'plulst')
-  type(ctrl_out),save :: o_lmaxth        = ctrl_out((/ 10, 10, 10, 10, 10 /),'lmaxth')
-  type(ctrl_out),save :: o_ptconvth        = ctrl_out((/ 10, 10, 10, 10, 10 /),'ptconvth')
+  type(ctrl_out),save :: o_dqlscth        = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'dqlscth')
+  type(ctrl_out),save :: o_dqlscst        = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'dqlscst')
+  type(ctrl_out),save :: o_dtlscth        = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'dtlscth')
+  type(ctrl_out),save :: o_dtlscst        = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'dtlscst')
+  type(ctrl_out),save :: o_plulth        = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'plulth')
+  type(ctrl_out),save :: o_plulst        = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'plulst')
+  type(ctrl_out),save :: o_lmaxth        = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'lmaxth')
+  type(ctrl_out),save :: o_ptconvth        = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'ptconvth')
 !!!!!!!!!!!!!!!!!!!!!!!!
 
 
-  type(ctrl_out),save :: o_ptconv       = ctrl_out((/ 4, 10, 10, 10, 10 /),'ptconv')
-  type(ctrl_out),save :: o_ratqs        = ctrl_out((/ 4, 10, 10, 10, 10 /),'ratqs')
-  type(ctrl_out),save :: o_dtthe        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtthe')
-  type(ctrl_out),save :: o_f_th         = ctrl_out((/ 4, 10, 10, 10, 10 /),'f_th')
-  type(ctrl_out),save :: o_e_th         = ctrl_out((/ 4, 10, 10, 10, 10 /),'e_th')
-  type(ctrl_out),save :: o_w_th         = ctrl_out((/ 4, 10, 10, 10, 10 /),'w_th')
-  type(ctrl_out),save :: o_lambda_th    = ctrl_out((/ 10, 10, 10, 10, 10 /),'lambda_th')
-  type(ctrl_out),save :: o_ftime_th     = ctrl_out((/ 10, 10, 10, 10, 10 /),'ftime_th')
-  type(ctrl_out),save :: o_q_th         = ctrl_out((/ 4, 10, 10, 10, 10 /),'q_th')
-  type(ctrl_out),save :: o_a_th         = ctrl_out((/ 4, 10, 10, 10, 10 /),'a_th')
-  type(ctrl_out),save :: o_d_th         = ctrl_out((/ 4, 10, 10, 10, 10 /),'d_th')
-  type(ctrl_out),save :: o_f0_th        = ctrl_out((/ 4, 10, 10, 10, 10 /),'f0_th')
-  type(ctrl_out),save :: o_zmax_th      = ctrl_out((/ 4, 10, 10, 10, 10 /),'zmax_th')
-  type(ctrl_out),save :: o_dqthe        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dqthe')
-  type(ctrl_out),save :: o_dtajs        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtajs')
-  type(ctrl_out),save :: o_dqajs        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dqajs')
-  type(ctrl_out),save :: o_dtswr        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtswr')
-  type(ctrl_out),save :: o_dtsw0        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtsw0')
-  type(ctrl_out),save :: o_dtlwr        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtlwr')
-  type(ctrl_out),save :: o_dtlw0        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtlw0')
-  type(ctrl_out),save :: o_dtec         = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtec')
-  type(ctrl_out),save :: o_duvdf        = ctrl_out((/ 4, 10, 10, 10, 10 /),'duvdf')
-  type(ctrl_out),save :: o_dvvdf        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dvvdf')
-  type(ctrl_out),save :: o_duoro        = ctrl_out((/ 4, 10, 10, 10, 10 /),'duoro')
-  type(ctrl_out),save :: o_dvoro        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dvoro')
-  type(ctrl_out),save :: o_dulif        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dulif')
-  type(ctrl_out),save :: o_dvlif        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dvlif')
+  type(ctrl_out),save :: o_ptconv       = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'ptconv')
+  type(ctrl_out),save :: o_ratqs        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'ratqs')
+  type(ctrl_out),save :: o_dtthe        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtthe')
+  type(ctrl_out),save :: o_f_th         = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'f_th')
+  type(ctrl_out),save :: o_e_th         = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'e_th')
+  type(ctrl_out),save :: o_w_th         = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'w_th')
+  type(ctrl_out),save :: o_lambda_th    = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'lambda_th')
+  type(ctrl_out),save :: o_ftime_th     = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'ftime_th')
+  type(ctrl_out),save :: o_q_th         = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'q_th')
+  type(ctrl_out),save :: o_a_th         = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'a_th')
+  type(ctrl_out),save :: o_d_th         = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'d_th')
+  type(ctrl_out),save :: o_f0_th        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'f0_th')
+  type(ctrl_out),save :: o_zmax_th      = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'zmax_th')
+  type(ctrl_out),save :: o_dqthe        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dqthe')
+  type(ctrl_out),save :: o_dtajs        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtajs')
+  type(ctrl_out),save :: o_dqajs        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dqajs')
+  type(ctrl_out),save :: o_dtswr        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtswr')
+  type(ctrl_out),save :: o_dtsw0        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtsw0')
+  type(ctrl_out),save :: o_dtlwr        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtlwr')
+  type(ctrl_out),save :: o_dtlw0        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtlw0')
+  type(ctrl_out),save :: o_dtec         = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtec')
+  type(ctrl_out),save :: o_duvdf        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'duvdf')
+  type(ctrl_out),save :: o_dvvdf        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dvvdf')
+  type(ctrl_out),save :: o_duoro        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'duoro')
+  type(ctrl_out),save :: o_dvoro        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dvoro')
+  type(ctrl_out),save :: o_dulif        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dulif')
+  type(ctrl_out),save :: o_dvlif        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dvlif')
+  type(ctrl_out),save :: o_duhin        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'duhin')
+  type(ctrl_out),save :: o_dvhin        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dvhin')
+  type(ctrl_out),save :: o_dtoro        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtoro')
+  type(ctrl_out),save :: o_dtlif        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtlif')
+  type(ctrl_out),save :: o_dthin        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dthin')
+
   type(ctrl_out),save,allocatable :: o_trac(:)
+
+  type(ctrl_out),save :: o_rsu        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'rsu')
+  type(ctrl_out),save :: o_rsd        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'rsd')
+  type(ctrl_out),save :: o_rlu        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'rlu')
+  type(ctrl_out),save :: o_rld        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'rld')
+  type(ctrl_out),save :: o_rsucs      = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'rsucs')
+  type(ctrl_out),save :: o_rsdcs      = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'rsdcs')
+  type(ctrl_out),save :: o_rlucs      = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'rlucs')
+  type(ctrl_out),save :: o_rldcs      = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'rldcs')
+
+  type(ctrl_out),save :: o_tnt          = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'tnt')
+  type(ctrl_out),save :: o_tntc         = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'tntc')
+  type(ctrl_out),save :: o_tntr        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'tntr')
+  type(ctrl_out),save :: o_tntscpbl          = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'tntscpbl')
+
+  type(ctrl_out),save :: o_tnhus          = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'tnhus')
+  type(ctrl_out),save :: o_tnhusc         = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'tnhusc')
+  type(ctrl_out),save :: o_tnhusscpbl     = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'tnhusscpbl')
+
+  type(ctrl_out),save :: o_evu          = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'evu')
+
+  type(ctrl_out),save :: o_h2o          = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'h2o')
+
+  type(ctrl_out),save :: o_mcd          = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'mcd')
+  type(ctrl_out),save :: o_dmc          = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dmc')
+  type(ctrl_out),save :: o_ref_liq      = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'ref_liq')
+  type(ctrl_out),save :: o_ref_ice      = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'ref_ice')
+
+  type(ctrl_out),save :: o_rsut4co2     = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rsut4co2')
+  type(ctrl_out),save :: o_rlut4co2     = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rlut4co2')
+  type(ctrl_out),save :: o_rsutcs4co2   = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rsutcs4co2')
+  type(ctrl_out),save :: o_rlutcs4co2   = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rlutcs4co2')
+
+  type(ctrl_out),save :: o_rsu4co2     = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rsu4co2')
+  type(ctrl_out),save :: o_rlu4co2     = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rlu4co2')
+  type(ctrl_out),save :: o_rsucs4co2   = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rsucs4co2')
+  type(ctrl_out),save :: o_rlucs4co2   = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rlucs4co2')
+  type(ctrl_out),save :: o_rsd4co2     = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rsd4co2')
+  type(ctrl_out),save :: o_rld4co2     = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rld4co2')
+  type(ctrl_out),save :: o_rsdcs4co2   = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rsdcs4co2')
+  type(ctrl_out),save :: o_rldcs4co2   = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rldcs4co2')
+
+
     CONTAINS
 
@@ -550,10 +609,11 @@
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
   
-  SUBROUTINE phys_output_open(jjmp1,nlevSTD,clevSTD,nbteta, &
-       ctetaSTD,dtime, ok_veget, &
+  SUBROUTINE phys_output_open(rlon,rlat,pim,tabij,ipt,jpt,plon,plat, &
+       jjmp1,nlevSTD,clevSTD,nbteta, &
+       ctetaSTD, dtime, ok_veget, &
        type_ocean, iflag_pbl,ok_mensuel,ok_journe, &
        ok_hf,ok_instan,ok_LES,ok_ade,ok_aie, read_climoz, &
+       phys_out_filestations, &
        new_aod, aerosol_couple)   
-
 
   USE iophy 
@@ -571,4 +631,12 @@
   include "thermcell.h"
   include "comvert.h"
+
+    real,dimension(klon),intent(in) :: rlon
+    real,dimension(klon),intent(in) :: rlat
+    integer, intent(in)             :: pim
+    INTEGER, DIMENSION(pim)            :: tabij
+    INTEGER,dimension(pim), intent(in) :: ipt, jpt
+    REAL,dimension(pim), intent(in) :: plat, plon
+    REAL,dimension(pim,2) :: plat_bounds, plon_bounds
 
   integer                               :: jjmp1
@@ -606,19 +674,16 @@
   integer, dimension(nfiles)            :: phys_out_filelevels
   CHARACTER(len=20), dimension(nfiles)  :: type_ecri_files, phys_out_filetypes
-  character(len=20), dimension(nfiles)  :: chtimestep   = (/ 'DefFreq', 'DefFreq','DefFreq', 'DefFreq', 'DefFreq' /)
+  character(len=20), dimension(nfiles)  :: chtimestep   = (/ 'DefFreq', 'DefFreq','DefFreq', 'DefFreq', 'DefFreq', 'DefFreq' /)
   logical, dimension(nfiles)            :: phys_out_filekeys
+  logical, dimension(nfiles)            :: phys_out_filestations
 
 !!!!!!!!!! stockage dans une region limitee pour chaque fichier !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !                 entre [phys_out_lonmin,phys_out_lonmax] et [phys_out_latmin,phys_out_latmax]
 
-  logical, dimension(nfiles), save  :: phys_out_regfkey       = (/ .false., .false., .false., .false., .false. /)
-  real, dimension(nfiles), save     :: phys_out_lonmin        = (/ -180., -180., -180., -180., -180. /)
-  real, dimension(nfiles), save     :: phys_out_lonmax        = (/ 180., 180., 180., 180., 180. /)
-  real, dimension(nfiles), save     :: phys_out_latmin        = (/ -90., -90., -90., -90., -90. /)
-  real, dimension(nfiles), save     :: phys_out_latmax        = (/ 90., 90., 90., 90., 90. /)
-
-!IM definition dynamique flag o_trac pour sortie traceurs
-  INTEGER :: nq
-  CHARACTER(len=8) :: solsym(nqtot)
+  logical, dimension(nfiles), save  :: phys_out_regfkey       = (/ .false., .false., .false., .false., .false., .false. /)
+  real, dimension(nfiles), save     :: phys_out_lonmin        = (/ -180., -180., -180., -180., -180., -180. /)
+  real, dimension(nfiles), save     :: phys_out_lonmax        = (/ 180., 180., 180., 180., 180., 180. /)
+  real, dimension(nfiles), save     :: phys_out_latmin        = (/ -90., -90., -90., -90., -90., -90. /)
+  real, dimension(nfiles), save     :: phys_out_latmax        = (/ 90., 90., 90., 90., 90., 90. /)
 
    print*,'Debut phys_output_mod.F90'
@@ -627,5 +692,5 @@
    if (.not. allocated(o_trac)) ALLOCATE(o_trac(nqtot))
 
-   levmax = (/ klev, klev, klev, klev, klev /)
+   levmax = (/ klev, klev, klev, klev, klev, klev /)
 
    phys_out_filenames(1) = 'histmth'
@@ -634,4 +699,5 @@
    phys_out_filenames(4) = 'histins'
    phys_out_filenames(5) = 'histLES'
+   phys_out_filenames(6) = 'histstn'
 
    type_ecri(1) = 'ave(X)'
@@ -640,4 +706,5 @@
    type_ecri(4) = 'inst(X)'
    type_ecri(5) = 'ave(X)'
+   type_ecri(6) = 'inst(X)'
 
    clef_files(1) = ok_mensuel
@@ -646,4 +713,13 @@
    clef_files(4) = ok_instan
    clef_files(5) = ok_LES
+   clef_files(6) = ok_instan
+
+!sortir des fichiers "stations" si clef_stations(:)=.TRUE.
+   clef_stations(1) = .FALSE.
+   clef_stations(2) = .FALSE.
+   clef_stations(3) = .FALSE.
+   clef_stations(4) = .FALSE.
+   clef_stations(5) = .FALSE.
+   clef_stations(6) = .FALSE.
 
    lev_files(1) = lev_histmth
@@ -652,5 +728,5 @@
    lev_files(4) = lev_histins
    lev_files(5) = lev_histLES
-
+   lev_files(6) = lev_histins
 
    ecrit_files(1) = ecrit_mth
@@ -659,4 +735,5 @@
    ecrit_files(4) = ecrit_ins
    ecrit_files(5) = ecrit_LES
+   ecrit_files(6) = ecrit_ins
  
 !! Lectures des parametres de sorties dans physiq.def
@@ -674,4 +751,6 @@
      phys_out_filekeys(:)=clef_files(:)
    call getin('phys_out_filekeys',clef_files)
+     phys_out_filestations(:)=clef_stations(:)
+   call getin('phys_out_filestations',clef_stations)
      phys_out_filelevels(:)=lev_files(:)
    call getin('phys_out_filelevels',lev_files)
@@ -689,4 +768,5 @@
    print*,'phys_out_filetypes=',type_ecri
    print*,'phys_out_filekeys=',clef_files
+   print*,'phys_out_filestations=',clef_stations
    print*,'phys_out_filelevels=',lev_files
 
@@ -760,4 +840,12 @@
               itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!IM fichiers stations
+     else if (clef_stations(iff)) THEN
+
+     print*,'phys_output_mod phys_out_filenames=',phys_out_filenames(iff)
+
+      call histbeg_phy_all(rlon,rlat,pim,tabij,ipt,jpt,plon,plat,plon_bounds,plat_bounds, &
+                           phys_out_filenames(iff), &
+                           itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
        else
  CALL histbeg_phy(phys_out_filenames(iff),itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
@@ -793,5 +881,8 @@
 !                 1,preff,nvertp0(iff))
 !!! Champs 1D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- CALL histdef2d(iff,o_phis%flag,o_phis%name,"Surface geop.height", "m2/s2") 
+ IF (.NOT.clef_stations(iff)) THEN
+!
+!IM: there is no way to have one single value in a netcdf file
+!
    type_ecri(1) = 'once'
    type_ecri(2) = 'once'
@@ -799,15 +890,22 @@
    type_ecri(4) = 'once'
    type_ecri(5) = 'once'
- CALL histdef2d(iff,o_aire%flag,o_aire%name,"Grid area", "-")
- CALL histdef2d(iff,o_contfracATM%flag,o_contfracATM%name,"% sfce ter+lic", "-")
+   type_ecri(6) = 'once'
+   CALL histdef2d(iff,clef_stations(iff),o_aire%flag,o_aire%name,"Grid area", "-")
+   CALL histdef2d(iff,clef_stations(iff),o_contfracATM%flag,o_contfracATM%name,"% sfce ter+lic", "-")
+ ENDIF
    type_ecri(:) = type_ecri_files(:)
 
 !!! Champs 2D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- CALL histdef2d(iff,o_contfracOR%flag,o_contfracOR%name,"% sfce terre OR", "-" )
- CALL histdef2d(iff,o_aireTER%flag,o_aireTER%name,"Grid area CONT", "-" )
- CALL histdef2d(iff,o_flat%flag,o_flat%name, "Latent heat flux", "W/m2")
- CALL histdef2d(iff,o_slp%flag,o_slp%name, "Sea Level Pressure", "Pa" )
- CALL histdef2d(iff,o_tsol%flag,o_tsol%name, "Surface Temperature", "K")
- CALL histdef2d(iff,o_t2m%flag,o_t2m%name, "Temperature 2m", "K" )
+ CALL histdef2d(iff,clef_stations(iff),o_phis%flag,o_phis%name,"Surface geop.height", "m2/s2" )
+ CALL histdef2d(iff,clef_stations(iff),o_contfracOR%flag,o_contfracOR%name,"% sfce terre OR", "-" )
+ CALL histdef2d(iff,clef_stations(iff),o_aireTER%flag,o_aireTER%name,"Grid area CONT", "-" )
+ CALL histdef2d(iff,clef_stations(iff),o_flat%flag,o_flat%name, "Latent heat flux", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_slp%flag,o_slp%name, "Sea Level Pressure", "Pa" )
+ CALL histdef2d(iff,clef_stations(iff),o_tsol%flag,o_tsol%name, "Surface Temperature", "K")
+ CALL histdef2d(iff,clef_stations(iff),o_t2m%flag,o_t2m%name, "Temperature 2m", "K" )
+  IF (.NOT.clef_stations(iff)) THEN 
+!
+!IM: there is no way to have one single value in a netcdf file
+!
    type_ecri(1) = 't_min(X)'
    type_ecri(2) = 't_min(X)'
@@ -815,5 +913,6 @@
    type_ecri(4) = 't_min(X)'
    type_ecri(5) = 't_min(X)' 
- CALL histdef2d(iff,o_t2m_min%flag,o_t2m_min%name, "Temp 2m min", "K" )
+   type_ecri(6) = 't_min(X)' 
+   CALL histdef2d(iff,clef_stations(iff),o_t2m_min%flag,o_t2m_min%name, "Temp 2m min", "K" )
    type_ecri(1) = 't_max(X)'
    type_ecri(2) = 't_max(X)'
@@ -821,85 +920,106 @@
    type_ecri(4) = 't_max(X)'
    type_ecri(5) = 't_max(X)' 
- CALL histdef2d(iff,o_t2m_max%flag,o_t2m_max%name, "Temp 2m max", "K" )
+   type_ecri(6) = 't_max(X)' 
+   CALL histdef2d(iff,clef_stations(iff),o_t2m_max%flag,o_t2m_max%name, "Temp 2m max", "K" )
+  ENDIF 
    type_ecri(:) = type_ecri_files(:)
- CALL histdef2d(iff,o_wind10m%flag,o_wind10m%name, "10-m wind speed", "m/s")
- CALL histdef2d(iff,o_wind10max%flag,o_wind10max%name, "10m wind speed max", "m/s")
- CALL histdef2d(iff,o_sicf%flag,o_sicf%name, "Sea-ice fraction", "-" )
- CALL histdef2d(iff,o_q2m%flag,o_q2m%name, "Specific humidity 2m", "kg/kg")
- CALL histdef2d(iff,o_u10m%flag,o_u10m%name, "Vent zonal 10m", "m/s" )
- CALL histdef2d(iff,o_v10m%flag,o_v10m%name, "Vent meridien 10m", "m/s")
- CALL histdef2d(iff,o_psol%flag,o_psol%name, "Surface Pressure", "Pa" ) 
- CALL histdef2d(iff,o_qsurf%flag,o_qsurf%name, "Surface Air humidity", "kg/kg")
+ CALL histdef2d(iff,clef_stations(iff),o_wind10m%flag,o_wind10m%name, "10-m wind speed", "m/s")
+ CALL histdef2d(iff,clef_stations(iff),o_wind10max%flag,o_wind10max%name, "10m wind speed max", "m/s")
+ CALL histdef2d(iff,clef_stations(iff),o_sicf%flag,o_sicf%name, "Sea-ice fraction", "-" )
+ CALL histdef2d(iff,clef_stations(iff),o_q2m%flag,o_q2m%name, "Specific humidity 2m", "kg/kg")
+ CALL histdef2d(iff,clef_stations(iff),o_u10m%flag,o_u10m%name, "Vent zonal 10m", "m/s" )
+ CALL histdef2d(iff,clef_stations(iff),o_v10m%flag,o_v10m%name, "Vent meridien 10m", "m/s")
+ CALL histdef2d(iff,clef_stations(iff),o_psol%flag,o_psol%name, "Surface Pressure", "Pa" ) 
+ CALL histdef2d(iff,clef_stations(iff),o_qsurf%flag,o_qsurf%name, "Surface Air humidity", "kg/kg")
 
   if (.not. ok_veget) then
- CALL histdef2d(iff,o_qsol%flag,o_qsol%name, "Soil watter content", "mm" )
+ CALL histdef2d(iff,clef_stations(iff),o_qsol%flag,o_qsol%name, "Soil watter content", "mm" )
   endif
 
- CALL histdef2d(iff,o_ndayrain%flag,o_ndayrain%name, "Number of dayrain(liq+sol)", "-")
- CALL histdef2d(iff,o_precip%flag,o_precip%name, "Precip Totale liq+sol", "kg/(s*m2)" )
- CALL histdef2d(iff,o_plul%flag,o_plul%name, "Large-scale Precip.", "kg/(s*m2)") 
- CALL histdef2d(iff,o_pluc%flag,o_pluc%name, "Convective Precip.", "kg/(s*m2)")
- CALL histdef2d(iff,o_snow%flag,o_snow%name, "Snow fall", "kg/(s*m2)" )
- CALL histdef2d(iff,o_msnow%flag,o_msnow%name, "Surface snow amount", "kg/m2" )
- CALL histdef2d(iff,o_fsnow%flag,o_fsnow%name, "Surface snow area fraction", "-" )
- CALL histdef2d(iff,o_evap%flag,o_evap%name, "Evaporat", "kg/(s*m2)" ) 
- CALL histdef2d(iff,o_tops%flag,o_tops%name, "Solar rad. at TOA", "W/m2") 
- CALL histdef2d(iff,o_tops0%flag,o_tops0%name, "CS Solar rad. at TOA", "W/m2")
- CALL histdef2d(iff,o_topl%flag,o_topl%name, "IR rad. at TOA", "W/m2" )
- CALL histdef2d(iff,o_topl0%flag,o_topl0%name, "IR rad. at TOA", "W/m2")
- CALL histdef2d(iff,o_SWupTOA%flag,o_SWupTOA%name, "SWup at TOA", "W/m2") 
- CALL histdef2d(iff,o_SWupTOAclr%flag,o_SWupTOAclr%name, "SWup clear sky at TOA", "W/m2")
- CALL histdef2d(iff,o_SWdnTOA%flag,o_SWdnTOA%name, "SWdn at TOA", "W/m2" )
- CALL histdef2d(iff,o_SWdnTOAclr%flag,o_SWdnTOAclr%name, "SWdn clear sky at TOA", "W/m2") 
- CALL histdef2d(iff,o_nettop%flag,o_nettop%name, "Net dn radiatif flux at TOA", "W/m2")
- CALL histdef2d(iff,o_SWup200%flag,o_SWup200%name, "SWup at 200mb", "W/m2" ) 
- CALL histdef2d(iff,o_SWup200clr%flag,o_SWup200clr%name, "SWup clear sky at 200mb", "W/m2")
- CALL histdef2d(iff,o_SWdn200%flag,o_SWdn200%name, "SWdn at 200mb", "W/m2" )
- CALL histdef2d(iff,o_SWdn200clr%flag,o_SWdn200clr%name, "SWdn clear sky at 200mb", "W/m2")
- CALL histdef2d(iff,o_LWup200%flag,o_LWup200%name, "LWup at 200mb", "W/m2") 
- CALL histdef2d(iff,o_LWup200clr%flag,o_LWup200clr%name, "LWup clear sky at 200mb", "W/m2")
- CALL histdef2d(iff,o_LWdn200%flag,o_LWdn200%name, "LWdn at 200mb", "W/m2") 
- CALL histdef2d(iff,o_LWdn200clr%flag,o_LWdn200clr%name, "LWdn clear sky at 200mb", "W/m2")
- CALL histdef2d(iff,o_sols%flag,o_sols%name, "Solar rad. at surf.", "W/m2")
- CALL histdef2d(iff,o_sols0%flag,o_sols0%name, "Solar rad. at surf.", "W/m2")
- CALL histdef2d(iff,o_soll%flag,o_soll%name, "IR rad. at surface", "W/m2")  
- CALL histdef2d(iff,o_radsol%flag,o_radsol%name, "Rayonnement au sol", "W/m2")
- CALL histdef2d(iff,o_soll0%flag,o_soll0%name, "IR rad. at surface", "W/m2") 
- CALL histdef2d(iff,o_SWupSFC%flag,o_SWupSFC%name, "SWup at surface", "W/m2")
- CALL histdef2d(iff,o_SWupSFCclr%flag,o_SWupSFCclr%name, "SWup clear sky at surface", "W/m2")
- CALL histdef2d(iff,o_SWdnSFC%flag,o_SWdnSFC%name, "SWdn at surface", "W/m2")
- CALL histdef2d(iff,o_SWdnSFCclr%flag,o_SWdnSFCclr%name, "SWdn clear sky at surface", "W/m2")
- CALL histdef2d(iff,o_LWupSFC%flag,o_LWupSFC%name, "Upwd. IR rad. at surface", "W/m2")
- CALL histdef2d(iff,o_LWdnSFC%flag,o_LWdnSFC%name, "Down. IR rad. at surface", "W/m2")
- CALL histdef2d(iff,o_LWupSFCclr%flag,o_LWupSFCclr%name, "CS Upwd. IR rad. at surface", "W/m2")
- CALL histdef2d(iff,o_LWdnSFCclr%flag,o_LWdnSFCclr%name, "Down. CS IR rad. at surface", "W/m2")
- CALL histdef2d(iff,o_bils%flag,o_bils%name, "Surf. total heat flux", "W/m2")
- CALL histdef2d(iff,o_sens%flag,o_sens%name, "Sensible heat flux", "W/m2")
- CALL histdef2d(iff,o_fder%flag,o_fder%name, "Heat flux derivation", "W/m2")
- CALL histdef2d(iff,o_ffonte%flag,o_ffonte%name, "Thermal flux for snow melting", "W/m2")
- CALL histdef2d(iff,o_fqcalving%flag,o_fqcalving%name, "Ice Calving", "kg/m2/s") 
- CALL histdef2d(iff,o_fqfonte%flag,o_fqfonte%name, "Land ice melt", "kg/m2/s") 
-
- CALL histdef2d(iff,o_taux%flag,o_taux%name, "Zonal wind stress","Pa")
- CALL histdef2d(iff,o_tauy%flag,o_tauy%name, "Meridional wind stress","Pa")
+ CALL histdef2d(iff,clef_stations(iff),o_ndayrain%flag,o_ndayrain%name, "Number of dayrain(liq+sol)", "-")
+ CALL histdef2d(iff,clef_stations(iff),o_precip%flag,o_precip%name, "Precip Totale liq+sol", "kg/(s*m2)" )
+ CALL histdef2d(iff,clef_stations(iff),o_plul%flag,o_plul%name, "Large-scale Precip.", "kg/(s*m2)") 
+ CALL histdef2d(iff,clef_stations(iff),o_pluc%flag,o_pluc%name, "Convective Precip.", "kg/(s*m2)")
+ CALL histdef2d(iff,clef_stations(iff),o_snow%flag,o_snow%name, "Snow fall", "kg/(s*m2)" )
+ CALL histdef2d(iff,clef_stations(iff),o_msnow%flag,o_msnow%name, "Surface snow amount", "kg/m2" )
+ CALL histdef2d(iff,clef_stations(iff),o_fsnow%flag,o_fsnow%name, "Surface snow area fraction", "-" )
+ CALL histdef2d(iff,clef_stations(iff),o_evap%flag,o_evap%name, "Evaporat", "kg/(s*m2)" ) 
+ CALL histdef2d(iff,clef_stations(iff),o_tops%flag,o_tops%name, "Solar rad. at TOA", "W/m2") 
+ CALL histdef2d(iff,clef_stations(iff),o_tops0%flag,o_tops0%name, "CS Solar rad. at TOA", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_topl%flag,o_topl%name, "IR rad. at TOA", "W/m2" )
+ CALL histdef2d(iff,clef_stations(iff),o_topl0%flag,o_topl0%name, "IR rad. at TOA", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_SWupTOA%flag,o_SWupTOA%name, "SWup at TOA", "W/m2") 
+ CALL histdef2d(iff,clef_stations(iff),o_SWupTOAclr%flag,o_SWupTOAclr%name, "SWup clear sky at TOA", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_SWdnTOA%flag,o_SWdnTOA%name, "SWdn at TOA", "W/m2" )
+ CALL histdef2d(iff,clef_stations(iff),o_SWdnTOAclr%flag,o_SWdnTOAclr%name, "SWdn clear sky at TOA", "W/m2") 
+ CALL histdef2d(iff,clef_stations(iff),o_nettop%flag,o_nettop%name, "Net dn radiatif flux at TOA", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_SWup200%flag,o_SWup200%name, "SWup at 200mb", "W/m2" ) 
+ CALL histdef2d(iff,clef_stations(iff),o_SWup200clr%flag,o_SWup200clr%name, "SWup clear sky at 200mb", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_SWdn200%flag,o_SWdn200%name, "SWdn at 200mb", "W/m2" )
+ CALL histdef2d(iff,clef_stations(iff),o_SWdn200clr%flag,o_SWdn200clr%name, "SWdn clear sky at 200mb", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_LWup200%flag,o_LWup200%name, "LWup at 200mb", "W/m2") 
+ CALL histdef2d(iff,clef_stations(iff),o_LWup200clr%flag,o_LWup200clr%name, "LWup clear sky at 200mb", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_LWdn200%flag,o_LWdn200%name, "LWdn at 200mb", "W/m2") 
+ CALL histdef2d(iff,clef_stations(iff),o_LWdn200clr%flag,o_LWdn200clr%name, "LWdn clear sky at 200mb", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_sols%flag,o_sols%name, "Solar rad. at surf.", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_sols0%flag,o_sols0%name, "Solar rad. at surf.", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_soll%flag,o_soll%name, "IR rad. at surface", "W/m2")  
+ CALL histdef2d(iff,clef_stations(iff),o_radsol%flag,o_radsol%name, "Rayonnement au sol", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_soll0%flag,o_soll0%name, "IR rad. at surface", "W/m2") 
+ CALL histdef2d(iff,clef_stations(iff),o_SWupSFC%flag,o_SWupSFC%name, "SWup at surface", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_SWupSFCclr%flag,o_SWupSFCclr%name, "SWup clear sky at surface", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_SWdnSFC%flag,o_SWdnSFC%name, "SWdn at surface", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_SWdnSFCclr%flag,o_SWdnSFCclr%name, "SWdn clear sky at surface", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_LWupSFC%flag,o_LWupSFC%name, "Upwd. IR rad. at surface", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_LWdnSFC%flag,o_LWdnSFC%name, "Down. IR rad. at surface", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_LWupSFCclr%flag,o_LWupSFCclr%name, "CS Upwd. IR rad. at surface", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_LWdnSFCclr%flag,o_LWdnSFCclr%name, "Down. CS IR rad. at surface", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_bils%flag,o_bils%name, "Surf. total heat flux", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_sens%flag,o_sens%name, "Sensible heat flux", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_fder%flag,o_fder%name, "Heat flux derivation", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_ffonte%flag,o_ffonte%name, "Thermal flux for snow melting", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_fqcalving%flag,o_fqcalving%name, "Ice Calving", "kg/m2/s") 
+ CALL histdef2d(iff,clef_stations(iff),o_fqfonte%flag,o_fqfonte%name, "Land ice melt", "kg/m2/s") 
+
+ CALL histdef2d(iff,clef_stations(iff),o_taux%flag,o_taux%name, "Zonal wind stress","Pa")
+ CALL histdef2d(iff,clef_stations(iff),o_tauy%flag,o_tauy%name, "Meridional wind stress","Pa")
 
      DO nsrf = 1, nbsrf
- CALL histdef2d(iff,o_pourc_srf(nsrf)%flag,o_pourc_srf(nsrf)%name,"% "//clnsurf(nsrf),"%")
- CALL histdef2d(iff,o_fract_srf(nsrf)%flag,o_fract_srf(nsrf)%name,"Fraction "//clnsurf(nsrf),"1")
- CALL histdef2d(iff,o_taux_srf(nsrf)%flag,o_taux_srf(nsrf)%name,"Zonal wind stress"//clnsurf(nsrf),"Pa")
- CALL histdef2d(iff,o_tauy_srf(nsrf)%flag,o_tauy_srf(nsrf)%name,"Meridional wind stress "//clnsurf(nsrf),"Pa")
- CALL histdef2d(iff,o_tsol_srf(nsrf)%flag,o_tsol_srf(nsrf)%name,"Temperature "//clnsurf(nsrf),"K")
- CALL histdef2d(iff,o_u10m_srf(nsrf)%flag,o_u10m_srf(nsrf)%name,"Vent Zonal 10m "//clnsurf(nsrf),"m/s")
- CALL histdef2d(iff,o_evap_srf(nsrf)%flag,o_evap_srf(nsrf)%name,"evaporation at surface "//clnsurf(nsrf),"kg/(s*m2)")
- CALL histdef2d(iff,o_v10m_srf(nsrf)%flag,o_v10m_srf(nsrf)%name,"Vent meredien 10m "//clnsurf(nsrf),"m/s")
- CALL histdef2d(iff,o_t2m_srf(nsrf)%flag,o_t2m_srf(nsrf)%name,"Temp 2m "//clnsurf(nsrf),"K")
- CALL histdef2d(iff,o_sens_srf(nsrf)%flag,o_sens_srf(nsrf)%name,"Sensible heat flux "//clnsurf(nsrf),"W/m2")
- CALL histdef2d(iff,o_lat_srf(nsrf)%flag,o_lat_srf(nsrf)%name,"Latent heat flux "//clnsurf(nsrf),"W/m2")
- CALL histdef2d(iff,o_flw_srf(nsrf)%flag,o_flw_srf(nsrf)%name,"LW "//clnsurf(nsrf),"W/m2")
- CALL histdef2d(iff,o_fsw_srf(nsrf)%flag,o_fsw_srf(nsrf)%name,"SW "//clnsurf(nsrf),"W/m2")
- CALL histdef2d(iff,o_wbils_srf(nsrf)%flag,o_wbils_srf(nsrf)%name,"Bilan sol "//clnsurf(nsrf),"W/m2" )
- CALL histdef2d(iff,o_wbilo_srf(nsrf)%flag,o_wbilo_srf(nsrf)%name,"Bilan eau "//clnsurf(nsrf),"kg/(m2*s)")
+ CALL histdef2d(iff,clef_stations(iff),o_pourc_srf(nsrf)%flag,o_pourc_srf(nsrf)%name,"% "//clnsurf(nsrf),"%")
+ CALL histdef2d(iff,clef_stations(iff),o_fract_srf(nsrf)%flag,o_fract_srf(nsrf)%name,"Fraction "//clnsurf(nsrf),"1")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_taux_srf(nsrf)%flag,o_taux_srf(nsrf)%name,"Zonal wind stress"//clnsurf(nsrf),"Pa")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_tauy_srf(nsrf)%flag,o_tauy_srf(nsrf)%name,"Meridional wind stress "//clnsurf(nsrf),"Pa")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_tsol_srf(nsrf)%flag,o_tsol_srf(nsrf)%name,"Temperature "//clnsurf(nsrf),"K")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_u10m_srf(nsrf)%flag,o_u10m_srf(nsrf)%name,"Vent Zonal 10m "//clnsurf(nsrf),"m/s")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_evap_srf(nsrf)%flag,o_evap_srf(nsrf)%name,"evaporation at surface "//clnsurf(nsrf),"kg/(s*m2)")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_v10m_srf(nsrf)%flag,o_v10m_srf(nsrf)%name,"Vent meredien 10m "//clnsurf(nsrf),"m/s")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_t2m_srf(nsrf)%flag,o_t2m_srf(nsrf)%name,"Temp 2m "//clnsurf(nsrf),"K")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_sens_srf(nsrf)%flag,o_sens_srf(nsrf)%name,"Sensible heat flux "//clnsurf(nsrf),"W/m2")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_lat_srf(nsrf)%flag,o_lat_srf(nsrf)%name,"Latent heat flux "//clnsurf(nsrf),"W/m2")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_flw_srf(nsrf)%flag,o_flw_srf(nsrf)%name,"LW "//clnsurf(nsrf),"W/m2")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_fsw_srf(nsrf)%flag,o_fsw_srf(nsrf)%name,"SW "//clnsurf(nsrf),"W/m2")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_wbils_srf(nsrf)%flag,o_wbils_srf(nsrf)%name,"Bilan sol "//clnsurf(nsrf),"W/m2" )
+ CALL histdef2d(iff,clef_stations(iff), &
+o_wbilo_srf(nsrf)%flag,o_wbilo_srf(nsrf)%name,"Bilan eau "//clnsurf(nsrf),"kg/(m2*s)")
   if (iflag_pbl>1 .and. lev_files(iff).gt.10 ) then
- CALL histdef2d(iff,o_tke_srf(nsrf)%flag,o_tke_srf(nsrf)%name,"Max Turb. Kinetic Energy "//clnsurf(nsrf),"-")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_tke_srf(nsrf)%flag,o_tke_srf(nsrf)%name,"Max Turb. Kinetic Energy "//clnsurf(nsrf),"-")
+
+  IF (.NOT.clef_stations(iff)) THEN 
+!
+!IM: there is no way to have one single value in a netcdf file
+!
    type_ecri(1) = 't_max(X)'
    type_ecri(2) = 't_max(X)'
@@ -907,10 +1027,18 @@
    type_ecri(4) = 't_max(X)'
    type_ecri(5) = 't_max(X)'
- CALL histdef2d(iff,o_tke_max_srf(nsrf)%flag,o_tke_max_srf(nsrf)%name,"Max Turb. Kinetic Energy "//clnsurf(nsrf),"-")
+   type_ecri(6) = 't_max(X)'
+  CALL histdef2d(iff,clef_stations(iff), &
+  o_tke_max_srf(nsrf)%flag,o_tke_max_srf(nsrf)%name,"Max Turb. Kinetic Energy "//clnsurf(nsrf),"-")
    type_ecri(:) = type_ecri_files(:)
+  ENDIF
+
   endif
- CALL histdef2d(iff,o_albe_srf(nsrf)%flag,o_albe_srf(nsrf)%name,"Albedo VIS surf. "//clnsurf(nsrf),"-")
- CALL histdef2d(iff,o_rugs_srf(nsrf)%flag,o_rugs_srf(nsrf)%name,"Surface roughness "//clnsurf(nsrf),"m")
- CALL histdef2d(iff,o_ages_srf(nsrf)%flag,o_ages_srf(nsrf)%name,"Snow age", "day")
+
+ CALL histdef2d(iff,clef_stations(iff), &
+o_albe_srf(nsrf)%flag,o_albe_srf(nsrf)%name,"Albedo VIS surf. "//clnsurf(nsrf),"-")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_rugs_srf(nsrf)%flag,o_rugs_srf(nsrf)%name,"Surface roughness "//clnsurf(nsrf),"m")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_ages_srf(nsrf)%flag,o_ages_srf(nsrf)%name,"Snow age", "day")
 END DO
 
@@ -918,26 +1046,48 @@
  IF (ok_ade.OR.ok_aie) THEN
 
-  CALL histdef2d(iff,o_od550aer%flag,o_od550aer%name, "Total aerosol optical depth at 550nm", "-")
-  CALL histdef2d(iff,o_od865aer%flag,o_od865aer%name, "Total aerosol optical depth at 870nm", "-")
-  CALL histdef2d(iff,o_absvisaer%flag,o_absvisaer%name, "Absorption aerosol visible optical depth", "-")
-  CALL histdef2d(iff,o_od550lt1aer%flag,o_od550lt1aer%name, "Fine mode optical depth", "-")
-  CALL histdef2d(iff,o_sconcso4%flag,o_sconcso4%name,"Surface Concentration of Sulfate ","kg/m3")
-  CALL histdef2d(iff,o_sconcoa%flag,o_sconcoa%name,"Surface Concentration of Organic Aerosol ","kg/m3")
-  CALL histdef2d(iff,o_sconcbc%flag,o_sconcbc%name,"Surface Concentration of Black Carbon ","kg/m3")
-  CALL histdef2d(iff,o_sconcss%flag,o_sconcss%name,"Surface Concentration of Sea Salt ","kg/m3")
-  CALL histdef2d(iff,o_sconcdust%flag,o_sconcdust%name,"Surface Concentration of Dust ","kg/m3")
-  CALL histdef3d(iff,o_concso4%flag,o_concso4%name,"Concentration of Sulfate ","kg/m3")
-  CALL histdef3d(iff,o_concoa%flag,o_concoa%name,"Concentration of Organic Aerosol ","kg/m3")
-  CALL histdef3d(iff,o_concbc%flag,o_concbc%name,"Concentration of Black Carbon ","kg/m3")
-  CALL histdef3d(iff,o_concss%flag,o_concss%name,"Concentration of Sea Salt ","kg/m3")
-  CALL histdef3d(iff,o_concdust%flag,o_concdust%name,"Concentration of Dust ","kg/m3")
-  CALL histdef2d(iff,o_loadso4%flag,o_loadso4%name,"Column Load of Sulfate ","kg/m2")
-  CALL histdef2d(iff,o_loadoa%flag,o_loadoa%name,"Column Load of Organic Aerosol ","kg/m2")
-  CALL histdef2d(iff,o_loadbc%flag,o_loadbc%name,"Column Load of Black Carbon ","kg/m2")
-  CALL histdef2d(iff,o_loadss%flag,o_loadss%name,"Column Load of Sea Salt ","kg/m2")
-  CALL histdef2d(iff,o_loaddust%flag,o_loaddust%name,"Column Load of Dust ","kg/m2")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_od550aer%flag,o_od550aer%name, "Total aerosol optical depth at 550nm", "-")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_od865aer%flag,o_od865aer%name, "Total aerosol optical depth at 870nm", "-")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_absvisaer%flag,o_absvisaer%name, "Absorption aerosol visible optical depth", "-")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_od550lt1aer%flag,o_od550lt1aer%name, "Fine mode optical depth", "-")
+
+
+  CALL histdef2d(iff,clef_stations(iff), &
+o_sconcso4%flag,o_sconcso4%name,"Surface Concentration of Sulfate ","kg/m3")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_sconcoa%flag,o_sconcoa%name,"Surface Concentration of Organic Aerosol ","kg/m3")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_sconcbc%flag,o_sconcbc%name,"Surface Concentration of Black Carbon ","kg/m3")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_sconcss%flag,o_sconcss%name,"Surface Concentration of Sea Salt ","kg/m3")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_sconcdust%flag,o_sconcdust%name,"Surface Concentration of Dust ","kg/m3")
+  CALL histdef3d(iff,clef_stations(iff), &
+o_concso4%flag,o_concso4%name,"Concentration of Sulfate ","kg/m3")
+  CALL histdef3d(iff,clef_stations(iff), &
+o_concoa%flag,o_concoa%name,"Concentration of Organic Aerosol ","kg/m3")
+  CALL histdef3d(iff,clef_stations(iff), &
+o_concbc%flag,o_concbc%name,"Concentration of Black Carbon ","kg/m3")
+  CALL histdef3d(iff,clef_stations(iff), &
+o_concss%flag,o_concss%name,"Concentration of Sea Salt ","kg/m3")
+  CALL histdef3d(iff,clef_stations(iff), &
+o_concdust%flag,o_concdust%name,"Concentration of Dust ","kg/m3")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_loadso4%flag,o_loadso4%name,"Column Load of Sulfate ","kg/m2")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_loadoa%flag,o_loadoa%name,"Column Load of Organic Aerosol ","kg/m2")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_loadbc%flag,o_loadbc%name,"Column Load of Black Carbon ","kg/m2")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_loadss%flag,o_loadss%name,"Column Load of Sea Salt ","kg/m2")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_loaddust%flag,o_loaddust%name,"Column Load of Dust ","kg/m2")
 
   DO naero = 1, naero_spc
-  CALL histdef2d(iff,o_tausumaero(naero)%flag,o_tausumaero(naero)%name,"Aerosol Optical depth at 550 nm "//name_aero(naero),"1")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_tausumaero(naero)%flag,o_tausumaero(naero)%name,"Aerosol Optical depth at 550 nm "//name_aero(naero),"1")
   END DO
  ENDIF
@@ -945,24 +1095,40 @@
 
  IF (ok_ade) THEN
-  CALL histdef2d(iff,o_topswad%flag,o_topswad%name, "ADE at TOA", "W/m2")
-  CALL histdef2d(iff,o_solswad%flag,o_solswad%name, "ADE at SRF", "W/m2")
-
- CALL histdef2d(iff,o_swtoaas_nat%flag,o_swtoaas_nat%name, "Natural aerosol radiative forcing all-sky at TOA", "W/m2")
- CALL histdef2d(iff,o_swsrfas_nat%flag,o_swsrfas_nat%name, "Natural aerosol radiative forcing all-sky at SRF", "W/m2")
- CALL histdef2d(iff,o_swtoacs_nat%flag,o_swtoacs_nat%name, "Natural aerosol radiative forcing clear-sky at TOA", "W/m2")
- CALL histdef2d(iff,o_swsrfcs_nat%flag,o_swsrfcs_nat%name, "Natural aerosol radiative forcing clear-sky at SRF", "W/m2")
-
- CALL histdef2d(iff,o_swtoaas_ant%flag,o_swtoaas_ant%name, "Anthropogenic aerosol radiative forcing all-sky at TOA", "W/m2")
- CALL histdef2d(iff,o_swsrfas_ant%flag,o_swsrfas_ant%name, "Anthropogenic aerosol radiative forcing all-sky at SRF", "W/m2")
- CALL histdef2d(iff,o_swtoacs_ant%flag,o_swtoacs_ant%name, "Anthropogenic aerosol radiative forcing clear-sky at TOA", "W/m2")
- CALL histdef2d(iff,o_swsrfcs_ant%flag,o_swsrfcs_ant%name, "Anthropogenic aerosol radiative forcing clear-sky at SRF", "W/m2")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_topswad%flag,o_topswad%name, "ADE at TOA", "W/m2")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_solswad%flag,o_solswad%name, "ADE at SRF", "W/m2")
+
+ CALL histdef2d(iff,clef_stations(iff), &
+o_swtoaas_nat%flag,o_swtoaas_nat%name, "Natural aerosol radiative forcing all-sky at TOA", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_swsrfas_nat%flag,o_swsrfas_nat%name, "Natural aerosol radiative forcing all-sky at SRF", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_swtoacs_nat%flag,o_swtoacs_nat%name, "Natural aerosol radiative forcing clear-sky at TOA", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_swsrfcs_nat%flag,o_swsrfcs_nat%name, "Natural aerosol radiative forcing clear-sky at SRF", "W/m2")
+
+ CALL histdef2d(iff,clef_stations(iff), &
+o_swtoaas_ant%flag,o_swtoaas_ant%name, "Anthropogenic aerosol radiative forcing all-sky at TOA", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_swsrfas_ant%flag,o_swsrfas_ant%name, "Anthropogenic aerosol radiative forcing all-sky at SRF", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_swtoacs_ant%flag,o_swtoacs_ant%name, "Anthropogenic aerosol radiative forcing clear-sky at TOA", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_swsrfcs_ant%flag,o_swsrfcs_ant%name, "Anthropogenic aerosol radiative forcing clear-sky at SRF", "W/m2")
 
  IF (.NOT. aerosol_couple) THEN 
- CALL histdef2d(iff,o_swtoacf_nat%flag,o_swtoacf_nat%name, "Natural aerosol impact on cloud radiative forcing at TOA", "W/m2")
- CALL histdef2d(iff,o_swsrfcf_nat%flag,o_swsrfcf_nat%name, "Natural aerosol impact on cloud radiative forcing  at SRF", "W/m2")
- CALL histdef2d(iff,o_swtoacf_ant%flag,o_swtoacf_ant%name, "Anthropogenic aerosol impact on cloud radiative forcing at TOA", "W/m2")
- CALL histdef2d(iff,o_swsrfcf_ant%flag,o_swsrfcf_ant%name, "Anthropogenic aerosol impact on cloud radiative forcing at SRF", "W/m2")
- CALL histdef2d(iff,o_swtoacf_zero%flag,o_swtoacf_zero%name, "Cloud radiative forcing (allsky-clearsky fluxes) at TOA", "W/m2")
- CALL histdef2d(iff,o_swsrfcf_zero%flag,o_swsrfcf_zero%name, "Cloud radiative forcing (allsky-clearsky fluxes) at SRF", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_swtoacf_nat%flag,o_swtoacf_nat%name, "Natural aerosol impact on cloud radiative forcing at TOA", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_swsrfcf_nat%flag,o_swsrfcf_nat%name, "Natural aerosol impact on cloud radiative forcing  at SRF", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_swtoacf_ant%flag,o_swtoacf_ant%name, "Anthropogenic aerosol impact on cloud radiative forcing at TOA", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_swsrfcf_ant%flag,o_swsrfcf_ant%name, "Anthropogenic aerosol impact on cloud radiative forcing at SRF", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_swtoacf_zero%flag,o_swtoacf_zero%name, "Cloud radiative forcing (allsky-clearsky fluxes) at TOA", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_swsrfcf_zero%flag,o_swsrfcf_zero%name, "Cloud radiative forcing (allsky-clearsky fluxes) at SRF", "W/m2")
  ENDIF
 
@@ -970,45 +1136,206 @@
 
  IF (ok_aie) THEN
-  CALL histdef2d(iff,o_topswai%flag,o_topswai%name, "AIE at TOA", "W/m2")
-  CALL histdef2d(iff,o_solswai%flag,o_solswai%name, "AIE at SFR", "W/m2")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_topswai%flag,o_topswai%name, "AIE at TOA", "W/m2")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_solswai%flag,o_solswai%name, "AIE at SFR", "W/m2")
 !Cloud droplet number concentration
-  CALL histdef3d(iff,o_scdnc%flag,o_scdnc%name, "Cloud droplet number concentration","m-3")
-  CALL histdef2d(iff,o_cldncl%flag,o_cldncl%name, "CDNC at top of liquid water cloud", "m-3")
-  CALL histdef3d(iff,o_reffclws%flag,o_reffclws%name, "Stratiform Cloud Droplet Effective Radius","m")
-  CALL histdef3d(iff,o_reffclwc%flag,o_reffclwc%name, "Convective Cloud Droplet Effective Radius","m")
-  CALL histdef2d(iff,o_cldnvi%flag,o_cldnvi%name, "Column Integrated Cloud Droplet Number", "m-2")
-  CALL histdef3d(iff,o_lcc3d%flag,o_lcc3d%name, "Cloud liquid fraction","1")
-  CALL histdef3d(iff,o_lcc3dcon%flag,o_lcc3dcon%name, "Convective cloud liquid fraction","1")
-  CALL histdef3d(iff,o_lcc3dstra%flag,o_lcc3dstra%name, "Stratiform cloud liquid fraction","1")
-  CALL histdef2d(iff,o_lcc%flag,o_lcc%name, "Cloud liquid fraction at top of cloud","1")
-  CALL histdef2d(iff,o_reffclwtop%flag,o_reffclwtop%name, "Droplet effective radius at top of liquid water cloud", "m")
+  CALL histdef3d(iff,clef_stations(iff), &
+o_scdnc%flag,o_scdnc%name, "Cloud droplet number concentration","m-3")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_cldncl%flag,o_cldncl%name, "CDNC at top of liquid water cloud", "m-3")
+  CALL histdef3d(iff,clef_stations(iff), &
+o_reffclws%flag,o_reffclws%name, "Stratiform Cloud Droplet Effective Radius (aerosol diags.)","m")
+  CALL histdef3d(iff,clef_stations(iff), &
+o_reffclwc%flag,o_reffclwc%name, "Convective Cloud Droplet Effective Radius (aerosol diags.)","m")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_cldnvi%flag,o_cldnvi%name, "Column Integrated Cloud Droplet Number", "m-2")
+  CALL histdef3d(iff,clef_stations(iff), &
+o_lcc3d%flag,o_lcc3d%name, "Cloud liquid fraction","1")
+  CALL histdef3d(iff,clef_stations(iff), &
+o_lcc3dcon%flag,o_lcc3dcon%name, "Convective cloud liquid fraction","1")
+  CALL histdef3d(iff,clef_stations(iff), &
+o_lcc3dstra%flag,o_lcc3dstra%name, "Stratiform cloud liquid fraction","1")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_lcc%flag,o_lcc%name, "Cloud liquid fraction at top of cloud","1")
+  CALL histdef2d(iff,clef_stations(iff), &
+o_reffclwtop%flag,o_reffclwtop%name, "Droplet effective radius at top of liquid water cloud", "m")
  ENDIF
 
 
- CALL histdef2d(iff,o_alb1%flag,o_alb1%name, "Surface VIS albedo", "-")
- CALL histdef2d(iff,o_alb2%flag,o_alb2%name, "Surface Near IR albedo", "-")
- CALL histdef2d(iff,o_cdrm%flag,o_cdrm%name, "Momentum drag coef.", "-")
- CALL histdef2d(iff,o_cdrh%flag,o_cdrh%name, "Heat drag coef.", "-" )
- CALL histdef2d(iff,o_cldl%flag,o_cldl%name, "Low-level cloudiness", "-")
- CALL histdef2d(iff,o_cldm%flag,o_cldm%name, "Mid-level cloudiness", "-")
- CALL histdef2d(iff,o_cldh%flag,o_cldh%name, "High-level cloudiness", "-")
- CALL histdef2d(iff,o_cldt%flag,o_cldt%name, "Total cloudiness", "-")
- CALL histdef2d(iff,o_cldq%flag,o_cldq%name, "Cloud liquid water path", "kg/m2")
- CALL histdef2d(iff,o_lwp%flag,o_lwp%name, "Cloud water path", "kg/m2")
- CALL histdef2d(iff,o_iwp%flag,o_iwp%name, "Cloud ice water path", "kg/m2" )
- CALL histdef2d(iff,o_ue%flag,o_ue%name, "Zonal energy transport", "-")
- CALL histdef2d(iff,o_ve%flag,o_ve%name, "Merid energy transport", "-")
- CALL histdef2d(iff,o_uq%flag,o_uq%name, "Zonal humidity transport", "-")
- CALL histdef2d(iff,o_vq%flag,o_vq%name, "Merid humidity transport", "-")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_alb1%flag,o_alb1%name, "Surface VIS albedo", "-")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_alb2%flag,o_alb2%name, "Surface Near IR albedo", "-")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_cdrm%flag,o_cdrm%name, "Momentum drag coef.", "-")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_cdrh%flag,o_cdrh%name, "Heat drag coef.", "-" )
+ CALL histdef2d(iff,clef_stations(iff), &
+o_cldl%flag,o_cldl%name, "Low-level cloudiness", "-")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_cldm%flag,o_cldm%name, "Mid-level cloudiness", "-")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_cldh%flag,o_cldh%name, "High-level cloudiness", "-")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_cldt%flag,o_cldt%name, "Total cloudiness", "-")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_cldq%flag,o_cldq%name, "Cloud liquid water path", "kg/m2")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_lwp%flag,o_lwp%name, "Cloud water path", "kg/m2")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_iwp%flag,o_iwp%name, "Cloud ice water path", "kg/m2" )
+ CALL histdef2d(iff,clef_stations(iff), &
+o_ue%flag,o_ue%name, "Zonal energy transport", "-")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_ve%flag,o_ve%name, "Merid energy transport", "-")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_uq%flag,o_uq%name, "Zonal humidity transport", "-")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_vq%flag,o_vq%name, "Merid humidity transport", "-")
 
      IF(iflag_con.GE.3) THEN ! sb
- CALL histdef2d(iff,o_cape%flag,o_cape%name, "Conv avlbl pot ener", "J/kg")
- CALL histdef2d(iff,o_pbase%flag,o_pbase%name, "Cld base pressure", "Pa")
- CALL histdef2d(iff,o_ptop%flag,o_ptop%name, "Cld top pressure", "Pa")
- CALL histdef2d(iff,o_fbase%flag,o_fbase%name, "Cld base mass flux", "kg/m2/s")
- CALL histdef2d(iff,o_plcl%flag,o_plcl%name, "Lifting Condensation Level", "hPa")
- CALL histdef2d(iff,o_plfc%flag,o_plfc%name, "Level of Free Convection", "hPa")
- CALL histdef2d(iff,o_wbeff%flag,o_wbeff%name, "Conv. updraft velocity at LFC", "m/s")
- CALL histdef2d(iff,o_prw%flag,o_prw%name, "Precipitable water", "kg/m2")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_cape%flag,o_cape%name, "Conv avlbl pot ener", "J/kg")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_pbase%flag,o_pbase%name, "Cld base pressure", "Pa")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_ptop%flag,o_ptop%name, "Cld top pressure", "Pa")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_fbase%flag,o_fbase%name, "Cld base mass flux", "kg/m2/s")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_plcl%flag,o_plcl%name, "Lifting Condensation Level", "hPa")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_plfc%flag,o_plfc%name, "Level of Free Convection", "hPa")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_wbeff%flag,o_wbeff%name, "Conv. updraft velocity at LFC", "m/s")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_prw%flag,o_prw%name, "Precipitable water", "kg/m2")
+  IF (.NOT.clef_stations(iff)) THEN 
+!
+!IM: there is no way to have one single value in a netcdf file
+!
+    type_ecri(1) = 't_max(X)'
+    type_ecri(2) = 't_max(X)'
+    type_ecri(3) = 't_max(X)'
+    type_ecri(4) = 't_max(X)'
+    type_ecri(5) = 't_max(X)'
+    type_ecri(6) = 't_max(X)'
+    CALL histdef2d(iff,clef_stations(iff), &
+  o_cape_max%flag,o_cape_max%name, "CAPE max.", "J/kg")
+  ENDIF
+   type_ecri(:) = type_ecri_files(:)
+ CALL histdef3d(iff,clef_stations(iff), &
+o_upwd%flag,o_upwd%name, "saturated updraft", "kg/m2/s")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_Ma%flag,o_Ma%name, "undilute adiab updraft", "kg/m2/s")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dnwd%flag,o_dnwd%name, "saturated downdraft", "kg/m2/s")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dnwd0%flag,o_dnwd0%name, "unsat. downdraft", "kg/m2/s")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_mc%flag,o_mc%name, "Convective mass flux", "kg/m2/s")
+   type_ecri(1) = 'inst(X)'
+   type_ecri(2) = 'inst(X)'
+   type_ecri(3) = 'inst(X)'
+   type_ecri(4) = 'inst(X)'
+   type_ecri(5) = 'inst(X)'
+   type_ecri(6) = 'inst(X)'
+ CALL histdef2d(iff,clef_stations(iff), &
+o_ftime_con%flag,o_ftime_con%name, "Fraction of time convection Occurs", " ")
+   type_ecri(:) = type_ecri_files(:)
+     ENDIF !iflag_con .GE. 3
+
+ CALL histdef2d(iff,clef_stations(iff), &
+o_s_pblh%flag,o_s_pblh%name, "Boundary Layer Height", "m")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_s_pblt%flag,o_s_pblt%name, "t at Boundary Layer Height", "K")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_s_lcl%flag,o_s_lcl%name, "Condensation level", "m")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_s_therm%flag,o_s_therm%name, "Exces du thermique", "K")
+!IM : Les champs suivants (s_oliqCL, s_cteiCL, s_trmb1, s_trmb2, s_trmb3) ne sont pas definis dans HBTM.F
+!CALL histdef2d(iff,clef_stations(iff), &
+!o_s_capCL%flag,o_s_capCL%name, "Conv avlbl pot enerfor ABL", "J/m2" )
+!CALL histdef2d(iff,clef_stations(iff), &
+!o_s_oliqCL%flag,o_s_oliqCL%name, "Liq Water in BL", "kg/m2")
+!CALL histdef2d(iff,clef_stations(iff), &
+!o_s_cteiCL%flag,o_s_cteiCL%name, "Instability criteria(ABL)", "K")
+!CALL histdef2d(iff,clef_stations(iff), &
+!o_s_trmb1%flag,o_s_trmb1%name, "deep_cape(HBTM2)", "J/m2")
+!CALL histdef2d(iff,clef_stations(iff), &
+!o_s_trmb2%flag,o_s_trmb2%name, "inhibition (HBTM2)", "J/m2")
+!CALL histdef2d(iff,clef_stations(iff), &
+!o_s_trmb3%flag,o_s_trmb3%name, "Point Omega (HBTM2)", "m")
+
+! Champs interpolles sur des niveaux de pression
+
+   type_ecri(1) = 'inst(X)'
+   type_ecri(2) = 'inst(X)'
+   type_ecri(3) = 'inst(X)'
+   type_ecri(4) = 'inst(X)'
+   type_ecri(5) = 'inst(X)'
+   type_ecri(6) = 'inst(X)'
+
+! Attention a reverifier
+
+        ilev=0        
+        DO k=1, nlevSTD
+     bb2=clevSTD(k)
+     IF(bb2.EQ."850".OR.bb2.EQ."700".OR.bb2.EQ."500".OR.bb2.EQ."200" &
+.OR.bb2.EQ."100".OR.bb2.EQ."50".OR.bb2.EQ."10")THEN
+      ilev=ilev+1
+!     print*,'ilev k bb2 flag name ',ilev,k, bb2,o_uSTDlevs(ilev)%flag,o_uSTDlevs(ilev)%name
+ CALL histdef2d(iff,clef_stations(iff), &
+o_uSTDlevs(ilev)%flag,o_uSTDlevs(ilev)%name,"Zonal wind "//bb2//"hPa", "m/s")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_vSTDlevs(ilev)%flag,o_vSTDlevs(ilev)%name,"Meridional wind "//bb2//"hPa", "m/s")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_wSTDlevs(ilev)%flag,o_wSTDlevs(ilev)%name,"Vertical wind "//bb2//"hPa", "Pa/s")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_zSTDlevs(ilev)%flag,o_zSTDlevs(ilev)%name,"Geopotential height "//bb2//"hPa", "m")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_qSTDlevs(ilev)%flag,o_qSTDlevs(ilev)%name,"Specific humidity "//bb2//"hPa", "kg/kg" )
+ CALL histdef2d(iff,clef_stations(iff), &
+o_tSTDlevs(ilev)%flag,o_tSTDlevs(ilev)%name,"Temperature "//bb2//"hPa", "K")
+     ENDIF !(bb2.EQ."850".OR.bb2.EQ."700".OR."500".OR.bb2.EQ."200".OR.bb2.EQ."50".OR.bb2.EQ."10")
+       ENDDO
+   type_ecri(:) = type_ecri_files(:)
+
+ CALL histdef2d(iff,clef_stations(iff), &
+o_t_oce_sic%flag,o_t_oce_sic%name, "Temp mixte oce-sic", "K")
+
+ IF (type_ocean=='slab') & 
+     CALL histdef2d(iff,clef_stations(iff), &
+o_slab_bils%flag, o_slab_bils%name,"Bilan au sol sur ocean slab", "W/m2")
+
+! Couplage conv-CL
+ IF (iflag_con.GE.3) THEN
+    IF (iflag_coupl>=1) THEN
+ CALL histdef2d(iff,clef_stations(iff), &
+o_ale_bl%flag,o_ale_bl%name, "ALE BL", "m2/s2") 
+ CALL histdef2d(iff,clef_stations(iff), &
+o_alp_bl%flag,o_alp_bl%name, "ALP BL", "m2/s2") 
+    ENDIF
+ ENDIF !(iflag_con.GE.3)
+
+ CALL histdef2d(iff,clef_stations(iff), &
+o_weakinv%flag,o_weakinv%name, "Weak inversion", "-")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_dthmin%flag,o_dthmin%name, "dTheta mini", "K/m")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_rh2m%flag,o_rh2m%name, "Relative humidity at 2m", "%" )
+
+  IF (.NOT.clef_stations(iff)) THEN 
+!
+!IM: there is no way to have one single value in a netcdf file
+!
+   type_ecri(1) = 't_min(X)'
+   type_ecri(2) = 't_min(X)'
+   type_ecri(3) = 't_min(X)'
+   type_ecri(4) = 't_min(X)'
+   type_ecri(5) = 't_min(X)'
+   type_ecri(6) = 't_min(X)'
+   CALL histdef2d(iff,clef_stations(iff),o_rh2m_min%flag,o_rh2m_min%name, "Min Relative humidity at 2m", "%" )
    type_ecri(1) = 't_max(X)'
    type_ecri(2) = 't_max(X)'
@@ -1016,81 +1343,94 @@
    type_ecri(4) = 't_max(X)'
    type_ecri(5) = 't_max(X)'
- CALL histdef2d(iff,o_cape_max%flag,o_cape_max%name, "CAPE max.", "J/kg")
+   type_ecri(6) = 't_max(X)'
+   CALL histdef2d(iff,clef_stations(iff),o_rh2m_max%flag,o_rh2m_max%name, "Max Relative humidity at 2m", "%" )
+  ENDIF  
+
    type_ecri(:) = type_ecri_files(:)
- CALL histdef3d(iff,o_upwd%flag,o_upwd%name, "saturated updraft", "kg/m2/s")
- CALL histdef3d(iff,o_Ma%flag,o_Ma%name, "undilute adiab updraft", "kg/m2/s")
- CALL histdef3d(iff,o_dnwd%flag,o_dnwd%name, "saturated downdraft", "kg/m2/s")
- CALL histdef3d(iff,o_dnwd0%flag,o_dnwd0%name, "unsat. downdraft", "kg/m2/s")
- CALL histdef3d(iff,o_mc%flag,o_mc%name, "Convective mass flux", "kg/m2/s")
-   type_ecri(1) = 'inst(X)'
-   type_ecri(2) = 'inst(X)'
-   type_ecri(3) = 'inst(X)'
-   type_ecri(4) = 'inst(X)'
-   type_ecri(5) = 'inst(X)'
- CALL histdef2d(iff,o_ftime_con%flag,o_ftime_con%name, "Fraction of time convection Occurs", " ")
-   type_ecri(:) = type_ecri_files(:)
-     ENDIF !iflag_con .GE. 3
-
- CALL histdef2d(iff,o_s_pblh%flag,o_s_pblh%name, "Boundary Layer Height", "m")
- CALL histdef2d(iff,o_s_pblt%flag,o_s_pblt%name, "t at Boundary Layer Height", "K")
- CALL histdef2d(iff,o_s_lcl%flag,o_s_lcl%name, "Condensation level", "m")
- CALL histdef2d(iff,o_s_therm%flag,o_s_therm%name, "Exces du thermique", "K")
-!IM : Les champs suivants (s_oliqCL, s_cteiCL, s_trmb1, s_trmb2, s_trmb3) ne sont pas definis dans HBTM.F
-!CALL histdef2d(iff,o_s_capCL%flag,o_s_capCL%name, "Conv avlbl pot enerfor ABL", "J/m2" )
-!CALL histdef2d(iff,o_s_oliqCL%flag,o_s_oliqCL%name, "Liq Water in BL", "kg/m2")
-!CALL histdef2d(iff,o_s_cteiCL%flag,o_s_cteiCL%name, "Instability criteria(ABL)", "K")
-!CALL histdef2d(iff,o_s_trmb1%flag,o_s_trmb1%name, "deep_cape(HBTM2)", "J/m2")
-!CALL histdef2d(iff,o_s_trmb2%flag,o_s_trmb2%name, "inhibition (HBTM2)", "J/m2")
-!CALL histdef2d(iff,o_s_trmb3%flag,o_s_trmb3%name, "Point Omega (HBTM2)", "m")
-
-! Champs interpolles sur des niveaux de pression
-
-   type_ecri(1) = 'inst(X)'
-   type_ecri(2) = 'inst(X)'
-   type_ecri(3) = 'inst(X)'
-   type_ecri(4) = 'inst(X)'
-   type_ecri(5) = 'inst(X)'
-
-! Attention a reverifier
-
-        ilev=0        
-        DO k=1, nlevSTD
-!     IF(k.GE.2.AND.k.LE.12) bb2=clevSTD(k)
-     bb2=clevSTD(k)
-     IF(bb2.EQ."850".OR.bb2.EQ."700".OR.bb2.EQ."500".OR.bb2.EQ."200".OR.bb2.EQ."50".OR.bb2.EQ."10")THEN
-      ilev=ilev+1
-      print*,'ilev k bb2 flag name ',ilev,k, bb2,o_uSTDlevs(ilev)%flag,o_uSTDlevs(ilev)%name
- CALL histdef2d(iff,o_uSTDlevs(ilev)%flag,o_uSTDlevs(ilev)%name,"Zonal wind "//bb2//"hPa", "m/s")
- CALL histdef2d(iff,o_vSTDlevs(ilev)%flag,o_vSTDlevs(ilev)%name,"Meridional wind "//bb2//"hPa", "m/s")
- CALL histdef2d(iff,o_wSTDlevs(ilev)%flag,o_wSTDlevs(ilev)%name,"Vertical wind "//bb2//"hPa", "Pa/s")
- CALL histdef2d(iff,o_zSTDlevs(ilev)%flag,o_zSTDlevs(ilev)%name,"Geopotential height "//bb2//"hPa", "m")
- CALL histdef2d(iff,o_qSTDlevs(ilev)%flag,o_qSTDlevs(ilev)%name,"Specific humidity "//bb2//"hPa", "kg/kg" )
- CALL histdef2d(iff,o_tSTDlevs(ilev)%flag,o_tSTDlevs(ilev)%name,"Temperature "//bb2//"hPa", "K")
-     ENDIF !(bb2.EQ."850".OR.bb2.EQ."700".OR."500".OR.bb2.EQ."200".OR.bb2.EQ."50".OR.bb2.EQ."10")
-       ENDDO
-   type_ecri(:) = type_ecri_files(:)
-
- CALL histdef2d(iff,o_t_oce_sic%flag,o_t_oce_sic%name, "Temp mixte oce-sic", "K")
-
- IF (type_ocean=='slab') & 
-     CALL histdef2d(iff,o_slab_bils%flag, o_slab_bils%name,"Bilan au sol sur ocean slab", "W/m2")
-
-! Couplage conv-CL
- IF (iflag_con.GE.3) THEN
-    IF (iflag_coupl>=1) THEN
- CALL histdef2d(iff,o_ale_bl%flag,o_ale_bl%name, "ALE BL", "m2/s2") 
- CALL histdef2d(iff,o_alp_bl%flag,o_alp_bl%name, "ALP BL", "m2/s2") 
-    ENDIF
- ENDIF !(iflag_con.GE.3)
-
- CALL histdef2d(iff,o_weakinv%flag,o_weakinv%name, "Weak inversion", "-")
- CALL histdef2d(iff,o_dthmin%flag,o_dthmin%name, "dTheta mini", "K/m")
- CALL histdef2d(iff,o_rh2m%flag,o_rh2m%name, "Relative humidity at 2m", "%" )
-   type_ecri(1) = 't_min(X)'
-   type_ecri(2) = 't_min(X)'
-   type_ecri(3) = 't_min(X)'
-   type_ecri(4) = 't_min(X)'
-   type_ecri(5) = 't_min(X)'
- CALL histdef2d(iff,o_rh2m_min%flag,o_rh2m_min%name, "Min Relative humidity at 2m", "%" )
+ CALL histdef2d(iff,clef_stations(iff),o_qsat2m%flag,o_qsat2m%name, "Saturant humidity at 2m", "%")
+ CALL histdef2d(iff,clef_stations(iff),o_tpot%flag,o_tpot%name, "Surface air potential temperature", "K")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_tpote%flag,o_tpote%name, "Surface air equivalent potential temperature", "K")
+ CALL histdef2d(iff,clef_stations(iff),o_SWnetOR%flag,o_SWnetOR%name, "Sfce net SW radiation OR", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_SWdownOR%flag,o_SWdownOR%name, "Sfce incident SW radiation OR", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_LWdownOR%flag,o_LWdownOR%name, "Sfce incident LW radiation OR", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_snowl%flag,o_snowl%name, "Solid Large-scale Precip.", "kg/(m2*s)")
+
+ CALL histdef2d(iff,clef_stations(iff),o_solldown%flag,o_solldown%name, "Down. IR rad. at surface", "W/m2")
+ CALL histdef2d(iff,clef_stations(iff),o_dtsvdfo%flag,o_dtsvdfo%name, "Boundary-layer dTs(o)", "K/s")
+ CALL histdef2d(iff,clef_stations(iff),o_dtsvdft%flag,o_dtsvdft%name, "Boundary-layer dTs(t)", "K/s")
+ CALL histdef2d(iff,clef_stations(iff),o_dtsvdfg%flag,o_dtsvdfg%name, "Boundary-layer dTs(g)", "K/s")
+ CALL histdef2d(iff,clef_stations(iff),o_dtsvdfi%flag,o_dtsvdfi%name, "Boundary-layer dTs(g)", "K/s")
+ CALL histdef2d(iff,clef_stations(iff),o_rugs%flag,o_rugs%name, "rugosity", "-" )
+
+! Champs 3D:
+ CALL histdef3d(iff,clef_stations(iff),o_ec550aer%flag,o_ec550aer%name, "Extinction at 550nm", "m^-1")
+ CALL histdef3d(iff,clef_stations(iff),o_lwcon%flag,o_lwcon%name, "Cloud liquid water content", "kg/kg")
+ CALL histdef3d(iff,clef_stations(iff),o_iwcon%flag,o_iwcon%name, "Cloud ice water content", "kg/kg")
+ CALL histdef3d(iff,clef_stations(iff),o_temp%flag,o_temp%name, "Air temperature", "K" )
+ CALL histdef3d(iff,clef_stations(iff),o_theta%flag,o_theta%name, "Potential air temperature", "K" )
+ CALL histdef3d(iff,clef_stations(iff),o_ovap%flag,o_ovap%name, "Specific humidity", "kg/kg" )
+ CALL histdef3d(iff,clef_stations(iff), &
+o_ovapinit%flag,o_ovapinit%name, "Specific humidity (begin of timestep)", "kg/kg" )
+ CALL histdef3d(iff,clef_stations(iff), &
+o_geop%flag,o_geop%name, "Geopotential height", "m2/s2")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_vitu%flag,o_vitu%name, "Zonal wind", "m/s" )
+ CALL histdef3d(iff,clef_stations(iff), &
+o_vitv%flag,o_vitv%name, "Meridional wind", "m/s" )
+ CALL histdef3d(iff,clef_stations(iff), &
+o_vitw%flag,o_vitw%name, "Vertical wind", "Pa/s" )
+ CALL histdef3d(iff,clef_stations(iff), &
+o_pres%flag,o_pres%name, "Air pressure", "Pa" )
+ CALL histdef3d(iff,clef_stations(iff), &
+o_paprs%flag,o_paprs%name, "Air pressure Inter-Couches", "Pa" )
+ CALL histdef3d(iff,clef_stations(iff), &
+o_mass%flag,o_mass%name, "Masse Couches", "kg/m2" )
+ CALL histdef3d(iff,clef_stations(iff), &
+o_zfull%flag,o_zfull%name, "Altitude of full pressure levels", "m" )
+ CALL histdef3d(iff,clef_stations(iff), &
+o_zhalf%flag,o_zhalf%name, "Altitude of half pressure levels", "m" )
+ CALL histdef3d(iff,clef_stations(iff), &
+o_rneb%flag,o_rneb%name, "Cloud fraction", "-")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_rnebcon%flag,o_rnebcon%name, "Convective Cloud Fraction", "-")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_rhum%flag,o_rhum%name, "Relative humidity", "-")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_ozone%flag,o_ozone%name, "Ozone mole fraction", "-")
+ if (read_climoz == 2) &
+      CALL histdef3d(iff,clef_stations(iff), &
+o_ozone_light%flag,o_ozone_light%name, &
+      "Daylight ozone mole fraction", "-")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dtphy%flag,o_dtphy%name, "Physics dT", "K/s")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dqphy%flag,o_dqphy%name, "Physics dQ", "(kg/kg)/s")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_cldtau%flag,o_cldtau%name, "Cloud optical thickness", "1")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_cldemi%flag,o_cldemi%name, "Cloud optical emissivity", "1")
+!IM: bug ?? dimensionnement variables (klon,klev+1) pmflxr, pmflxs, prfl, psfl
+ CALL histdef3d(iff,clef_stations(iff), &
+o_pr_con_l%flag,o_pr_con_l%name, "Convective precipitation lic", " ")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_pr_con_i%flag,o_pr_con_i%name, "Convective precipitation ice", " ")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_pr_lsc_l%flag,o_pr_lsc_l%name, "Large scale precipitation lic", " ")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_pr_lsc_i%flag,o_pr_lsc_i%name, "Large scale precipitation ice", " ")
+!Cloud droplet effective radius
+ CALL histdef3d(iff,clef_stations(iff), &
+o_re%flag,o_re%name, "Cloud droplet effective radius","um")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_fl%flag,o_fl%name, "Denominator of Cloud droplet effective radius"," ")
+!FH Sorties pour la couche limite
+     if (iflag_pbl>1) then
+ CALL histdef3d(iff,clef_stations(iff), &
+o_tke%flag,o_tke%name, "TKE", "m2/s2")
+  IF (.NOT.clef_stations(iff)) THEN 
+!
+!IM: there is no way to have one single value in a netcdf file
+!
    type_ecri(1) = 't_max(X)'
    type_ecri(2) = 't_max(X)'
@@ -1098,58 +1438,17 @@
    type_ecri(4) = 't_max(X)'
    type_ecri(5) = 't_max(X)'
- CALL histdef2d(iff,o_rh2m_max%flag,o_rh2m_max%name, "Max Relative humidity at 2m", "%" )
+   type_ecri(6) = 't_max(X)'
+   CALL histdef3d(iff,clef_stations(iff), &
+  o_tke_max%flag,o_tke_max%name, "TKE max", "m2/s2")
+  ENDIF 
    type_ecri(:) = type_ecri_files(:)
- CALL histdef2d(iff,o_qsat2m%flag,o_qsat2m%name, "Saturant humidity at 2m", "%")
- CALL histdef2d(iff,o_tpot%flag,o_tpot%name, "Surface air potential temperature", "K")
- CALL histdef2d(iff,o_tpote%flag,o_tpote%name, "Surface air equivalent potential temperature", "K")
- CALL histdef2d(iff,o_SWnetOR%flag,o_SWnetOR%name, "Sfce net SW radiation OR", "W/m2")
- CALL histdef2d(iff,o_SWdownOR%flag,o_SWdownOR%name, "Sfce incident SW radiation OR", "W/m2")
- CALL histdef2d(iff,o_LWdownOR%flag,o_LWdownOR%name, "Sfce incident LW radiation OR", "W/m2")
- CALL histdef2d(iff,o_snowl%flag,o_snowl%name, "Solid Large-scale Precip.", "kg/(m2*s)")
-
- CALL histdef2d(iff,o_solldown%flag,o_solldown%name, "Down. IR rad. at surface", "W/m2")
- CALL histdef2d(iff,o_dtsvdfo%flag,o_dtsvdfo%name, "Boundary-layer dTs(o)", "K/s")
- CALL histdef2d(iff,o_dtsvdft%flag,o_dtsvdft%name, "Boundary-layer dTs(t)", "K/s")
- CALL histdef2d(iff,o_dtsvdfg%flag,o_dtsvdfg%name, "Boundary-layer dTs(g)", "K/s")
- CALL histdef2d(iff,o_dtsvdfi%flag,o_dtsvdfi%name, "Boundary-layer dTs(g)", "K/s")
- CALL histdef2d(iff,o_rugs%flag,o_rugs%name, "rugosity", "-" )
-
-! Champs 3D:
- CALL histdef3d(iff,o_ec550aer%flag,o_ec550aer%name, "Extinction at 550nm", "m^-1")
- CALL histdef3d(iff,o_lwcon%flag,o_lwcon%name, "Cloud liquid water content", "kg/kg")
- CALL histdef3d(iff,o_iwcon%flag,o_iwcon%name, "Cloud ice water content", "kg/kg")
- CALL histdef3d(iff,o_temp%flag,o_temp%name, "Air temperature", "K" )
- CALL histdef3d(iff,o_theta%flag,o_theta%name, "Potential air temperature", "K" )
- CALL histdef3d(iff,o_ovap%flag,o_ovap%name, "Specific humidity", "kg/kg" )
- CALL histdef3d(iff,o_ovapinit%flag,o_ovapinit%name, "Specific humidity (begin of timestep)", "kg/kg" )
- CALL histdef3d(iff,o_geop%flag,o_geop%name, "Geopotential height", "m2/s2")
- CALL histdef3d(iff,o_vitu%flag,o_vitu%name, "Zonal wind", "m/s" )
- CALL histdef3d(iff,o_vitv%flag,o_vitv%name, "Meridional wind", "m/s" )
- CALL histdef3d(iff,o_vitw%flag,o_vitw%name, "Vertical wind", "Pa/s" )
- CALL histdef3d(iff,o_pres%flag,o_pres%name, "Air pressure", "Pa" )
- CALL histdef3d(iff,o_paprs%flag,o_paprs%name, "Air pressure Inter-Couches", "Pa" )
- CALL histdef3d(iff,o_mass%flag,o_mass%name, "Masse Couches", "kg/m2" )
- CALL histdef3d(iff,o_rneb%flag,o_rneb%name, "Cloud fraction", "-")
- CALL histdef3d(iff,o_rnebcon%flag,o_rnebcon%name, "Convective Cloud Fraction", "-")
- CALL histdef3d(iff,o_rhum%flag,o_rhum%name, "Relative humidity", "-")
- CALL histdef3d(iff,o_ozone%flag,o_ozone%name, "Ozone mole fraction", "-")
- if (read_climoz == 2) &
-      CALL histdef3d(iff,o_ozone_light%flag,o_ozone_light%name, &
-      "Daylight ozone mole fraction", "-")
- CALL histdef3d(iff,o_dtphy%flag,o_dtphy%name, "Physics dT", "K/s")
- CALL histdef3d(iff,o_dqphy%flag,o_dqphy%name, "Physics dQ", "(kg/kg)/s")
- CALL histdef3d(iff,o_cldtau%flag,o_cldtau%name, "Cloud optical thickness", "1")
- CALL histdef3d(iff,o_cldemi%flag,o_cldemi%name, "Cloud optical emissivity", "1")
-!IM: bug ?? dimensionnement variables (klon,klev+1) pmflxr, pmflxs, prfl, psfl
- CALL histdef3d(iff,o_pr_con_l%flag,o_pr_con_l%name, "Convective precipitation lic", " ")
- CALL histdef3d(iff,o_pr_con_i%flag,o_pr_con_i%name, "Convective precipitation ice", " ")
- CALL histdef3d(iff,o_pr_lsc_l%flag,o_pr_lsc_l%name, "Large scale precipitation lic", " ")
- CALL histdef3d(iff,o_pr_lsc_i%flag,o_pr_lsc_i%name, "Large scale precipitation ice", " ")
-!Cloud droplet effective radius
- CALL histdef3d(iff,o_re%flag,o_re%name, "Cloud droplet effective radius","um")
- CALL histdef3d(iff,o_fl%flag,o_fl%name, "Denominator of Cloud droplet effective radius"," ")
-!FH Sorties pour la couche limite
-     if (iflag_pbl>1) then
- CALL histdef3d(iff,o_tke%flag,o_tke%name, "TKE", "m2/s2")
+     endif
+
+ CALL histdef3d(iff,clef_stations(iff), &
+o_kz%flag,o_kz%name, "Kz melange", "m2/s")
+  IF (.NOT.clef_stations(iff)) THEN 
+!
+!IM: there is no way to have one single value in a netcdf file
+!
    type_ecri(1) = 't_max(X)'
    type_ecri(2) = 't_max(X)'
@@ -1157,99 +1456,233 @@
    type_ecri(4) = 't_max(X)'
    type_ecri(5) = 't_max(X)'
- CALL histdef3d(iff,o_tke_max%flag,o_tke_max%name, "TKE max", "m2/s2")
+   type_ecri(6) = 't_max(X)'
+   CALL histdef3d(iff,clef_stations(iff), &
+   o_kz_max%flag,o_kz_max%name, "Kz melange max", "m2/s" )
+  ENDIF
    type_ecri(:) = type_ecri_files(:)
-     endif
-
- CALL histdef3d(iff,o_kz%flag,o_kz%name, "Kz melange", "m2/s")
-   type_ecri(1) = 't_max(X)'
-   type_ecri(2) = 't_max(X)'
-   type_ecri(3) = 't_max(X)'
-   type_ecri(4) = 't_max(X)'
-   type_ecri(5) = 't_max(X)'
- CALL histdef3d(iff,o_kz_max%flag,o_kz_max%name, "Kz melange max", "m2/s" )
-   type_ecri(:) = type_ecri_files(:)
- CALL histdef3d(iff,o_clwcon%flag,o_clwcon%name, "Convective Cloud Liquid water content", "kg/kg") 
- CALL histdef3d(iff,o_dtdyn%flag,o_dtdyn%name, "Dynamics dT", "K/s")
- CALL histdef3d(iff,o_dqdyn%flag,o_dqdyn%name, "Dynamics dQ", "(kg/kg)/s")
- CALL histdef3d(iff,o_dudyn%flag,o_dudyn%name, "Dynamics dU", "m/s2")
- CALL histdef3d(iff,o_dvdyn%flag,o_dvdyn%name, "Dynamics dV", "m/s2")
- CALL histdef3d(iff,o_dtcon%flag,o_dtcon%name, "Convection dT", "K/s")
- CALL histdef3d(iff,o_ducon%flag,o_ducon%name, "Convection du", "m/s2")
- CALL histdef3d(iff,o_dqcon%flag,o_dqcon%name, "Convection dQ", "(kg/kg)/s")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_clwcon%flag,o_clwcon%name, "Convective Cloud Liquid water content", "kg/kg") 
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dtdyn%flag,o_dtdyn%name, "Dynamics dT", "K/s")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dqdyn%flag,o_dqdyn%name, "Dynamics dQ", "(kg/kg)/s")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dudyn%flag,o_dudyn%name, "Dynamics dU", "m/s2")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dvdyn%flag,o_dvdyn%name, "Dynamics dV", "m/s2")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dtcon%flag,o_dtcon%name, "Convection dT", "K/s")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_ducon%flag,o_ducon%name, "Convection du", "m/s2")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dqcon%flag,o_dqcon%name, "Convection dQ", "(kg/kg)/s")
 
 ! Wakes
  IF(iflag_con.EQ.3) THEN
  IF (iflag_wake >= 1) THEN
-   CALL histdef2d(iff,o_ale_wk%flag,o_ale_wk%name, "ALE WK", "m2/s2")
-   CALL histdef2d(iff,o_alp_wk%flag,o_alp_wk%name, "ALP WK", "m2/s2")
-   CALL histdef2d(iff,o_ale%flag,o_ale%name, "ALE", "m2/s2")
-   CALL histdef2d(iff,o_alp%flag,o_alp%name, "ALP", "W/m2")
-   CALL histdef2d(iff,o_cin%flag,o_cin%name, "Convective INhibition", "m2/s2")
-   CALL histdef2d(iff,o_wape%flag,o_WAPE%name, "WAPE", "m2/s2")
-   CALL histdef2d(iff,o_wake_h%flag,o_wake_h%name, "wake_h", "-")
-   CALL histdef2d(iff,o_wake_s%flag,o_wake_s%name, "wake_s", "-")
-   CALL histdef3d(iff,o_dtwak%flag,o_dtwak%name, "Wake dT", "K/s")
-   CALL histdef3d(iff,o_dqwak%flag,o_dqwak%name, "Wake dQ", "(kg/kg)/s")
-   CALL histdef3d(iff,o_wake_deltat%flag,o_wake_deltat%name, "wake_deltat", " ")
-   CALL histdef3d(iff,o_wake_deltaq%flag,o_wake_deltaq%name, "wake_deltaq", " ")
-   CALL histdef3d(iff,o_wake_omg%flag,o_wake_omg%name, "wake_omg", " ")
+   CALL histdef2d(iff,clef_stations(iff), &
+o_ale_wk%flag,o_ale_wk%name, "ALE WK", "m2/s2")
+   CALL histdef2d(iff,clef_stations(iff), &
+o_alp_wk%flag,o_alp_wk%name, "ALP WK", "m2/s2")
+   CALL histdef2d(iff,clef_stations(iff), &
+o_ale%flag,o_ale%name, "ALE", "m2/s2")
+   CALL histdef2d(iff,clef_stations(iff), &
+o_alp%flag,o_alp%name, "ALP", "W/m2")
+   CALL histdef2d(iff,clef_stations(iff),o_cin%flag,o_cin%name, "Convective INhibition", "m2/s2")
+   CALL histdef2d(iff,clef_stations(iff),o_wape%flag,o_WAPE%name, "WAPE", "m2/s2")
+   CALL histdef2d(iff,clef_stations(iff),o_wake_h%flag,o_wake_h%name, "wake_h", "-")
+   CALL histdef2d(iff,clef_stations(iff),o_wake_s%flag,o_wake_s%name, "wake_s", "-")
+   CALL histdef3d(iff,clef_stations(iff),o_dtwak%flag,o_dtwak%name, "Wake dT", "K/s")
+   CALL histdef3d(iff,clef_stations(iff),o_dqwak%flag,o_dqwak%name, "Wake dQ", "(kg/kg)/s")
+   CALL histdef3d(iff,clef_stations(iff),o_wake_deltat%flag,o_wake_deltat%name, "wake_deltat", " ")
+   CALL histdef3d(iff,clef_stations(iff),o_wake_deltaq%flag,o_wake_deltaq%name, "wake_deltaq", " ")
+   CALL histdef3d(iff,clef_stations(iff),o_wake_omg%flag,o_wake_omg%name, "wake_omg", " ")
  ENDIF
-   CALL histdef3d(iff,o_Vprecip%flag,o_Vprecip%name, "precipitation vertical profile", "-")
-   CALL histdef3d(iff,o_ftd%flag,o_ftd%name, "tend temp due aux descentes precip", "-")
-   CALL histdef3d(iff,o_fqd%flag,o_fqd%name,"tend vap eau due aux descentes precip", "-")
+   CALL histdef3d(iff,clef_stations(iff),o_Vprecip%flag,o_Vprecip%name, "precipitation vertical profile", "-")
+   CALL histdef3d(iff,clef_stations(iff),o_ftd%flag,o_ftd%name, "tend temp due aux descentes precip", "-")
+   CALL histdef3d(iff,clef_stations(iff),o_fqd%flag,o_fqd%name,"tend vap eau due aux descentes precip", "-")
  ENDIF !(iflag_con.EQ.3)
 
- CALL histdef3d(iff,o_dtlsc%flag,o_dtlsc%name, "Condensation dT", "K/s")
- CALL histdef3d(iff,o_dtlschr%flag,o_dtlschr%name,"Large-scale condensational heating rate","K/s")
- CALL histdef3d(iff,o_dqlsc%flag,o_dqlsc%name, "Condensation dQ", "(kg/kg)/s")
- CALL histdef3d(iff,o_dtvdf%flag,o_dtvdf%name, "Boundary-layer dT", "K/s")
- CALL histdef3d(iff,o_dqvdf%flag,o_dqvdf%name, "Boundary-layer dQ", "(kg/kg)/s") 
- CALL histdef3d(iff,o_dteva%flag,o_dteva%name, "Reevaporation dT", "K/s")
- CALL histdef3d(iff,o_dqeva%flag,o_dqeva%name, "Reevaporation dQ", "(kg/kg)/s")
- CALL histdef3d(iff,o_ptconv%flag,o_ptconv%name, "POINTS CONVECTIFS", " ")
- CALL histdef3d(iff,o_ratqs%flag,o_ratqs%name, "RATQS", " ")
- CALL histdef3d(iff,o_dtthe%flag,o_dtthe%name, "Dry adjust. dT", "K/s")
+ CALL histdef3d(iff,clef_stations(iff),o_dtlsc%flag,o_dtlsc%name, "Condensation dT", "K/s")
+ CALL histdef3d(iff,clef_stations(iff),o_dtlschr%flag,o_dtlschr%name,"Large-scale condensational heating rate","K/s")
+ CALL histdef3d(iff,clef_stations(iff),o_dqlsc%flag,o_dqlsc%name, "Condensation dQ", "(kg/kg)/s")
+ CALL histdef3d(iff,clef_stations(iff),o_dtvdf%flag,o_dtvdf%name, "Boundary-layer dT", "K/s")
+ CALL histdef3d(iff,clef_stations(iff),o_dqvdf%flag,o_dqvdf%name, "Boundary-layer dQ", "(kg/kg)/s") 
+ CALL histdef3d(iff,clef_stations(iff),o_dteva%flag,o_dteva%name, "Reevaporation dT", "K/s")
+ CALL histdef3d(iff,clef_stations(iff),o_dqeva%flag,o_dqeva%name, "Reevaporation dQ", "(kg/kg)/s")
+ CALL histdef3d(iff,clef_stations(iff),o_ptconv%flag,o_ptconv%name, "POINTS CONVECTIFS", " ")
+ CALL histdef3d(iff,clef_stations(iff),o_ratqs%flag,o_ratqs%name, "RATQS", " ")
+ CALL histdef3d(iff,clef_stations(iff),o_dtthe%flag,o_dtthe%name, "Thermal dT", "K/s")
 
 if(iflag_thermals.gt.1) THEN
- CALL histdef3d(iff,o_dqlscth%flag,o_dqlscth%name, "dQ therm.", "(kg/kg)/s")
- CALL histdef3d(iff,o_dqlscst%flag,o_dqlscst%name, "dQ strat.", "(kg/kg)/s")
- CALL histdef3d(iff,o_dtlscth%flag,o_dtlscth%name, "dQ therm.", "K/s")
- CALL histdef3d(iff,o_dtlscst%flag,o_dtlscst%name, "dQ strat.", "K/s")
- CALL histdef2d(iff,o_plulth%flag,o_plulth%name, "Rainfall therm.", "K/s")
- CALL histdef2d(iff,o_plulst%flag,o_plulst%name, "Rainfall strat.", "K/s")
- CALL histdef2d(iff,o_lmaxth%flag,o_lmaxth%name, "Upper level thermals", "")
- CALL histdef3d(iff,o_ptconvth%flag,o_ptconvth%name, "POINTS CONVECTIFS therm.", " ")
- CALL histdef3d(iff,o_f_th%flag,o_f_th%name, "Thermal plume mass flux", "K/s")
- CALL histdef3d(iff,o_e_th%flag,o_e_th%name,"Thermal plume entrainment","K/s")
- CALL histdef3d(iff,o_w_th%flag,o_w_th%name,"Thermal plume vertical velocity","m/s")
- CALL histdef3d(iff,o_lambda_th%flag,o_lambda_th%name,"Thermal plume vertical velocity","m/s")
- CALL histdef2d(iff,o_ftime_th%flag,o_ftime_th%name,"Fraction of time Shallow convection occurs"," ")
- CALL histdef3d(iff,o_q_th%flag,o_q_th%name, "Thermal plume total humidity", "kg/kg")
- CALL histdef3d(iff,o_a_th%flag,o_a_th%name, "Thermal plume fraction", "")
- CALL histdef3d(iff,o_d_th%flag,o_d_th%name, "Thermal plume detrainment", "K/s")
-!IM endif !iflag_thermals.gt.1
- CALL histdef2d(iff,o_f0_th%flag,o_f0_th%name, "Thermal closure mass flux", "K/s")
- CALL histdef2d(iff,o_zmax_th%flag,o_zmax_th%name, "Thermal plume height", "K/s")
- CALL histdef3d(iff,o_dqthe%flag,o_dqthe%name, "Dry adjust. dQ", "(kg/kg)/s")
+ CALL histdef3d(iff,clef_stations(iff),o_dqlscth%flag,o_dqlscth%name, "dQ therm.", "(kg/kg)/s")
+ CALL histdef3d(iff,clef_stations(iff),o_dqlscst%flag,o_dqlscst%name, "dQ strat.", "(kg/kg)/s")
+ CALL histdef3d(iff,clef_stations(iff),o_dtlscth%flag,o_dtlscth%name, "dQ therm.", "K/s")
+ CALL histdef3d(iff,clef_stations(iff),o_dtlscst%flag,o_dtlscst%name, "dQ strat.", "K/s")
+ CALL histdef2d(iff,clef_stations(iff),o_plulth%flag,o_plulth%name, "Rainfall therm.", "K/s")
+ CALL histdef2d(iff,clef_stations(iff),o_plulst%flag,o_plulst%name, "Rainfall strat.", "K/s")
+ CALL histdef2d(iff,clef_stations(iff),o_lmaxth%flag,o_lmaxth%name, "Upper level thermals", "")
+ CALL histdef3d(iff,clef_stations(iff),o_ptconvth%flag,o_ptconvth%name, "POINTS CONVECTIFS therm.", " ")
+ CALL histdef3d(iff,clef_stations(iff),o_f_th%flag,o_f_th%name, "Thermal plume mass flux", "kg/(m2*s)")
+ CALL histdef3d(iff,clef_stations(iff),o_e_th%flag,o_e_th%name,"Thermal plume entrainment","K/s")
+ CALL histdef3d(iff,clef_stations(iff),o_w_th%flag,o_w_th%name,"Thermal plume vertical velocity","m/s")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_lambda_th%flag,o_lambda_th%name,"Thermal plume vertical velocity","m/s")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_ftime_th%flag,o_ftime_th%name,"Fraction of time Shallow convection occurs"," ")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_q_th%flag,o_q_th%name, "Thermal plume total humidity", "kg/kg")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_a_th%flag,o_a_th%name, "Thermal plume fraction", "")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_d_th%flag,o_d_th%name, "Thermal plume detrainment", "K/s")
+
+ CALL histdef2d(iff,clef_stations(iff), &
+o_f0_th%flag,o_f0_th%name, "Thermal closure mass flux", "K/s")
+ CALL histdef2d(iff,clef_stations(iff), &
+o_zmax_th%flag,o_zmax_th%name, "Thermal plume height", "K/s")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dqthe%flag,o_dqthe%name, "Thermal dQ", "(kg/kg)/s")
 endif !iflag_thermals.gt.1
- CALL histdef3d(iff,o_dtajs%flag,o_dtajs%name, "Dry adjust. dT", "K/s")
- CALL histdef3d(iff,o_dqajs%flag,o_dqajs%name, "Dry adjust. dQ", "(kg/kg)/s")
- CALL histdef3d(iff,o_dtswr%flag,o_dtswr%name, "SW radiation dT", "K/s")
- CALL histdef3d(iff,o_dtsw0%flag,o_dtsw0%name, "CS SW radiation dT", "K/s")
- CALL histdef3d(iff,o_dtlwr%flag,o_dtlwr%name, "LW radiation dT", "K/s")
- CALL histdef3d(iff,o_dtlw0%flag,o_dtlw0%name, "CS LW radiation dT", "K/s")
- CALL histdef3d(iff,o_dtec%flag,o_dtec%name, "Cinetic dissip dT", "K/s")
- CALL histdef3d(iff,o_duvdf%flag,o_duvdf%name, "Boundary-layer dU", "m/s2")
- CALL histdef3d(iff,o_dvvdf%flag,o_dvvdf%name, "Boundary-layer dV", "m/s2")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dtajs%flag,o_dtajs%name, "Dry adjust. dT", "K/s")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dqajs%flag,o_dqajs%name, "Dry adjust. dQ", "(kg/kg)/s")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dtswr%flag,o_dtswr%name, "SW radiation dT", "K/s")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dtsw0%flag,o_dtsw0%name, "CS SW radiation dT", "K/s")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dtlwr%flag,o_dtlwr%name, "LW radiation dT", "K/s")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dtlw0%flag,o_dtlw0%name, "CS LW radiation dT", "K/s")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dtec%flag,o_dtec%name, "Cinetic dissip dT", "K/s")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_duvdf%flag,o_duvdf%name, "Boundary-layer dU", "m/s2")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dvvdf%flag,o_dvvdf%name, "Boundary-layer dV", "m/s2")
 
      IF (ok_orodr) THEN
- CALL histdef3d(iff,o_duoro%flag,o_duoro%name, "Orography dU", "m/s2")
- CALL histdef3d(iff,o_dvoro%flag,o_dvoro%name, "Orography dV", "m/s2")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_duoro%flag,o_duoro%name, "Orography dU", "m/s2")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dvoro%flag,o_dvoro%name, "Orography dV", "m/s2")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dtoro%flag,o_dtoro%name, "Orography dT", "K/s")
      ENDIF
 
      IF (ok_orolf) THEN
- CALL histdef3d(iff,o_dulif%flag,o_dulif%name, "Orography dU", "m/s2")
- CALL histdef3d(iff,o_dvlif%flag,o_dvlif%name, "Orography dV", "m/s2")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dulif%flag,o_dulif%name, "Orography dU", "m/s2")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dvlif%flag,o_dvlif%name, "Orography dV", "m/s2")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dtlif%flag,o_dtlif%name, "Orography dT", "K/s")
      ENDIF
+
+     IF (ok_hines) then
+ CALL histdef3d(iff,clef_stations(iff), &
+o_duhin%flag,o_duhin%name, "Hines GWD dU", "m/s2")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dvhin%flag,o_dvhin%name, "Hines GWD dV", "m/s2")
+
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dthin%flag,o_dthin%name, "Hines GWD dT", "K/s")
+     ENDIF
+
+ CALL histdef3d(iff,clef_stations(iff), &
+o_rsu%flag,o_rsu%name, "SW upward radiation", "W m-2")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_rsd%flag,o_rsd%name, "SW downward radiation", "W m-2")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_rlu%flag,o_rlu%name, "LW upward radiation", "W m-2")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_rld%flag,o_rld%name, "LW downward radiation", "W m-2")
+
+ CALL histdef3d(iff,clef_stations(iff), &
+o_rsucs%flag,o_rsucs%name, "SW CS upward radiation", "W m-2")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_rsdcs%flag,o_rsdcs%name, "SW CS downward radiation", "W m-2")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_rlucs%flag,o_rlucs%name, "LW CS upward radiation", "W m-2")
+ CALL histdef3d(iff,clef_stations(iff), &
+o_rldcs%flag,o_rldcs%name, "LW CS downward radiation", "W m-2")
+ 
+ CALL histdef3d(iff,clef_stations(iff), &
+o_tnt%flag,o_tnt%name, "Tendency of air temperature", "K s-1")
+
+ CALL histdef3d(iff,clef_stations(iff), &
+o_tntc%flag,o_tntc%name, "Tendency of air temperature due to Moist Convection", &
+"K s-1")
+
+ CALL histdef3d(iff,clef_stations(iff), &
+o_tntr%flag,o_tntr%name, "Air temperature tendency due to Radiative heating", &
+"K s-1")
+
+ CALL histdef3d(iff,clef_stations(iff), &
+o_tntscpbl%flag,o_tntscpbl%name, "Air temperature tendency due to St cloud and precipitation and BL mixing", &
+"K s-1")
+
+ CALL histdef3d(iff,clef_stations(iff), &
+o_tnhus%flag,o_tnhus%name, "Tendency of specific humidity", "s-1")
+
+ CALL histdef3d(iff,clef_stations(iff), &
+o_tnhusc%flag,o_tnhusc%name, "Tendency of specific humidity due to convection", "s-1")
+
+ CALL histdef3d(iff,clef_stations(iff), &
+o_tnhusscpbl%flag,o_tnhusscpbl%name, "Tendency of Specific humidity due to ST cl, precip and BL mixing", &
+"s-1")
+
+ CALL histdef3d(iff,clef_stations(iff), &
+o_evu%flag,o_evu%name, "Eddy viscosity coefficient for Momentum Variables", "m2 s-1")
+
+ CALL histdef3d(iff,clef_stations(iff), &
+o_h2o%flag,o_h2o%name, "Mass Fraction of Water", "1")
+
+ CALL histdef3d(iff,clef_stations(iff), &
+o_mcd%flag,o_mcd%name, "Downdraft COnvective Mass Flux", "kg/(m2*s)")
+
+ CALL histdef3d(iff,clef_stations(iff), &
+o_dmc%flag,o_dmc%name, "Deep COnvective Mass Flux", "kg/(m2*s)")
+
+ CALL histdef3d(iff,clef_stations(iff), &
+o_ref_liq%flag,o_ref_liq%name, "Effective radius of convective cloud liquid water particle", "m")
+
+ CALL histdef3d(iff,clef_stations(iff), &
+o_ref_ice%flag,o_ref_ice%name, "Effective radius of startiform cloud ice particle", "m")
+
+   if (RCO2_per.NE.RCO2_act.OR.RCH4_per.NE.RCH4_act.OR. &
+    RN2O_per.NE.RN2O_act.OR.RCFC11_per.NE.RCFC11_act.OR. &
+    RCFC12_per.NE.RCFC12_act) THEN
+
+ CALL histdef2d(iff,clef_stations(iff),o_rsut4co2%flag,o_rsut4co2%name, &
+ "TOA Out SW in 4xCO2 atmosphere", "W/m2") 
+CALL histdef2d(iff,clef_stations(iff),o_rlut4co2%flag,o_rlut4co2%name, &
+"TOA Out LW in 4xCO2 atmosphere", "W/m2") 
+CALL histdef2d(iff,clef_stations(iff),o_rsutcs4co2%flag,o_rsutcs4co2%name, &
+"TOA Out CS SW in 4xCO2 atmosphere", "W/m2") 
+CALL histdef2d(iff,clef_stations(iff),o_rlutcs4co2%flag,o_rlutcs4co2%name, &
+"TOA Out CS LW in 4xCO2 atmosphere", "W/m2") 
+
+CALL histdef3d(iff,clef_stations(iff),o_rsu4co2%flag,o_rsu4co2%name, &
+"Upwelling SW 4xCO2 atmosphere", "W/m2") 
+CALL histdef3d(iff,clef_stations(iff),o_rlu4co2%flag,o_rlu4co2%name, &
+"Upwelling LW 4xCO2 atmosphere", "W/m2") 
+CALL histdef3d(iff,clef_stations(iff),o_rsucs4co2%flag,o_rsucs4co2%name, &
+"Upwelling CS SW 4xCO2 atmosphere", "W/m2") 
+CALL histdef3d(iff,clef_stations(iff),o_rlucs4co2%flag,o_rlucs4co2%name, &
+"Upwelling CS LW 4xCO2 atmosphere", "W/m2") 
+
+ CALL histdef3d(iff,clef_stations(iff),o_rsd4co2%flag,o_rsd4co2%name, &
+ "Downwelling SW 4xCO2 atmosphere", "W/m2") 
+ CALL histdef3d(iff,clef_stations(iff),o_rld4co2%flag,o_rld4co2%name, &
+"Downwelling LW 4xCO2 atmosphere", "W/m2") 
+ CALL histdef3d(iff,clef_stations(iff),o_rsdcs4co2%flag,o_rsdcs4co2%name, &
+"Downwelling CS SW 4xCO2 atmosphere", "W/m2") 
+ CALL histdef3d(iff,clef_stations(iff),o_rldcs4co2%flag,o_rldcs4co2%name, &
+"Downwelling CS LW 4xCO2 atmosphere", "W/m2") 
+
+   endif
 
 
@@ -1257,6 +1690,7 @@
      DO iq=3,nqtot  
        iiq=niadv(iq)
-       o_trac(iq-2) = ctrl_out((/ 4, 5, 1, 1, 1 /),tname(iiq))
-       CALL histdef3d (iff, o_trac(iq-2)%flag,o_trac(iq-2)%name,'Tracer '//ttext(iiq), "-" )
+       o_trac(iq-2) = ctrl_out((/ 4, 5, 1, 1, 1, 10 /),tname(iiq))
+       CALL histdef3d (iff,clef_stations(iff), &
+ o_trac(iq-2)%flag,o_trac(iq-2)%name,'Tracer '//ttext(iiq), "-" )
      ENDDO
     ENDIF
@@ -1273,9 +1707,10 @@
       end subroutine phys_output_open
 
-      SUBROUTINE histdef2d (iff,flag_var,nomvar,titrevar,unitvar)
+      SUBROUTINE histdef2d (iff,lpoint,flag_var,nomvar,titrevar,unitvar)
       
        use ioipsl
        USE dimphy
        USE mod_phys_lmdz_para
+       USE iophy
 
        IMPLICIT NONE
@@ -1287,4 +1722,5 @@
 
        integer                          :: iff
+       logical                          :: lpoint
        integer, dimension(nfiles)       :: flag_var
        character(len=20)                 :: nomvar
@@ -1302,5 +1738,6 @@
 ! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
        call conf_physoutputs(nomvar,flag_var)
-       
+      
+       if(.NOT.lpoint) THEN  
        if ( flag_var(iff)<=lev_files(iff) ) then
  call histdef (nid_files(iff),nomvar,titrevar,unitvar, &
@@ -1308,11 +1745,19 @@
                type_ecri(iff), zstophym,zoutm(iff))                
        endif                      
+       else
+       if ( flag_var(iff)<=lev_files(iff) ) then
+ call histdef (nid_files(iff),nomvar,titrevar,unitvar, &
+               npstn,1,nhorim(iff), 1,1,1, -99, 32, &
+               type_ecri(iff), zstophym,zoutm(iff))                
+       endif                      
+       endif                      
       end subroutine histdef2d
 
-      SUBROUTINE histdef3d (iff,flag_var,nomvar,titrevar,unitvar)
+      SUBROUTINE histdef3d (iff,lpoint,flag_var,nomvar,titrevar,unitvar)
 
        use ioipsl
        USE dimphy
        USE mod_phys_lmdz_para
+       USE iophy
 
        IMPLICIT NONE
@@ -1324,4 +1769,5 @@
 
        integer                          :: iff
+       logical                          :: lpoint
        integer, dimension(nfiles)       :: flag_var
        character(len=20)                 :: nomvar
@@ -1340,4 +1786,5 @@
        endif
 
+       if(.NOT.lpoint) THEN
        if ( flag_var(iff)<=lev_files(iff) ) then
           call histdef (nid_files(iff), nomvar, titrevar, unitvar, &
@@ -1345,4 +1792,12 @@
                levmax(iff)-levmin(iff)+1, nvertm(iff), 32, type_ecri(iff), &
                zstophym, zoutm(iff))
+       endif
+       else
+       if ( flag_var(iff)<=lev_files(iff) ) then
+          call histdef (nid_files(iff), nomvar, titrevar, unitvar, &
+               npstn,1,nhorim(iff), klev, levmin(iff), &
+               levmax(iff)-levmin(iff)+1, nvertm(iff), 32, &
+               type_ecri(iff), zstophym,zoutm(iff))
+       endif
        endif
       end subroutine histdef3d
Index: /LMDZ5/trunk/libf/phylmd/phys_output_write.h
===================================================================
--- /LMDZ5/trunk/libf/phylmd/phys_output_write.h	(revision 1538)
+++ /LMDZ5/trunk/libf/phylmd/phys_output_write.h	(revision 1539)
@@ -9,10 +9,12 @@
 !!! Champs 1D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        IF (o_phis%flag(iff)<=lev_files(iff)) THEN 
-         CALL histwrite_phy(nid_files(iff),
-     $                      o_phis%name,itau_w,pphis)
-       ENDIF
-
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $                  o_phis%name,itau_w,pphis)
+       ENDIF
+
+       IF (.NOT.clef_stations(iff)) THEN
        IF (o_aire%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_aire%name,itau_w,airephy)
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_aire%name,itau_w,airephy)
        ENDIF
 
@@ -21,15 +23,16 @@
        zx_tmp_fi2d(i)=pctsrf(i,is_ter)+pctsrf(i,is_lic)
       ENDDO
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $             o_contfracATM%name,itau_w,zx_tmp_fi2d)
        ENDIF
+       ENDIF
 
        IF (o_contfracOR%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_contfracOR%name,itau_w,
-     $                   pctsrf(:,is_ter))
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $                  o_contfracOR%name,itau_w,pctsrf(:,is_ter))
        ENDIF
 
        IF (o_aireTER%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                  o_aireTER%name,itau_w,paire_ter)
        ENDIF
@@ -38,25 +41,33 @@
 
        IF (o_flat%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_flat%name,itau_w,zxfluxlat)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $                  o_flat%name,itau_w,zxfluxlat)
        ENDIF
 
        IF (o_slp%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_slp%name,itau_w,slp)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $                  o_slp%name,itau_w,slp)
        ENDIF
 
        IF (o_tsol%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_tsol%name,itau_w,zxtsol)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $                  o_tsol%name,itau_w,zxtsol)
        ENDIF
 
        IF (o_t2m%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_t2m%name,itau_w,zt2m)
-       ENDIF
-
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $                  o_t2m%name,itau_w,zt2m)
+       ENDIF
+
+      IF (.NOT.clef_stations(iff)) THEN
        IF (o_t2m_min%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_t2m_min%name,itau_w,zt2m)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_t2m_min%name,itau_w,zt2m)
        ENDIF
 
        IF (o_t2m_max%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_t2m_max%name,itau_w,zt2m)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_t2m_max%name,itau_w,zt2m)
+       ENDIF
        ENDIF
 
@@ -65,15 +76,17 @@
        zx_tmp_fi2d(i)=SQRT(zu10m(i)*zu10m(i)+zv10m(i)*zv10m(i))
       ENDDO
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                  o_wind10m%name,itau_w,zx_tmp_fi2d)
        ENDIF
 
+      IF (.NOT.clef_stations(iff)) THEN
        IF (o_wind10max%flag(iff)<=lev_files(iff)) THEN
       DO i=1, klon
        zx_tmp_fi2d(i)=SQRT(zu10m(i)*zu10m(i)+zv10m(i)*zv10m(i))
       ENDDO
-      CALL histwrite_phy(nid_files(iff),o_wind10max%name, 
-     $                   itau_w,zx_tmp_fi2d)
-       ENDIF
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_wind10max%name,itau_w,zx_tmp_fi2d)
+       ENDIF
+      ENDIF
 
        IF (o_sicf%flag(iff)<=lev_files(iff)) THEN
@@ -81,18 +94,21 @@
          zx_tmp_fi2d(i) = pctsrf(i,is_sic)
       ENDDO
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                   o_sicf%name,itau_w,zx_tmp_fi2d)
        ENDIF
 
        IF (o_q2m%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_q2m%name,itau_w,zq2m)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_q2m%name,itau_w,zq2m)
        ENDIF
 
        IF (o_u10m%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_u10m%name,itau_w,zu10m)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_u10m%name,itau_w,zu10m)
        ENDIF
 
        IF (o_v10m%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_v10m%name,itau_w,zv10m)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_v10m%name,itau_w,zv10m)
        ENDIF
 
@@ -101,20 +117,23 @@
          zx_tmp_fi2d(i) = paprs(i,1)
       ENDDO
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                   o_psol%name,itau_w,zx_tmp_fi2d)
        ENDIF
 
        IF (o_mass%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_mass%name,itau_w,zmasse)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     s                   o_mass%name,itau_w,zmasse)
         ENDIF
 
 
        IF (o_qsurf%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_qsurf%name,itau_w,zxqsurf)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_qsurf%name,itau_w,zxqsurf)
        ENDIF
 
        if (.not. ok_veget) then
          IF (o_qsol%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_qsol%name,itau_w,qsol)
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_qsol%name,itau_w,qsol)
          ENDIF
        endif
@@ -124,11 +143,11 @@
          zx_tmp_fi2d(i) = rain_fall(i) + snow_fall(i)
        ENDDO
-      CALL histwrite_phy(nid_files(iff),o_precip%name,
-     s                   itau_w,zx_tmp_fi2d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_precip%name,itau_w,zx_tmp_fi2d)
       ENDIF
 
        IF (o_ndayrain%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_ndayrain%name,
-     s                   itau_w,nday_rain)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_ndayrain%name,itau_w,nday_rain)
        ENDIF
 
@@ -137,5 +156,6 @@
          zx_tmp_fi2d(i) = rain_lsc(i) + snow_lsc(i)
        ENDDO
-      CALL histwrite_phy(nid_files(iff),o_plul%name,itau_w,zx_tmp_fi2d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_plul%name,itau_w,zx_tmp_fi2d)
       ENDIF
 
@@ -144,48 +164,57 @@
          zx_tmp_fi2d(i) = rain_con(i) + snow_con(i)
       ENDDO
-      CALL histwrite_phy(nid_files(iff),o_pluc%name,itau_w,zx_tmp_fi2d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_pluc%name,itau_w,zx_tmp_fi2d)
       ENDIF
 
        IF (o_snow%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_snow%name,itau_w,snow_fall)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_snow%name,itau_w,snow_fall)
        ENDIF
 
        IF (o_msnow%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_msnow%name,itau_w,snow_o)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_msnow%name,itau_w,snow_o)
        ENDIF
 
        IF (o_fsnow%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_fsnow%name,itau_w,zfra_o)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_fsnow%name,itau_w,zfra_o)
        ENDIF
 
        IF (o_evap%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_evap%name,itau_w,evap)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_evap%name,itau_w,evap)
        ENDIF
 
        IF (o_tops%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_tops%name,itau_w,topsw)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_tops%name,itau_w,topsw)
        ENDIF
 
        IF (o_tops0%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_tops0%name,itau_w,topsw0)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_tops0%name,itau_w,topsw0)
        ENDIF
 
        IF (o_topl%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_topl%name,itau_w,toplw)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_topl%name,itau_w,toplw)
        ENDIF
 
        IF (o_topl0%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_topl0%name,itau_w,toplw0)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_topl0%name,itau_w,toplw0)
        ENDIF
 
        IF (o_SWupTOA%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi2d(1 : klon) = swup ( 1 : klon, klevp1 )
-      CALL histwrite_phy(nid_files(iff),o_SWupTOA%name,
-     s                     itau_w,zx_tmp_fi2d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_SWupTOA%name,itau_w,zx_tmp_fi2d)
        ENDIF
 
        IF (o_SWupTOAclr%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi2d(1 : klon) = swup0 ( 1 : klon, klevp1 )
-      CALL histwrite_phy(nid_files(iff), 
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff), 
      $                  o_SWupTOAclr%name,itau_w,zx_tmp_fi2d)
        ENDIF
@@ -193,5 +222,5 @@
        IF (o_SWdnTOA%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi2d(1 : klon) = swdn ( 1 : klon, klevp1 )
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                  o_SWdnTOA%name,itau_w,zx_tmp_fi2d)
        ENDIF
@@ -199,5 +228,5 @@
        IF (o_SWdnTOAclr%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi2d(1 : klon) = swdn0 ( 1 : klon, klevp1 )
-      CALL histwrite_phy(nid_files(iff), 
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff), 
      $                  o_SWdnTOAclr%name,itau_w,zx_tmp_fi2d)
        ENDIF
@@ -205,68 +234,76 @@
        IF (o_nettop%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi2d(:) = topsw(:)-toplw(:)
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                  o_nettop%name,itau_w,zx_tmp_fi2d)
        ENDIF
 
        IF (o_SWup200%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_SWup200%name,itau_w,SWup200)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_SWup200%name,itau_w,SWup200)
        ENDIF
 
        IF (o_SWup200clr%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                   o_SWup200clr%name,itau_w,SWup200clr)
        ENDIF
 
        IF (o_SWdn200%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_SWdn200%name,itau_w,SWdn200)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_SWdn200%name,itau_w,SWdn200)
        ENDIF
 
        IF (o_SWdn200clr%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                o_SWdn200clr%name,itau_w,SWdn200clr)
        ENDIF
 
        IF (o_LWup200%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_LWup200%name,itau_w,LWup200)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_LWup200%name,itau_w,LWup200)
        ENDIF
 
        IF (o_LWup200clr%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                   o_LWup200clr%name,itau_w,LWup200clr)
        ENDIF
 
        IF (o_LWdn200%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                   o_LWdn200%name,itau_w,LWdn200)
        ENDIF
 
        IF (o_LWdn200clr%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                  o_LWdn200clr%name,itau_w,LWdn200clr)
        ENDIF
 
        IF (o_sols%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_sols%name,itau_w,solsw)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_sols%name,itau_w,solsw)
        ENDIF
 
        IF (o_sols0%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_sols0%name,itau_w,solsw0)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_sols0%name,itau_w,solsw0)
        ENDIF
 
        IF (o_soll%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_soll%name,itau_w,sollw)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_soll%name,itau_w,sollw)
        ENDIF
 
        IF (o_radsol%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_radsol%name,itau_w,radsol)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_radsol%name,itau_w,radsol)
        ENDIF
 
        IF (o_soll0%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_soll0%name,itau_w,sollw0)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_soll0%name,itau_w,sollw0)
        ENDIF
 
        IF (o_SWupSFC%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi2d(1 : klon) = swup ( 1 : klon, 1 )
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s               o_SWupSFC%name,itau_w,zx_tmp_fi2d)
        ENDIF
@@ -274,5 +311,5 @@
        IF (o_SWupSFCclr%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi2d(1 : klon) = swup0 ( 1 : klon, 1 )
-      CALL histwrite_phy(nid_files(iff), 
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff), 
      $                   o_SWupSFCclr%name,itau_w,zx_tmp_fi2d)
        ENDIF
@@ -280,5 +317,5 @@
        IF (o_SWdnSFC%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi2d(1 : klon) = swdn ( 1 : klon, 1 )
-      CALL histwrite_phy(nid_files(iff), 
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff), 
      $                   o_SWdnSFC%name,itau_w,zx_tmp_fi2d)
        ENDIF
@@ -286,5 +323,5 @@
        IF (o_SWdnSFCclr%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi2d(1 : klon) = swdn0 ( 1 : klon, 1 )
-      CALL histwrite_phy(nid_files(iff), 
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff), 
      $                  o_SWdnSFCclr%name,itau_w,zx_tmp_fi2d)
        ENDIF
@@ -292,10 +329,10 @@
        IF (o_LWupSFC%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi2d(1:klon)=sollwdown(1:klon)-sollw(1:klon)
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                    o_LWupSFC%name,itau_w,zx_tmp_fi2d)
        ENDIF
 
        IF (o_LWdnSFC%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                   o_LWdnSFC%name,itau_w,sollwdown)
        ENDIF
@@ -304,37 +341,41 @@
        IF (o_LWupSFCclr%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi2d(1:klon)=sollwdownclr(1:klon)-sollw0(1:klon)
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                   o_LWupSFCclr%name,itau_w,zx_tmp_fi2d)
        ENDIF
 
        IF (o_LWdnSFCclr%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                   o_LWdnSFCclr%name,itau_w,sollwdownclr)
        ENDIF
 
        IF (o_bils%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_bils%name,itau_w,bils)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_bils%name,itau_w,bils)
        ENDIF
 
        IF (o_sens%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi2d(1:klon)=-1*sens(1:klon)
-      CALL histwrite_phy(nid_files(iff),o_sens%name,itau_w,zx_tmp_fi2d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_sens%name,itau_w,zx_tmp_fi2d)
        ENDIF
 
        IF (o_fder%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_fder%name,itau_w,fder)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_fder%name,itau_w,fder)
        ENDIF
 
        IF (o_ffonte%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_ffonte%name,itau_w,zxffonte)
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_ffonte%name,itau_w,zxffonte)
        ENDIF
 
        IF (o_fqcalving%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                    o_fqcalving%name,itau_w,zxfqcalving)
        ENDIF
 
        IF (o_fqfonte%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                   o_fqfonte%name,itau_w,zxfqfonte)
        ENDIF
@@ -345,5 +386,5 @@
           zx_tmp_fi2d(:)=zx_tmp_fi2d(:)+pctsrf(:,nsrf)*fluxu(:,1,nsrf)
          enddo
-         CALL histwrite_phy(nid_files(iff),
+         CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                   o_taux%name,itau_w,zx_tmp_fi2d)
        ENDIF
@@ -354,5 +395,5 @@
           zx_tmp_fi2d(:)=zx_tmp_fi2d(:)+pctsrf(:,nsrf)*fluxv(:,1,nsrf)
          enddo
-         CALL histwrite_phy(nid_files(iff),
+         CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                   o_tauy%name,itau_w,zx_tmp_fi2d)
        ENDIF
@@ -363,4 +404,5 @@
             zx_tmp_fi2d(1 : klon) = pctsrf( 1 : klon, nsrf)*100.
             CALL histwrite_phy(nid_files(iff),
+     $                     clef_stations(iff),
      $                     o_pourc_srf(nsrf)%name,itau_w,
      $                     zx_tmp_fi2d)
@@ -369,5 +411,5 @@
           IF (o_fract_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
           zx_tmp_fi2d(1 : klon) = pctsrf( 1 : klon, nsrf)
-          CALL histwrite_phy(nid_files(iff),
+          CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                  o_fract_srf(nsrf)%name,itau_w,
      $                  zx_tmp_fi2d)
@@ -377,5 +419,5 @@
         IF (o_taux_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
         zx_tmp_fi2d(1 : klon) = fluxu( 1 : klon, 1, nsrf)
-        CALL histwrite_phy(nid_files(iff),
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                     o_taux_srf(nsrf)%name,itau_w,
      $                     zx_tmp_fi2d)
@@ -384,5 +426,5 @@
         IF (o_tauy_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN           
         zx_tmp_fi2d(1 : klon) = fluxv( 1 : klon, 1, nsrf)
-        CALL histwrite_phy(nid_files(iff),
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                    o_tauy_srf(nsrf)%name,itau_w,
      $                    zx_tmp_fi2d)
@@ -391,5 +433,5 @@
         IF (o_tsol_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
         zx_tmp_fi2d(1 : klon) = ftsol( 1 : klon, nsrf)
-        CALL histwrite_phy(nid_files(iff),
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                   o_tsol_srf(nsrf)%name,itau_w,
      $      zx_tmp_fi2d)
@@ -398,5 +440,6 @@
       IF (o_u10m_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi2d(1 : klon) = u10m(1 : klon, nsrf)
-      CALL histwrite_phy(nid_files(iff),o_u10m_srf(nsrf)%name,
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_u10m_srf(nsrf)%name,
      $                 itau_w,zx_tmp_fi2d)
       ENDIF
@@ -404,5 +447,6 @@
       IF (o_v10m_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi2d(1 : klon) = v10m(1 : klon, nsrf)
-      CALL histwrite_phy(nid_files(iff),o_v10m_srf(nsrf)%name,
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_v10m_srf(nsrf)%name,
      $              itau_w,zx_tmp_fi2d)
       ENDIF
@@ -410,5 +454,6 @@
       IF (o_t2m_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi2d(1 : klon) = t2m(1 : klon, nsrf)
-      CALL histwrite_phy(nid_files(iff),o_t2m_srf(nsrf)%name,
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_t2m_srf(nsrf)%name,
      $           itau_w,zx_tmp_fi2d)
       ENDIF
@@ -416,5 +461,6 @@
       IF (o_evap_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi2d(1 : klon) = fevap(1 : klon, nsrf)
-      CALL histwrite_phy(nid_files(iff),o_evap_srf(nsrf)%name,
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_evap_srf(nsrf)%name,
      $           itau_w,zx_tmp_fi2d)
       ENDIF
@@ -422,5 +468,5 @@
        IF (o_sens_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
        zx_tmp_fi2d(1 : klon) = fluxt( 1 : klon, 1, nsrf)
-       CALL histwrite_phy(nid_files(iff),
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                    o_sens_srf(nsrf)%name,itau_w,
      $      zx_tmp_fi2d)
@@ -429,5 +475,5 @@
         IF (o_lat_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
         zx_tmp_fi2d(1 : klon) = fluxlat( 1 : klon, nsrf)
-        CALL histwrite_phy(nid_files(iff),
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                 o_lat_srf(nsrf)%name,itau_w,
      $                                   zx_tmp_fi2d)
@@ -436,5 +482,5 @@
         IF (o_flw_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
         zx_tmp_fi2d(1 : klon) = fsollw( 1 : klon, nsrf)
-        CALL histwrite_phy(nid_files(iff),
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                     o_flw_srf(nsrf)%name,itau_w,
      $      zx_tmp_fi2d)
@@ -443,5 +489,5 @@
         IF (o_fsw_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
         zx_tmp_fi2d(1 : klon) = fsolsw( 1 : klon, nsrf)
-        CALL histwrite_phy(nid_files(iff),
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                   o_fsw_srf(nsrf)%name,itau_w,
      $      zx_tmp_fi2d)
@@ -450,5 +496,5 @@
         IF (o_wbils_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
         zx_tmp_fi2d(1 : klon) = wfbils( 1 : klon, nsrf)
-        CALL histwrite_phy(nid_files(iff),
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                   o_wbils_srf(nsrf)%name,itau_w,
      $      zx_tmp_fi2d)
@@ -457,5 +503,5 @@
         IF (o_wbilo_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
         zx_tmp_fi2d(1 : klon) = wfbilo( 1 : klon, nsrf)
-        CALL histwrite_phy(nid_files(iff),
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                    o_wbilo_srf(nsrf)%name,itau_w,
      $      zx_tmp_fi2d)
@@ -464,49 +510,58 @@
        if (iflag_pbl>1 .and. lev_histday.gt.10 ) then
         IF (o_tke_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                   o_tke_srf(nsrf)%name,itau_w,
      $                    pbl_tke(:,1:klev,nsrf))
        ENDIF
 
+      IF (.NOT.clef_stations(iff)) THEN
         IF (o_tke_max_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                    o_tke_max_srf(nsrf)%name,itau_w,
      $      pbl_tke(:,1:klev,nsrf))
         ENDIF
+      ENDIF
        endif
       ENDDO
 
         IF (o_cdrm%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_cdrm%name,itau_w,cdragm)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_cdrm%name,itau_w,cdragm)
         ENDIF
 
         IF (o_cdrh%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_cdrh%name,itau_w,cdragh)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_cdrh%name,itau_w,cdragh)
         ENDIF
 
         IF (o_cldl%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_cldl%name,itau_w,cldl)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_cldl%name,itau_w,cldl)
         ENDIF
 
         IF (o_cldm%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_cldm%name,itau_w,cldm)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_cldm%name,itau_w,cldm)
         ENDIF
 
         IF (o_cldh%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_cldh%name,itau_w,cldh)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_cldh%name,itau_w,cldh)
         ENDIF
 
         IF (o_cldt%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_cldt%name, 
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_cldt%name, 
      &                   itau_w,cldt)
         ENDIF
 
         IF (o_cldq%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_cldq%name,itau_w,cldq)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_cldq%name,itau_w,cldq)
         ENDIF
 
         IF (o_lwp%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi2d(1:klon) = flwp(1:klon)
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                   o_lwp%name,itau_w,zx_tmp_fi2d)
         ENDIF
@@ -514,81 +569,101 @@
         IF (o_iwp%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi2d(1:klon) = fiwp(1:klon)
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                    o_iwp%name,itau_w,zx_tmp_fi2d)
         ENDIF
 
         IF (o_ue%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_ue%name,itau_w,ue)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_ue%name,itau_w,ue)
         ENDIF
 
         IF (o_ve%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_ve%name,itau_w,ve)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_ve%name,itau_w,ve)
         ENDIF
 
         IF (o_uq%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_uq%name,itau_w,uq)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_uq%name,itau_w,uq)
         ENDIF
 
         IF (o_vq%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_vq%name,itau_w,vq)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_vq%name,itau_w,vq)
         ENDIF
 
       IF(iflag_con.GE.3) THEN ! sb
         IF (o_cape%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_cape%name,itau_w,cape)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_cape%name,itau_w,cape)
         ENDIF
 
         IF (o_pbase%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_pbase%name,itau_w,ema_pcb)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_pbase%name,itau_w,ema_pcb)
         ENDIF
 
         IF (o_ptop%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_ptop%name,itau_w,ema_pct)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_ptop%name,itau_w,ema_pct)
         ENDIF
 
         IF (o_fbase%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_fbase%name,itau_w,ema_cbmf)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_fbase%name,itau_w,ema_cbmf)
         ENDIF
 
         IF (o_plcl%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_plcl%name,itau_w,plcl)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_plcl%name,itau_w,plcl)
         ENDIF
 
         IF (o_plfc%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_plfc%name,itau_w,plfc)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_plfc%name,itau_w,plfc)
         ENDIF
 
         IF (o_wbeff%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_wbeff%name,itau_w,wbeff)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_wbeff%name,itau_w,wbeff)
         ENDIF
 
 
         IF (o_prw%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_prw%name,itau_w,prw)
-        ENDIF
-
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_prw%name,itau_w,prw)
+        ENDIF
+
+      IF (.NOT.clef_stations(iff)) THEN
       IF (o_cape_max%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_cape_max%name,itau_w,cape)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_cape_max%name,itau_w,cape)
+      ENDIF
       ENDIF
 
        IF (o_upwd%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_upwd%name,itau_w,upwd)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_upwd%name,itau_w,upwd)
        ENDIF
 
        IF (o_Ma%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_Ma%name,itau_w,Ma)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_Ma%name,itau_w,Ma)
        ENDIF
 
        IF (o_dnwd%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_dnwd%name,itau_w,dnwd)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dnwd%name,itau_w,dnwd)
        ENDIF
 
        IF (o_dnwd0%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_dnwd0%name,itau_w,dnwd0)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dnwd0%name,itau_w,dnwd0)
        ENDIF
 
        IF (o_ftime_con%flag(iff)<=lev_files(iff)) THEN
         zx_tmp_fi2d=float(itau_con)/float(itap)
-      CALL histwrite_phy(nid_files(iff),o_ftime_con%name,
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_ftime_con%name,
      s                   itau_w,zx_tmp_fi2d)
        ENDIF
@@ -600,5 +675,6 @@
          zx_tmp_fi3d=dnwd+dnwd0+upwd
         endif 
-      CALL histwrite_phy(nid_files(iff),o_mc%name,itau_w,zx_tmp_fi3d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_mc%name,itau_w,zx_tmp_fi3d)
        ENDIF
       
@@ -606,42 +682,52 @@
 
         IF (o_s_pblh%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_s_pblh%name,itau_w,s_pblh)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_s_pblh%name,itau_w,s_pblh)
         ENDIF
 
         IF (o_s_pblt%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_s_pblt%name,itau_w,s_pblt)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_s_pblt%name,itau_w,s_pblt)
         ENDIF
 
         IF (o_s_lcl%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_s_lcl%name,itau_w,s_lcl)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_s_lcl%name,itau_w,s_lcl)
         ENDIF
 
         IF (o_s_therm%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_s_therm%name,itau_w,s_therm)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_s_therm%name,itau_w,s_therm)
         ENDIF
 
 !IM : Les champs suivants (s_capCL, s_oliqCL, s_cteiCL, s_trmb1, s_trmb2, s_trmb3) ne sont pas definis dans HBTM.F
 !       IF (o_s_capCL%flag(iff)<=lev_files(iff)) THEN
-!     CALL histwrite_phy(nid_files(iff),o_s_capCL%name,itau_w,s_capCL)
+!     CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+!    $o_s_capCL%name,itau_w,s_capCL)
 !       ENDIF
 
 !       IF (o_s_oliqCL%flag(iff)<=lev_files(iff)) THEN
-!     CALL histwrite_phy(nid_files(iff),o_s_oliqCL%name,itau_w,s_oliqCL)
+!     CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+!    $o_s_oliqCL%name,itau_w,s_oliqCL)
 !       ENDIF
 
 !       IF (o_s_cteiCL%flag(iff)<=lev_files(iff)) THEN
-!     CALL histwrite_phy(nid_files(iff),o_s_cteiCL%name,itau_w,s_cteiCL)
+!     CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+!    $o_s_cteiCL%name,itau_w,s_cteiCL)
 !       ENDIF
 
 !       IF (o_s_trmb1%flag(iff)<=lev_files(iff)) THEN
-!     CALL histwrite_phy(nid_files(iff),o_s_trmb1%name,itau_w,s_trmb1)
+!     CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+!    $o_s_trmb1%name,itau_w,s_trmb1)
 !       ENDIF
 
 !       IF (o_s_trmb2%flag(iff)<=lev_files(iff)) THEN
-!     CALL histwrite_phy(nid_files(iff),o_s_trmb2%name,itau_w,s_trmb2)
+!     CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+!    $o_s_trmb2%name,itau_w,s_trmb2)
 !       ENDIF
 
 !       IF (o_s_trmb3%flag(iff)<=lev_files(iff)) THEN
-!     CALL histwrite_phy(nid_files(iff),o_s_trmb3%name,itau_w,s_trmb3)
+!     CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+!    $o_s_trmb3%name,itau_w,s_trmb3)
 !       ENDIF
 
@@ -650,9 +736,8 @@
         ll=0
         DO k=1, nlevSTD
-!         IF(k.GE.2.AND.k.LE.12) bb2=clevSTD(k)
-!         IF(k.GE.13.AND.k.LE.17) bb3=clevSTD(k)
          bb2=clevSTD(k) 
          IF(bb2.EQ."850".OR.bb2.EQ."700".OR.
      $      bb2.EQ."500".OR.bb2.EQ."200".OR.
+     $      bb2.EQ."100".OR.
      $      bb2.EQ."50".OR.bb2.EQ."10") THEN
 
@@ -660,30 +745,36 @@
           ll=ll+1
        IF (o_uSTDlevs(ll)%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_uSTDlevs(ll)%name,
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_uSTDlevs(ll)%name,
      &                    itau_w,uwriteSTD(:,k,iff))
        ENDIF
 
        IF (o_vSTDlevs(ll)%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_vSTDlevs(ll)%name,  
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_vSTDlevs(ll)%name,  
      &                   itau_w,vwriteSTD(:,k,iff))
        ENDIF
 
        IF (o_wSTDlevs(ll)%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_wSTDlevs(ll)%name,
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_wSTDlevs(ll)%name,
      &                    itau_w,wwriteSTD(:,k,iff))
        ENDIF
 
        IF (o_zSTDlevs(ll)%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_zSTDlevs(ll)%name,
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_zSTDlevs(ll)%name,
      &               itau_w,phiwriteSTD(:,k,iff))
        ENDIF
 
        IF (o_qSTDlevs(ll)%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_qSTDlevs(ll)%name,
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_qSTDlevs(ll)%name,
      &                   itau_w, qwriteSTD(:,k,iff))
        ENDIF
 
        IF (o_tSTDlevs(ll)%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_tSTDlevs(ll)%name,
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_tSTDlevs(ll)%name,
      &                   itau_w, twriteSTD(:,k,iff))
        ENDIF
@@ -703,5 +794,5 @@
        ENDIF
       ENDDO
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                   o_t_oce_sic%name,itau_w,zx_tmp_fi2d)
       ENDIF
@@ -711,8 +802,10 @@
       IF (iflag_coupl>=1) THEN
        IF (o_ale_bl%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_ale_bl%name,itau_w,ale_bl)
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_ale_bl%name,itau_w,ale_bl)
        ENDIF
        IF (o_alp_bl%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_alp_bl%name,itau_w,alp_bl)
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_alp_bl%name,itau_w,alp_bl)
        ENDIF
       ENDIF !iflag_coupl>=1
@@ -723,42 +816,52 @@
       IF (iflag_wake>=1) THEN
        IF (o_ale_wk%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_ale_wk%name,itau_w,ale_wake)
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_ale_wk%name,itau_w,ale_wake)
        ENDIF
        IF (o_alp_wk%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_alp_wk%name,itau_w,alp_wake)
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_alp_wk%name,itau_w,alp_wake)
        ENDIF
 
        IF (o_ale%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_ale%name,itau_w,ale)
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_ale%name,itau_w,ale)
        ENDIF
        IF (o_alp%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_alp%name,itau_w,alp)
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_alp%name,itau_w,alp)
        ENDIF
        IF (o_cin%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_cin%name,itau_w,cin)
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_cin%name,itau_w,cin)
        ENDIF
        IF (o_wape%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_WAPE%name,itau_w,wake_pe)
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_WAPE%name,itau_w,wake_pe)
        ENDIF
        IF (o_wake_h%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_wake_h%name,itau_w,wake_h)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_wake_h%name,itau_w,wake_h)
        ENDIF
 
        IF (o_wake_s%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_wake_s%name,itau_w,wake_s)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_wake_s%name,itau_w,wake_s)
        ENDIF
 
         IF (o_wake_deltat%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_wake_deltat%name,
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_wake_deltat%name,
      $                     itau_w,wake_deltat)
         ENDIF
 
         IF (o_wake_deltaq%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_wake_deltaq%name,
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_wake_deltaq%name,
      $                    itau_w,wake_deltaq)
         ENDIF
 
         IF (o_wake_omg%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                    o_wake_omg%name,itau_w,wake_omg)
         ENDIF
@@ -768,4 +871,5 @@
      &                                        /pdtphys
            CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
      &                       o_dtwak%name,itau_w,zx_tmp_fi3d)
          ENDIF
@@ -773,5 +877,5 @@
         IF (o_dqwak%flag(iff)<=lev_files(iff)) THEN
         zx_tmp_fi3d(1:klon,1:klev)=d_q_wake(1:klon,1:klev)/pdtphys
-        CALL histwrite_phy(nid_files(iff),
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      &                     o_dqwak%name,itau_w,zx_tmp_fi3d)
         ENDIF
@@ -779,13 +883,16 @@
 
         IF (o_Vprecip%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_Vprecip%name,itau_w,Vprecip)
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_Vprecip%name,itau_w,Vprecip)
         ENDIF
 
         IF (o_ftd%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_ftd%name,itau_w,ftd)
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_ftd%name,itau_w,ftd)
         ENDIF
 
         IF (o_fqd%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_fqd%name,itau_w,fqd)
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_fqd%name,itau_w,fqd)
         ENDIF
       ENDIF !(iflag_con.EQ.3) 
@@ -794,51 +901,57 @@
       IF ( o_slab_bils%flag(iff)<=lev_files(iff)) 
      $     CALL histwrite_phy(
-     $     nid_files(iff),o_slab_bils%name,itau_w,slab_wfbils)
+     $     nid_files(iff),clef_stations(iff),
+     $o_slab_bils%name,itau_w,slab_wfbils)
 
       ENDIF !type_ocean == force/slab
 
       IF (o_weakinv%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                  o_weakinv%name,itau_w,weak_inversion)
       ENDIF
 
       IF (o_dthmin%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_dthmin%name,itau_w,dthmin)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dthmin%name,itau_w,dthmin)
       ENDIF
 
        IF (o_cldtau%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_cldtau%name,itau_w,cldtau)
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_cldtau%name,itau_w,cldtau)
        ENDIF
 
        IF (o_cldemi%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_cldemi%name,itau_w,cldemi)
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_cldemi%name,itau_w,cldemi)
        ENDIF
 
       IF (o_pr_con_l%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s         o_pr_con_l%name,itau_w,pmflxr(:,1:klev))
       ENDIF
 
       IF (o_pr_con_i%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s         o_pr_con_i%name,itau_w,pmflxs(:,1:klev))
       ENDIF
 
       IF (o_pr_lsc_l%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s        o_pr_lsc_l%name,itau_w,prfl(:,1:klev))
       ENDIF
 
       IF (o_pr_lsc_i%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s        o_pr_lsc_i%name,itau_w,psfl(:,1:klev))
       ENDIF
 
       IF (o_re%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_re%name,itau_w,re)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_re%name,itau_w,re)
       ENDIF
 
       IF (o_fl%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_fl%name,itau_w,fl)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_fl%name,itau_w,fl)
       ENDIF
 
@@ -849,12 +962,15 @@
        zx_tmp_fi2d(i)=MIN(100.,rh2m(i)*100.)
       ENDDO
-      CALL histwrite_phy(nid_files(iff),o_rh2m%name,itau_w,zx_tmp_fi2d)
-      ENDIF
-
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rh2m%name,itau_w,zx_tmp_fi2d)
+      ENDIF
+
+      IF (.NOT.clef_stations(iff)) THEN
       IF (o_rh2m_min%flag(iff)<=lev_files(iff)) THEN
       DO i=1, klon
        zx_tmp_fi2d(i)=MIN(100.,rh2m(i)*100.)
       ENDDO
-      CALL histwrite_phy(nid_files(iff),o_rh2m_min%name,
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rh2m_min%name,
      s               itau_w,zx_tmp_fi2d)
       ENDIF
@@ -864,24 +980,29 @@
        zx_tmp_fi2d(i)=MIN(100.,rh2m(i)*100.)
       ENDDO
-      CALL histwrite_phy(nid_files(iff),o_rh2m_max%name,
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rh2m_max%name,
      s              itau_w,zx_tmp_fi2d)
       ENDIF
+      ENDIF
 
 
       IF (o_qsat2m%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_qsat2m%name,itau_w,qsat2m)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_qsat2m%name,itau_w,qsat2m)
       ENDIF
 
       IF (o_tpot%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_tpot%name,itau_w,tpot)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_tpot%name,itau_w,tpot)
       ENDIF
 
        IF (o_tpote%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_tpote%name,itau_w,tpote)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_tpote%name,itau_w,tpote)
        ENDIF
 
       IF (o_SWnetOR%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi2d(1 : klon) = fsolsw( 1 : klon, is_ter)
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                   o_SWnetOR%name,itau_w, zx_tmp_fi2d)
       ENDIF
@@ -889,44 +1010,46 @@
       IF (o_SWdownOR%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi2d(1:klon) = solsw(1:klon)/(1.-albsol1(1:klon))
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                   o_SWdownOR%name,itau_w, zx_tmp_fi2d)
       ENDIF
 
       IF (o_LWdownOR%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                  o_LWdownOR%name,itau_w,sollwdown)
       ENDIF
 
       IF (o_snowl%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_snowl%name,itau_w,snow_lsc)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_snowl%name,itau_w,snow_lsc)
       ENDIF
 
       IF (o_solldown%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                   o_solldown%name,itau_w,sollwdown)
       ENDIF
 
       IF (o_dtsvdfo%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                 o_dtsvdfo%name,itau_w,d_ts(:,is_oce))
       ENDIF
 
       IF (o_dtsvdft%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                   o_dtsvdft%name,itau_w,d_ts(:,is_ter))
       ENDIF
 
        IF (o_dtsvdfg%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                   o_dtsvdfg%name,itau_w, d_ts(:,is_lic))
        ENDIF
 
        IF (o_dtsvdfi%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                   o_dtsvdfi%name,itau_w,d_ts(:,is_sic))
        ENDIF
 
        IF (o_rugs%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_rugs%name,itau_w,zxrugs)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rugs%name,itau_w,zxrugs)
        ENDIF
 
@@ -936,80 +1059,118 @@
 
           IF (o_od550aer%flag(iff)<=lev_files(iff)) THEN
-             CALL histwrite_phy(nid_files(iff),o_od550aer%name,itau_w,
+             CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_od550aer%name,itau_w,
      $            od550aer)
           ENDIF
           IF (o_od865aer%flag(iff)<=lev_files(iff)) THEN
-             CALL histwrite_phy(nid_files(iff),o_od865aer%name,itau_w,
+             CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_od865aer%name,itau_w,
      $            od865aer)
           ENDIF
           IF (o_absvisaer%flag(iff)<=lev_files(iff)) THEN
-             CALL histwrite_phy(nid_files(iff),o_absvisaer%name,itau_w,
+             CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_absvisaer%name,itau_w,
      $            absvisaer)
           ENDIF
           IF (o_od550lt1aer%flag(iff)<=lev_files(iff)) THEN
-            CALL histwrite_phy(nid_files(iff),o_od550lt1aer%name,itau_w,
+            CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_od550lt1aer%name,itau_w,
      $            od550lt1aer)
           ENDIF
 
           IF (o_sconcso4%flag(iff)<=lev_files(iff)) THEN
-              CALL histwrite_phy(nid_files(iff),o_sconcso4%name,itau_w,
+              CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_sconcso4%name,itau_w,
      $            sconcso4)
           ENDIF
           IF (o_sconcoa%flag(iff)<=lev_files(iff)) THEN
-              CALL histwrite_phy(nid_files(iff),o_sconcoa%name,itau_w,
+              CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_sconcoa%name,itau_w,
      $            sconcoa)
           ENDIF
           IF (o_sconcbc%flag(iff)<=lev_files(iff)) THEN
-              CALL histwrite_phy(nid_files(iff),o_sconcbc%name,itau_w,
+              CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_sconcbc%name,itau_w,
      $            sconcbc)
           ENDIF
           IF (o_sconcss%flag(iff)<=lev_files(iff)) THEN
-              CALL histwrite_phy(nid_files(iff),o_sconcss%name,itau_w,
+              CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_sconcss%name,itau_w,
      $            sconcss)
           ENDIF
           IF (o_sconcdust%flag(iff)<=lev_files(iff)) THEN
-              CALL histwrite_phy(nid_files(iff),o_sconcdust%name,itau_w,
+              CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_sconcdust%name,itau_w,
      $            sconcdust)
           ENDIF
           
           IF (o_concso4%flag(iff)<=lev_files(iff)) THEN
-              CALL histwrite_phy(nid_files(iff),o_concso4%name,itau_w,
+              CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_concso4%name,itau_w,
      $            concso4)
           ENDIF
           IF (o_concoa%flag(iff)<=lev_files(iff)) THEN
-              CALL histwrite_phy(nid_files(iff),o_concoa%name,itau_w,
+              CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_concoa%name,itau_w,
      $            concoa)
           ENDIF
           IF (o_concbc%flag(iff)<=lev_files(iff)) THEN
-              CALL histwrite_phy(nid_files(iff),o_concbc%name,itau_w,
+              CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_concbc%name,itau_w,
      $            concbc)
           ENDIF
           IF (o_concss%flag(iff)<=lev_files(iff)) THEN
-              CALL histwrite_phy(nid_files(iff),o_concss%name,itau_w,
+              CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_concss%name,itau_w,
      $            concss)
           ENDIF
           IF (o_concdust%flag(iff)<=lev_files(iff)) THEN
-              CALL histwrite_phy(nid_files(iff),o_concdust%name,itau_w,
+              CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_concdust%name,itau_w,
      $            concdust)
           ENDIF
           
           IF (o_loadso4%flag(iff)<=lev_files(iff)) THEN
-              CALL histwrite_phy(nid_files(iff),o_loadso4%name,itau_w,
+              CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_loadso4%name,itau_w,
      $            loadso4)
           ENDIF
           IF (o_loadoa%flag(iff)<=lev_files(iff)) THEN
-              CALL histwrite_phy(nid_files(iff),o_loadoa%name,itau_w,
+              CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_loadoa%name,itau_w,
      $            loadoa)
           ENDIF
           IF (o_loadbc%flag(iff)<=lev_files(iff)) THEN
-              CALL histwrite_phy(nid_files(iff),o_loadbc%name,itau_w,
+              CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_loadbc%name,itau_w,
      $            loadbc)
           ENDIF
           IF (o_loadss%flag(iff)<=lev_files(iff)) THEN
-              CALL histwrite_phy(nid_files(iff),o_loadss%name,itau_w,
+              CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_loadss%name,itau_w,
      $            loadss)
           ENDIF
           IF (o_loaddust%flag(iff)<=lev_files(iff)) THEN
-              CALL histwrite_phy(nid_files(iff),o_loaddust%name,itau_w,
+              CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_loaddust%name,itau_w,
      $            loaddust)
           ENDIF
@@ -1018,4 +1179,5 @@
             IF (o_tausumaero(naero)%flag(iff)<=lev_files(iff)) THEN
                 CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
      $              o_tausumaero(naero)%name,itau_w,
      $              tausum_aero(:,2,naero) )
@@ -1027,9 +1189,13 @@
        IF (ok_ade) THEN
           IF (o_topswad%flag(iff)<=lev_files(iff)) THEN
-             CALL histwrite_phy(nid_files(iff),o_topswad%name,itau_w,
+             CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_topswad%name,itau_w,
      $            topswad_aero)
           ENDIF
           IF (o_solswad%flag(iff)<=lev_files(iff)) THEN
-             CALL histwrite_phy(nid_files(iff),o_solswad%name,itau_w,
+             CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_solswad%name,itau_w,
      $            solswad_aero)
           ENDIF
@@ -1038,20 +1204,24 @@
         if (new_aod) then	       
         IF (o_swtoaas_nat%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_swtoaas_nat%name,itau_w,
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_swtoaas_nat%name,itau_w,
      $      topsw_aero(:,1))
         ENDIF
 
         IF (o_swsrfas_nat%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_swsrfas_nat%name,itau_w,
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_swsrfas_nat%name,itau_w,
      $      solsw_aero(:,1))
         ENDIF
 
         IF (o_swtoacs_nat%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_swtoacs_nat%name,itau_w,
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_swtoacs_nat%name,itau_w,
      $      topsw0_aero(:,1))
         ENDIF
 
         IF (o_swsrfcs_nat%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_swsrfcs_nat%name,itau_w,
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_swsrfcs_nat%name,itau_w,
      $      solsw0_aero(:,1))
         ENDIF
@@ -1059,20 +1229,24 @@
 !ant
         IF (o_swtoaas_ant%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_swtoaas_ant%name,itau_w,
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_swtoaas_ant%name,itau_w,
      $      topsw_aero(:,2))
         ENDIF
 
         IF (o_swsrfas_ant%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_swsrfas_ant%name,itau_w,
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_swsrfas_ant%name,itau_w,
      $      solsw_aero(:,2))
         ENDIF
 
         IF (o_swtoacs_ant%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_swtoacs_ant%name,itau_w,
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_swtoacs_ant%name,itau_w,
      $      topsw0_aero(:,2))
         ENDIF
 
         IF (o_swsrfcs_ant%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_swsrfcs_ant%name,itau_w,
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_swsrfcs_ant%name,itau_w,
      $      solsw0_aero(:,2))
         ENDIF
@@ -1082,30 +1256,36 @@
         if (.not. aerosol_couple) then
         IF (o_swtoacf_nat%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_swtoacf_nat%name,itau_w,
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_swtoacf_nat%name,itau_w,
      $      topswcf_aero(:,1))
         ENDIF
 
         IF (o_swsrfcf_nat%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_swsrfcf_nat%name,itau_w,
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_swsrfcf_nat%name,itau_w,
      $      solswcf_aero(:,1))
         ENDIF
 
         IF (o_swtoacf_ant%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_swtoacf_ant%name,itau_w,
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_swtoacf_ant%name,itau_w,
      $      topswcf_aero(:,2))
         ENDIF
 
         IF (o_swsrfcf_ant%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_swsrfcf_ant%name,itau_w,
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_swsrfcf_ant%name,itau_w,
      $      solswcf_aero(:,2))
         ENDIF
 
         IF (o_swtoacf_zero%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_swtoacf_zero%name,itau_w,
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_swtoacf_zero%name,itau_w,
      $      topswcf_aero(:,3))
         ENDIF
 
         IF (o_swsrfcf_zero%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_swsrfcf_zero%name,itau_w,
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_swsrfcf_zero%name,itau_w,
      $      solswcf_aero(:,3))
         ENDIF
@@ -1119,49 +1299,73 @@
        IF (ok_aie) THEN
           IF (o_topswai%flag(iff)<=lev_files(iff)) THEN
-             CALL histwrite_phy(nid_files(iff),o_topswai%name,itau_w,
+             CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_topswai%name,itau_w,
      $            topswai_aero)
           ENDIF
           IF (o_solswai%flag(iff)<=lev_files(iff)) THEN
-             CALL histwrite_phy(nid_files(iff),o_solswai%name,itau_w,
+             CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_solswai%name,itau_w,
      $            solswai_aero)
           ENDIF
           IF (o_scdnc%flag(iff)<=lev_files(iff)) THEN
-             CALL histwrite_phy(nid_files(iff),o_scdnc%name,itau_w,
+             CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_scdnc%name,itau_w,
      $            scdnc)
           ENDIF
           IF (o_cldncl%flag(iff)<=lev_files(iff)) THEN
-             CALL histwrite_phy(nid_files(iff),o_cldncl%name,itau_w,
+             CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_cldncl%name,itau_w,
      $            cldncl)
           ENDIF
-          IF (o_reffclws%flag(iff)<=lev_files(iff)) THEN
-             CALL histwrite_phy(nid_files(iff),o_reffclws%name,itau_w,
+         IF (o_reffclws%flag(iff)<=lev_files(iff)) THEN
+            CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_reffclws%name,itau_w,
      $            reffclws)
-          ENDIF
-          IF (o_reffclwc%flag(iff)<=lev_files(iff)) THEN
-             CALL histwrite_phy(nid_files(iff),o_reffclwc%name,itau_w,
+         ENDIF
+         IF (o_reffclwc%flag(iff)<=lev_files(iff)) THEN
+            CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_reffclwc%name,itau_w,
      $            reffclwc)
-          ENDIF
+         ENDIF
           IF (o_cldnvi%flag(iff)<=lev_files(iff)) THEN
-             CALL histwrite_phy(nid_files(iff),o_cldnvi%name,itau_w,
+             CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_cldnvi%name,itau_w,
      $            cldnvi)
           ENDIF
           IF (o_lcc%flag(iff)<=lev_files(iff)) THEN
-             CALL histwrite_phy(nid_files(iff),o_lcc%name,itau_w,
+             CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_lcc%name,itau_w,
      $            lcc)
           ENDIF
           IF (o_lcc3d%flag(iff)<=lev_files(iff)) THEN
-             CALL histwrite_phy(nid_files(iff),o_lcc3d%name,itau_w,
+             CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_lcc3d%name,itau_w,
      $            lcc3d)
           ENDIF
           IF (o_lcc3dcon%flag(iff)<=lev_files(iff)) THEN
-             CALL histwrite_phy(nid_files(iff),o_lcc3dcon%name,itau_w,
+             CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_lcc3dcon%name,itau_w,
      $            lcc3dcon)
           ENDIF
           IF (o_lcc3dstra%flag(iff)<=lev_files(iff)) THEN
-             CALL histwrite_phy(nid_files(iff),o_lcc3dstra%name,itau_w,
+             CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_lcc3dstra%name,itau_w,
      $            lcc3dstra)
           ENDIF
           IF (o_reffclwtop%flag(iff)<=lev_files(iff)) THEN
-             CALL histwrite_phy(nid_files(iff),o_reffclwtop%name,itau_w,
+             CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_reffclwtop%name,itau_w,
      $            reffclwtop)
           ENDIF
@@ -1171,5 +1375,7 @@
        IF (ok_ade .OR. ok_aie) then
           IF (o_ec550aer%flag(iff)<=lev_files(iff)) THEN
-             CALL histwrite_phy(nid_files(iff),o_ec550aer%name,itau_w,
+             CALL histwrite_phy(nid_files(iff),
+     $clef_stations(iff),
+     $o_ec550aer%name,itau_w,
      &            ec550aer)
           ENDIF
@@ -1177,68 +1383,118 @@
 
        IF (o_lwcon%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_lwcon%name,itau_w,flwc)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_lwcon%name,itau_w,flwc)
        ENDIF
 
        IF (o_iwcon%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_iwcon%name,itau_w,fiwc)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_iwcon%name,itau_w,fiwc)
        ENDIF
 
        IF (o_temp%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_temp%name,itau_w,t_seri)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_temp%name,itau_w,t_seri)
        ENDIF
 
        IF (o_theta%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_theta%name,itau_w,theta)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_theta%name,itau_w,theta)
        ENDIF
 
        IF (o_ovapinit%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_ovapinit%name,itau_w,
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_ovapinit%name,itau_w,
      $ qx(:,:,ivap))
        ENDIF
 
        IF (o_ovap%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      $                   o_ovap%name,itau_w,q_seri)
        ENDIF
 
        IF (o_geop%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_geop%name,itau_w,zphi)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_geop%name,itau_w,zphi)
        ENDIF
 
        IF (o_vitu%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_vitu%name,itau_w,u_seri)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_vitu%name,itau_w,u_seri)
        ENDIF
 
        IF (o_vitv%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_vitv%name,itau_w,v_seri)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_vitv%name,itau_w,v_seri)
        ENDIF
 
        IF (o_vitw%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_vitw%name,itau_w,omega)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_vitw%name,itau_w,omega)
        ENDIF
 
         IF (o_pres%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_pres%name,itau_w,pplay)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_pres%name,itau_w,pplay)
         ENDIF
 
         IF (o_paprs%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_paprs%name,
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_paprs%name,
      s                    itau_w,paprs(:,1:klev))
         ENDIF
 
+        IF (o_zfull%flag(iff)<=lev_files(iff)) THEN
+         DO i=1, klon
+          zx_tmp_fi3d1(i,1)= pphis(i)/RG
+!020611   zx_tmp_fi3d(i,1)= pphis(i)/RG
+         ENDDO
+         DO k=1, klev
+!020611        DO k=1, klev-1
+         DO i=1, klon
+!020611         zx_tmp_fi3d(i,k+1)= zx_tmp_fi3d(i,k) - (t_seri(i,k) *RD * 
+          zx_tmp_fi3d1(i,k+1)= zx_tmp_fi3d1(i,k) - (t_seri(i,k) *RD * 
+     $    (paprs(i,k+1) - paprs(i,k))) / ( pplay(i,k) * RG ) 
+         ENDDO
+         ENDDO
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_zfull%name,itau_w,zx_tmp_fi3d1(:,2:klevp1))
+!020611    $o_zfull%name,itau_w,zx_tmp_fi3d)
+        ENDIF
+
+        IF (o_zhalf%flag(iff)<=lev_files(iff)) THEN
+         DO i=1, klon
+          zx_tmp_fi3d(i,1)= pphis(i)/RG - (
+     $    (t_seri(i,1)+zxtsol(i))/2. *RD *
+     $    (pplay(i,1) - paprs(i,1)))/( (paprs(i,1)+pplay(i,1))/2. * RG)
+         ENDDO
+         DO k=1, klev-1
+         DO i=1, klon
+          zx_tmp_fi3d(i,k+1)= zx_tmp_fi3d(i,k) - (
+     $    (t_seri(i,k)+t_seri(i,k+1))/2. *RD * 
+     $    (pplay(i,k+1) - pplay(i,k))) / ( paprs(i,k) * RG ) 
+         ENDDO
+         ENDDO
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_zhalf%name,itau_w,zx_tmp_fi3d)
+        ENDIF
+
        IF (o_rneb%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_rneb%name,itau_w,cldfra)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rneb%name,itau_w,cldfra)
        ENDIF
 
        IF (o_rnebcon%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_rnebcon%name,itau_w,rnebcon)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rnebcon%name,itau_w,rnebcon)
        ENDIF
 
        IF (o_rhum%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_rhum%name,itau_w,zx_rh)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rhum%name,itau_w,zx_rh)
        ENDIF
 
       IF (o_ozone%flag(iff)<=lev_files(iff)) THEN
-         CALL histwrite_phy(nid_files(iff), o_ozone%name, itau_w,
+         CALL histwrite_phy(nid_files(iff),clef_stations(iff), 
+     $o_ozone%name, itau_w,
      $        wo(:, :, 1) * dobson_u * 1e3 / zmasse / rmo3 * rmd)
       ENDIF
@@ -1246,14 +1502,16 @@
       IF (o_ozone_light%flag(iff)<=lev_files(iff) .and.
      $     read_climoz == 2) THEN
-         CALL histwrite_phy(nid_files(iff), o_ozone_light%name, itau_w,
+         CALL histwrite_phy(nid_files(iff),clef_stations(iff), 
+     $o_ozone_light%name, itau_w,
      $        wo(:, :, 2) * dobson_u * 1e3 / zmasse / rmo3 * rmd)
       ENDIF
 
        IF (o_dtphy%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_dtphy%name,itau_w,d_t)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dtphy%name,itau_w,d_t)
        ENDIF
 
        IF (o_dqphy%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                  o_dqphy%name,itau_w, d_qx(:,:,ivap))
        ENDIF
@@ -1262,5 +1520,5 @@
         IF (o_albe_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN 
         zx_tmp_fi2d(1 : klon) = falb1( 1 : klon, nsrf)
-        CALL histwrite_phy(nid_files(iff),
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                    o_albe_srf(nsrf)%name,itau_w,
      $                     zx_tmp_fi2d)
@@ -1269,5 +1527,5 @@
         IF (o_rugs_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN  
         zx_tmp_fi2d(1 : klon) = frugs( 1 : klon, nsrf)
-        CALL histwrite_phy(nid_files(iff),
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                     o_rugs_srf(nsrf)%name,itau_w,
      $      zx_tmp_fi2d)
@@ -1276,5 +1534,5 @@
         IF (o_ages_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
         zx_tmp_fi2d(1 : klon) = agesno( 1 : klon, nsrf)
-        CALL histwrite_phy(nid_files(iff),
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                     o_ages_srf(nsrf)%name,itau_w
      $    ,zx_tmp_fi2d)
@@ -1283,9 +1541,11 @@
 
        IF (o_alb1%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_alb1%name,itau_w,albsol1)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_alb1%name,itau_w,albsol1)
        ENDIF
 
        IF (o_alb2%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_alb2%name,itau_w,albsol2)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_alb2%name,itau_w,albsol2)
        ENDIF
 
@@ -1300,59 +1560,108 @@
       enddo
        IF (o_tke%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_tke%name,itau_w,zx_tmp_fi3d)
-       ENDIF
-
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_tke%name,itau_w,zx_tmp_fi3d)
+       ENDIF
+
+      IF (.NOT.clef_stations(iff)) THEN
        IF (o_tke_max%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                   o_tke_max%name,itau_w,zx_tmp_fi3d)
        ENDIF
+      ENDIF
       endif
 
        IF (o_kz%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_kz%name,itau_w,coefh)
-       ENDIF
-
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_kz%name,itau_w,coefh)
+       ENDIF
+
+      IF (.NOT.clef_stations(iff)) THEN
        IF (o_kz_max%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_kz_max%name,itau_w,coefh)
-       ENDIF
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_kz_max%name,itau_w,coefh)
+       ENDIF
+      ENDIF
 
        IF (o_clwcon%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_clwcon%name,itau_w,clwcon0)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_clwcon%name,itau_w,clwcon0)
        ENDIF
 
        IF (o_dtdyn%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_dtdyn%name,itau_w,d_t_dyn)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dtdyn%name,itau_w,d_t_dyn)
        ENDIF
 
        IF (o_dqdyn%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_dqdyn%name,itau_w,d_q_dyn)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dqdyn%name,itau_w,d_q_dyn)
        ENDIF
 
        IF (o_dudyn%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_dudyn%name,itau_w,d_u_dyn)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dudyn%name,itau_w,d_u_dyn)
        ENDIF                                                    
 
        IF (o_dvdyn%flag(iff)<=lev_files(iff)) THEN                 
-      CALL histwrite_phy(nid_files(iff),o_dvdyn%name,itau_w,d_v_dyn)  
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dvdyn%name,itau_w,d_v_dyn)  
        ENDIF                                                     
 
        IF (o_dtcon%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=d_t_con(1:klon,1:klev)/pdtphys
-      CALL histwrite_phy(nid_files(iff),o_dtcon%name,itau_w,zx_tmp_fi3d)
-       ENDIF
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dtcon%name,itau_w,zx_tmp_fi3d)
+      ENDIF                                                     
+
+      if(iflag_thermals.eq.1)then
+      IF (o_tntc%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi3d(1:klon,1:klev)=d_t_con(1:klon,1:klev)/pdtphys +
+     $                           d_t_ajsb(1:klon,1:klev)/pdtphys
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_tntc%name,itau_w,zx_tmp_fi3d)
+      ENDIF
+      else if(iflag_thermals.gt.1.and.iflag_wake.EQ.1)then
+      IF (o_tntc%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi3d(1:klon,1:klev)=d_t_con(1:klon,1:klev)/pdtphys +
+     $                           d_t_ajs(1:klon,1:klev)/pdtphys +
+     $                           d_t_wake(1:klon,1:klev)/pdtphys
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_tntc%name,itau_w,zx_tmp_fi3d)
+      ENDIF
+      endif
 
        IF (o_ducon%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=d_u_con(1:klon,1:klev)/pdtphys
-      CALL histwrite_phy(nid_files(iff),o_ducon%name,itau_w,zx_tmp_fi3d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_ducon%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
        IF (o_dqcon%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=d_q_con(1:klon,1:klev)/pdtphys
-      CALL histwrite_phy(nid_files(iff),o_dqcon%name,itau_w,zx_tmp_fi3d)
-       ENDIF
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dqcon%name,itau_w,zx_tmp_fi3d)
+       ENDIF
+
+      if(iflag_thermals.eq.1)then
+       IF (o_tnhusc%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi3d(1:klon,1:klev)=d_q_con(1:klon,1:klev)/pdtphys
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_tnhusc%name,itau_w,zx_tmp_fi3d)
+       ENDIF
+      else if(iflag_thermals.gt.1.and.iflag_wake.EQ.1)then
+      IF (o_tnhusc%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi3d(1:klon,1:klev)=d_q_con(1:klon,1:klev)/pdtphys +
+     $                           d_q_ajs(1:klon,1:klev)/pdtphys +
+     $                           d_q_wake(1:klon,1:klev)/pdtphys
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_tnhusc%name,itau_w,zx_tmp_fi3d)
+      ENDIF
+      endif
 
        IF (o_dtlsc%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=d_t_lsc(1:klon,1:klev)/pdtphys
-      CALL histwrite_phy(nid_files(iff),o_dtlsc%name,itau_w,zx_tmp_fi3d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dtlsc%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
@@ -1360,5 +1669,5 @@
       zx_tmp_fi3d(1:klon, 1:klev)=(d_t_lsc(1:klon,1:klev)+
      $                           d_t_eva(1:klon,1:klev))/pdtphys
-      CALL histwrite_phy(nid_files(iff),
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                   o_dtlschr%name,itau_w,zx_tmp_fi3d)
        ENDIF
@@ -1366,5 +1675,6 @@
        IF (o_dqlsc%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=d_q_lsc(1:klon,1:klev)/pdtphys
-      CALL histwrite_phy(nid_files(iff),o_dqlsc%name,itau_w,zx_tmp_fi3d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dqlsc%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
@@ -1376,5 +1686,6 @@
       zx_tmp_fi3d(1:klon,1:klev)=d_t_lscth(1:klon,1:klev)/pdtphys
       CALL 
-     s histwrite_phy(nid_files(iff),o_dtlscth%name,itau_w,zx_tmp_fi3d)
+     s histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dtlscth%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
@@ -1382,5 +1693,6 @@
       zx_tmp_fi3d(1:klon,1:klev)=d_t_lscst(1:klon,1:klev)/pdtphys
       CALL 
-     s histwrite_phy(nid_files(iff),o_dtlscst%name,itau_w,zx_tmp_fi3d)
+     s histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dtlscst%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
@@ -1388,5 +1700,6 @@
       zx_tmp_fi3d(1:klon,1:klev)=d_q_lscth(1:klon,1:klev)/pdtphys
       CALL 
-     s histwrite_phy(nid_files(iff),o_dqlscth%name,itau_w,zx_tmp_fi3d)
+     s histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dqlscth%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
@@ -1394,13 +1707,16 @@
       zx_tmp_fi3d(1:klon,1:klev)=d_q_lscst(1:klon,1:klev)/pdtphys
       CALL 
-     s histwrite_phy(nid_files(iff),o_dqlscst%name,itau_w,zx_tmp_fi3d)
+     s histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dqlscst%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
        IF (o_plulth%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_plulth%name,itau_w,plul_th)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_plulth%name,itau_w,plul_th)
        ENDIF
 
        IF (o_plulst%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_plulst%name,itau_w,plul_st)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_plulst%name,itau_w,plul_st)
        ENDIF
 
@@ -1416,5 +1732,6 @@
        IF (o_ptconvth%flag(iff)<=lev_files(iff)) THEN
       CALL 
-     s  histwrite_phy(nid_files(iff),o_ptconvth%name,itau_w,zx_tmp_fi3d)
+     s  histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_ptconvth%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
@@ -1424,5 +1741,6 @@
        IF (o_ptconvth%flag(iff)<=lev_files(iff)) THEN
       CALL 
-     s histwrite_phy(nid_files(iff),o_lmaxth%name,itau_w,zx_tmp_fi2d)
+     s histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_lmaxth%name,itau_w,zx_tmp_fi2d)
        ENDIF
 
@@ -1433,20 +1751,24 @@
        IF (o_dtvdf%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=d_t_vdf(1:klon,1:klev)/pdtphys
-      CALL histwrite_phy(nid_files(iff),o_dtvdf%name,itau_w,zx_tmp_fi3d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dtvdf%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
        IF (o_dqvdf%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=d_q_vdf(1:klon,1:klev)/pdtphys
-      CALL histwrite_phy(nid_files(iff),o_dqvdf%name,itau_w,zx_tmp_fi3d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dqvdf%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
        IF (o_dteva%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=d_t_eva(1:klon,1:klev)/pdtphys
-      CALL histwrite_phy(nid_files(iff),o_dteva%name,itau_w,zx_tmp_fi3d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dteva%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
        IF (o_dqeva%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=d_q_eva(1:klon,1:klev)/pdtphys
-      CALL histwrite_phy(nid_files(iff),o_dqeva%name,itau_w,zx_tmp_fi3d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dqeva%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
@@ -1454,14 +1776,18 @@
       zpt_conv = 0.
       where (ptconv) zpt_conv = 1.
-      CALL histwrite_phy(nid_files(iff),o_ptconv%name,itau_w,zpt_conv)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_ptconv%name,itau_w,zpt_conv)
        ENDIF
 
        IF (o_ratqs%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_ratqs%name,itau_w,ratqs)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_ratqs%name,itau_w,ratqs)
        ENDIF
 
        IF (o_dtthe%flag(iff)<=lev_files(iff)) THEN
-      zx_tmp_fi3d(1:klon,1:klev)=d_t_ajs(1:klon,1:klev)/pdtphys
-      CALL histwrite_phy(nid_files(iff),o_dtthe%name,itau_w,zx_tmp_fi3d)
+      zx_tmp_fi3d(1:klon,1:klev)=d_t_ajs(1:klon,1:klev)/pdtphys -
+     $                           d_t_ajsb(1:klon,1:klev)/pdtphys
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dtthe%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
@@ -1470,49 +1796,59 @@
 ! Pour l instant 0 a y reflichir pour les thermiques
          zx_tmp_fi2d=0. 
-        CALL histwrite_phy(nid_files(iff),o_ftime_th%name,
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_ftime_th%name,
      s                     itau_w,zx_tmp_fi2d)
         ENDIF
 
         IF (o_f_th%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_f_th%name,itau_w,fm_therm)
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_f_th%name,itau_w,fm_therm)
         ENDIF
 
         IF (o_e_th%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_e_th%name,itau_w,entr_therm)
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_e_th%name,itau_w,entr_therm)
         ENDIF
 
         IF (o_w_th%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_w_th%name,itau_w,zw2)
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_w_th%name,itau_w,zw2)
         ENDIF
 
         IF (o_q_th%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_q_th%name,itau_w,zqasc)
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_q_th%name,itau_w,zqasc)
         ENDIF
 
         IF (o_lambda_th%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                     o_lambda_th%name,itau_w,lambda_th)
         ENDIF
 
         IF (o_a_th%flag(iff)<=lev_files(iff)) THEN
-        CALL histwrite_phy(nid_files(iff),o_a_th%name,itau_w,fraca)
+        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_a_th%name,itau_w,fraca)
         ENDIF
 
        IF (o_d_th%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_d_th%name,itau_w,detr_therm)
-       ENDIF
-
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_d_th%name,itau_w,detr_therm)
+       ENDIF
 
        IF (o_f0_th%flag(iff)<=lev_files(iff)) THEN
-      CALL histwrite_phy(nid_files(iff),o_f0_th%name,itau_w,f0)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_f0_th%name,itau_w,f0)
        ENDIF
 
        IF (o_zmax_th%flag(iff)<=lev_files(iff)) THEN
-       CALL histwrite_phy(nid_files(iff),o_zmax_th%name,itau_w,zmax_th)
+       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_zmax_th%name,itau_w,zmax_th)
        ENDIF
 
        IF (o_dqthe%flag(iff)<=lev_files(iff)) THEN
-      zx_tmp_fi3d(1:klon,1:klev)=d_q_ajs(1:klon,1:klev)/pdtphys
-      CALL histwrite_phy(nid_files(iff),o_dqthe%name,itau_w,zx_tmp_fi3d)
+      zx_tmp_fi3d(1:klon,1:klev)=d_q_ajs(1:klon,1:klev)/pdtphys -
+     $                           d_q_ajsb(1:klon,1:klev)/pdtphys
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dqthe%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
@@ -1521,45 +1857,54 @@
        IF (o_dtajs%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=d_t_ajsb(1:klon,1:klev)/pdtphys
-      CALL histwrite_phy(nid_files(iff),o_dtajs%name,itau_w,zx_tmp_fi3d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dtajs%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
        IF (o_dqajs%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=d_q_ajsb(1:klon,1:klev)/pdtphys
-      CALL histwrite_phy(nid_files(iff),o_dqajs%name,itau_w,zx_tmp_fi3d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dqajs%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
        IF (o_dtswr%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=heat(1:klon,1:klev)/RDAY
-      CALL histwrite_phy(nid_files(iff),o_dtswr%name,itau_w,zx_tmp_fi3d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dtswr%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
        IF (o_dtsw0%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=heat0(1:klon,1:klev)/RDAY
-      CALL histwrite_phy(nid_files(iff),o_dtsw0%name,itau_w,zx_tmp_fi3d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dtsw0%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
        IF (o_dtlwr%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=-1.*cool(1:klon,1:klev)/RDAY
-      CALL histwrite_phy(nid_files(iff),o_dtlwr%name,itau_w,zx_tmp_fi3d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dtlwr%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
        IF (o_dtlw0%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=-1.*cool0(1:klon,1:klev)/RDAY
-      CALL histwrite_phy(nid_files(iff),o_dtlw0%name,itau_w,zx_tmp_fi3d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dtlw0%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
        IF (o_dtec%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=d_t_ec(1:klon,1:klev)
-      CALL histwrite_phy(nid_files(iff),o_dtec%name,itau_w,zx_tmp_fi3d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dtec%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
        IF (o_duvdf%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=d_u_vdf(1:klon,1:klev)/pdtphys
-      CALL histwrite_phy(nid_files(iff),o_duvdf%name,itau_w,zx_tmp_fi3d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_duvdf%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
        IF (o_dvvdf%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=d_v_vdf(1:klon,1:klev)/pdtphys
-      CALL histwrite_phy(nid_files(iff),o_dvvdf%name,itau_w,zx_tmp_fi3d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dvvdf%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
@@ -1567,10 +1912,18 @@
       IF (o_duoro%flag(iff)<=lev_files(iff)) THEN 
       zx_tmp_fi3d(1:klon,1:klev)=d_u_oro(1:klon,1:klev)/pdtphys
-      CALL histwrite_phy(nid_files(iff),o_duoro%name,itau_w,zx_tmp_fi3d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_duoro%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
       IF (o_dvoro%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=d_v_oro(1:klon,1:klev)/pdtphys
-      CALL histwrite_phy(nid_files(iff),o_dvoro%name,itau_w,zx_tmp_fi3d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dvoro%name,itau_w,zx_tmp_fi3d)
+      ENDIF
+
+      IF (o_dtoro%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi3d(1:klon,1:klev)=d_t_oro(1:klon,1:klev)/pdtphys
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dtoro%name,itau_w,zx_tmp_fi3d)
       ENDIF
        ENDIF
@@ -1579,17 +1932,222 @@
        IF (o_dulif%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=d_u_lif(1:klon,1:klev)/pdtphys
-      CALL histwrite_phy(nid_files(iff),o_dulif%name,itau_w,zx_tmp_fi3d)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dulif%name,itau_w,zx_tmp_fi3d)
        ENDIF
 
         IF (o_dvlif%flag(iff)<=lev_files(iff)) THEN
       zx_tmp_fi3d(1:klon,1:klev)=d_v_lif(1:klon,1:klev)/pdtphys
-      CALL histwrite_phy(nid_files(iff),o_dvlif%name,itau_w,zx_tmp_fi3d)
-       ENDIF
-        ENDIF
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dvlif%name,itau_w,zx_tmp_fi3d)
+       ENDIF
+
+        IF (o_dtlif%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi3d(1:klon,1:klev)=d_t_lif(1:klon,1:klev)/pdtphys
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dtlif%name,itau_w,zx_tmp_fi3d)
+       ENDIF
+        ENDIF
+
+       IF (ok_hines) THEN
+       IF (o_duhin%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi3d(1:klon,1:klev)=d_u_hin(1:klon,1:klev)/pdtphys
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_duhin%name,itau_w,zx_tmp_fi3d)
+       ENDIF
+
+
+        IF (o_dvhin%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi3d(1:klon,1:klev)=d_v_hin(1:klon,1:klev)/pdtphys
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dvhin%name,itau_w,zx_tmp_fi3d)
+       ENDIF
+
+        IF (o_dthin%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi3d(1:klon,1:klev)=d_t_hin(1:klon,1:klev)/pdtphys
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dthin%name,itau_w,zx_tmp_fi3d)
+       ENDIF
+        ENDIF
+
+       IF (o_rsu%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rsu%name,itau_w,swup)
+       ENDIF
+       IF (o_rsd%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rsd%name,itau_w,swdn)
+       ENDIF
+       IF (o_rlu%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rlu%name,itau_w,lwup)
+       ENDIF
+       IF (o_rld%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rld%name,itau_w,lwdn)
+       ENDIF
+
+       IF (o_rsucs%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rsucs%name,itau_w,swup0)
+       ENDIF
+       IF (o_rsdcs%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rsdcs%name,itau_w,swdn0)
+       ENDIF
+       IF (o_rlucs%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rlucs%name,itau_w,lwup0)
+       ENDIF
+       IF (o_rldcs%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rldcs%name,itau_w,lwdn0)
+       ENDIF
+
+       IF (o_tnt%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi3d(1:klon,1:klev)=d_t(1:klon,1:klev)+
+     $d_t_dyn(1:klon,1:klev)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_tnt%name,itau_w,zx_tmp_fi3d)
+       ENDIF
+
+       IF (o_tntr%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi3d(1:klon,1:klev)=heat(1:klon,1:klev)/RDAY -
+     $cool(1:klon,1:klev)/RDAY
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_tntr%name,itau_w,zx_tmp_fi3d)
+       ENDIF
+
+       IF (o_tntscpbl%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi3d(1:klon,1:klev)= (d_t_lsc(1:klon,1:klev)+
+     $                             d_t_eva(1:klon,1:klev)+
+     $                             d_t_vdf(1:klon,1:klev))/pdtphys
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_tntscpbl%name,itau_w,zx_tmp_fi3d)
+       ENDIF
+
+       IF (o_tnhus%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi3d(1:klon,1:klev)=d_qx(1:klon,1:klev,ivap)+
+     $d_q_dyn(1:klon,1:klev)
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_tnhus%name,itau_w,zx_tmp_fi3d)
+       ENDIF
+
+       IF (o_tnhusscpbl%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi3d(1:klon,1:klev)=d_q_lsc(1:klon,1:klev)/pdtphys+
+     $                           d_q_eva(1:klon,1:klev)/pdtphys
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_tnhusscpbl%name,itau_w,zx_tmp_fi3d)
+       ENDIF
+
+       IF (o_evu%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_evu%name,itau_w,coefm)
+       ENDIF
+
+       IF (o_h2o%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi3d(1:klon,1:klev)=q_seri(1:klon,1:klev)+
+     $                           ql_seri(1:klon,1:klev) 
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_h2o%name,itau_w,zx_tmp_fi3d)
+       ENDIF
+
+       IF (o_mcd%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi3d(1:klon,1:klev)=-1 * (dnwd(1:klon,1:klev)+
+     $                                 dnwd0(1:klon,1:klev)) 
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_mcd%name,itau_w,zx_tmp_fi3d)
+       ENDIF
+
+       IF (o_dmc%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi3d(1:klon,1:klev)=upwd(1:klon,1:klev) +
+     $  dnwd(1:klon,1:klev)+ dnwd0(1:klon,1:klev) 
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_dmc%name,itau_w,zx_tmp_fi3d)
+       ENDIF
+
+       IF (o_ref_liq%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_ref_liq%name,itau_w,ref_liq)
+       ENDIF
+
+       IF (o_ref_ice%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_ref_ice%name,itau_w,ref_ice)
+       ENDIF
+
+      if (RCO2_per.NE.RCO2_act.OR.RCH4_per.NE.RCH4_act.OR.
+     $ RN2O_per.NE.RN2O_act.OR.RCFC11_per.NE.RCFC11_act.OR.
+     $ RCFC12_per.NE.RCFC12_act) THEN
+
+       IF (o_rsut4co2%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi2d(1 : klon) = swupp ( 1 : klon, klevp1 )
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rsut4co2%name,itau_w,zx_tmp_fi2d)
+       ENDIF
+
+       IF (o_rlut4co2%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi2d(1 : klon) = lwupp ( 1 : klon, klevp1 )
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rlut4co2%name,itau_w,zx_tmp_fi2d)
+       ENDIF
+
+       IF (o_rsutcs4co2%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi2d(1 : klon) = swup0p ( 1 : klon, klevp1 )
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rsutcs4co2%name,itau_w,zx_tmp_fi2d)
+       ENDIF
+
+       IF (o_rlutcs4co2%flag(iff)<=lev_files(iff)) THEN
+      zx_tmp_fi2d(1 : klon) = lwup0p ( 1 : klon, klevp1 )
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rlutcs4co2%name,itau_w,zx_tmp_fi2d)
+       ENDIF
+
+       IF (o_rsu4co2%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rsu4co2%name,itau_w,swupp)
+       ENDIF
+
+       IF (o_rlu4co2%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rlu4co2%name,itau_w,lwupp)
+       ENDIF
+
+       IF (o_rsucs4co2%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rsucs4co2%name,itau_w,swup0p)
+       ENDIF
+
+       IF (o_rlucs4co2%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rlucs4co2%name,itau_w,lwup0p)
+       ENDIF
+
+       IF (o_rsd4co2%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rsd4co2%name,itau_w,swdnp)
+       ENDIF
+
+       IF (o_rld4co2%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rld4co2%name,itau_w,lwdnp)
+       ENDIF
+
+       IF (o_rsdcs4co2%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rsdcs4co2%name,itau_w,swdn0p)
+       ENDIF
+
+       IF (o_rldcs4co2%flag(iff)<=lev_files(iff)) THEN
+      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
+     $o_rldcs4co2%name,itau_w,lwdn0p)
+       ENDIF
+
+      endif
 
         if (nqtot.GE.3) THEN
          DO iq=3,nqtot
        IF (o_trac(iq-2)%flag(iff)<=lev_files(iff)) THEN
-         CALL histwrite_phy(nid_files(iff),
+         CALL histwrite_phy(nid_files(iff),clef_stations(iff),
      s                  o_trac(iq-2)%name,itau_w,qx(:,:,iq))
        ENDIF
@@ -1599,5 +2157,5 @@
       if (ok_sync) then
 c$OMP MASTER
-        call histsync(nid_files(iff))
+      call histsync(nid_files(iff))
 c$OMP END MASTER
       endif
Index: /LMDZ5/trunk/libf/phylmd/phys_state_var_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/phylmd/phys_state_var_mod.F90	(revision 1538)
+++ /LMDZ5/trunk/libf/phylmd/phys_state_var_mod.F90	(revision 1539)
@@ -280,4 +280,28 @@
       REAL,ALLOCATABLE,SAVE :: albpla(:)
 !$OMP THREADPRIVATE(albpla)
+
+!IM ajout variables CFMIP2/CMIP5
+      REAL,ALLOCATABLE,SAVE :: heatp(:,:), coolp(:,:)
+!$OMP THREADPRIVATE(heatp, coolp)
+      REAL,ALLOCATABLE,SAVE :: heat0p(:,:), cool0p(:,:)
+!$OMP THREADPRIVATE(heat0p, cool0p)
+      REAL,ALLOCATABLE,SAVE :: radsolp(:), topswp(:), toplwp(:)
+!$OMP THREADPRIVATE(radsolp, topswp, toplwp)
+      REAL,ALLOCATABLE,SAVE :: albplap(:)
+!$OMP THREADPRIVATE(albplap)
+      REAL,ALLOCATABLE,SAVE :: solswp(:), sollwp(:)
+!$OMP THREADPRIVATE(solswp, sollwp)
+      REAL,ALLOCATABLE,SAVE :: sollwdownp(:)
+!$OMP THREADPRIVATE(sollwdownp)
+      REAL,ALLOCATABLE,SAVE :: topsw0p(:),toplw0p(:)
+      REAL,ALLOCATABLE,SAVE :: solsw0p(:),sollw0p(:)
+!$OMP THREADPRIVATE(topsw0p,toplw0p,solsw0p,sollw0p)
+      REAL,ALLOCATABLE,SAVE :: lwdn0p(:,:), lwdnp(:,:)
+      REAL,ALLOCATABLE,SAVE :: lwup0p(:,:), lwupp(:,:)
+!$OMP THREADPRIVATE(lwdn0p, lwdnp, lwup0p, lwupp)
+      REAL,ALLOCATABLE,SAVE :: swdn0p(:,:), swdnp(:,:)
+      REAL,ALLOCATABLE,SAVE :: swup0p(:,:), swupp(:,:)
+!$OMP THREADPRIVATE(swdn0p, swdnp, swup0p, swupp)
+
 ! pbase : cloud base pressure
 ! bbase : cloud base buoyancy
@@ -446,4 +470,18 @@
       ALLOCATE(topsw0(klon),toplw0(klon),solsw0(klon),sollw0(klon))
       ALLOCATE(albpla(klon))
+!IM ajout variables CFMIP2/CMIP5
+      ALLOCATE(heatp(klon,klev), coolp(klon,klev))
+      ALLOCATE(heat0p(klon,klev), cool0p(klon,klev))
+      ALLOCATE(radsolp(klon), topswp(klon), toplwp(klon))
+      ALLOCATE(albplap(klon))
+      ALLOCATE(solswp(klon), sollwp(klon))
+      ALLOCATE(sollwdownp(klon))
+      ALLOCATE(topsw0p(klon),toplw0p(klon))
+      ALLOCATE(solsw0p(klon),sollw0p(klon))
+      ALLOCATE(lwdn0p(klon,klevp1), lwdnp(klon,klevp1))
+      ALLOCATE(lwup0p(klon,klevp1), lwupp(klon,klevp1))
+      ALLOCATE(swdn0p(klon,klevp1), swdnp(klon,klevp1))
+      ALLOCATE(swup0p(klon,klevp1), swupp(klon,klevp1))
+
       ALLOCATE(cape(klon))
       ALLOCATE(pbase(klon),bbase(klon))
@@ -539,4 +577,17 @@
       deallocate(topsw0,toplw0,solsw0,sollw0)
       deallocate(albpla)
+!IM ajout variables CFMIP2/CMIP5
+      deallocate(heatp, coolp)
+      deallocate(heat0p, cool0p)
+      deallocate(radsolp, topswp, toplwp)
+      deallocate(albplap)
+      deallocate(solswp, sollwp)
+      deallocate(sollwdownp)
+      deallocate(topsw0p,toplw0p)
+      deallocate(solsw0p,sollw0p)
+      deallocate(lwdn0p, lwdnp)
+      deallocate(lwup0p, lwupp)
+      deallocate(swdn0p, swdnp)
+      deallocate(swup0p, swupp)
       deallocate(cape)
       deallocate(pbase,bbase)
Index: /LMDZ5/trunk/libf/phylmd/physiq.F
===================================================================
--- /LMDZ5/trunk/libf/phylmd/physiq.F	(revision 1538)
+++ /LMDZ5/trunk/libf/phylmd/physiq.F	(revision 1539)
@@ -44,4 +44,6 @@
 
 
+!IM stations CFMIP
+      USE CFMIP_point_locations
       IMPLICIT none
 c======================================================================
@@ -699,4 +701,5 @@
 cAA
       REAL coefh(klon,klev)     ! coef d'echange pour phytrac, valable pour 2<=k<=klev
+      REAL coefm(klon,klev)     ! coef d'echange pour U, V
       REAL u1(klon)             ! vents dans la premiere couche U
       REAL v1(klon)             ! vents dans la premiere couche V
@@ -1011,4 +1014,5 @@
       REAL zx_tmp_fi2d(klon)      ! variable temporaire grille physique
       REAL zx_tmp_fi3d(klon,klev) ! variable temporaire pour champs 3D 
+      REAL zx_tmp_fi3d1(klon,klev+1) !variable temporaire pour champs 3D (kelvp1)
 c#ifdef histNMC
 cym   A voir plus tard !!!!
@@ -1041,6 +1045,4 @@
       REAL ue_lay(klon,klev) ! transport zonal de l'energie a chaque niveau vert.
       REAL uq_lay(klon,klev) ! transport zonal de l'eau a chaque niveau vert.
-c
-cIM 280405 END
 c
       INTEGER nhori, nvert, nvert1, nvert3
@@ -1188,4 +1190,30 @@
       REAL grain(1), gtsol(1), gt2m(1), gprw(1)
 
+cIM stations CFMIP
+      INTEGER, SAVE :: nCFMIP
+c$OMP THREADPRIVATE(nCFMIP)
+      INTEGER, PARAMETER :: npCFMIP=120
+      INTEGER, ALLOCATABLE, SAVE :: tabCFMIP(:)
+      REAL, ALLOCATABLE, SAVE :: lonCFMIP(:), latCFMIP(:)
+c$OMP THREADPRIVATE(tabCFMIP, lonCFMIP, latCFMIP) 
+      INTEGER, ALLOCATABLE, SAVE :: tabijGCM(:)
+      REAL, ALLOCATABLE, SAVE :: lonGCM(:), latGCM(:)
+c$OMP THREADPRIVATE(tabijGCM, lonGCM, latGCM)
+      INTEGER, ALLOCATABLE, SAVE :: iGCM(:), jGCM(:)
+c$OMP THREADPRIVATE(iGCM, jGCM)
+      logical, dimension(nfiles)            :: phys_out_filestations
+      logical, parameter :: lNMC=.FALSE.
+
+cIM betaCRF
+      REAL, SAVE :: pfree, beta_pbl, beta_free
+c$OMP THREADPRIVATE(pfree, beta_pbl, beta_free)
+      REAL, SAVE :: lon1_beta,  lon2_beta, lat1_beta, lat2_beta
+c$OMP THREADPRIVATE(lon1_beta,  lon2_beta, lat1_beta, lat2_beta)
+      LOGICAL, SAVE :: mskocean_beta
+c$OMP THREADPRIVATE(mskocean_beta)
+      REAL, dimension(klon, klev) :: beta       ! facteur sur cldtaurad et cldemirad pour evaluer les retros liees aux CRF
+      REAL, dimension(klon, klev) :: cldtaurad  ! epaisseur optique pour radlwsw,COSP
+      REAL, dimension(klon, klev) :: cldemirad  ! emissivite pour radlwsw,COSP 
+
 cIM for NMC files
       missing_val=nf90_fill_real
@@ -1472,7 +1500,42 @@
 
 c================================================================================
-
+cIM stations CFMIP
+      nCFMIP=npCFMIP
+      OPEN(98,file='npCFMIP_param.data',status='old',
+     $          form='formatted',err=999)
+      READ(98,*,end=998) nCFMIP
+998   CONTINUE
+      CLOSE(98)
+      CONTINUE
+      IF(nCFMIP.GT.npCFMIP) THEN
+       print*,'nCFMIP > npCFMIP : augmenter npCFMIP et recompiler'
+       CALL abort
+      else
+       print*,'physiq npCFMIP=',npCFMIP,'nCFMIP=',nCFMIP
+      ENDIF
+c
+      ALLOCATE(tabCFMIP(nCFMIP))
+      ALLOCATE(lonCFMIP(nCFMIP), latCFMIP(nCFMIP))
+      ALLOCATE(tabijGCM(nCFMIP))
+      ALLOCATE(lonGCM(nCFMIP), latGCM(nCFMIP))
+      ALLOCATE(iGCM(nCFMIP), jGCM(nCFMIP))
+c
+c lecture des nCFMIP stations CFMIP, de leur numero 
+c et des coordonnees geographiques lonCFMIP, latCFMIP
+c
+         CALL read_CFMIP_point_locations(nCFMIP, tabCFMIP, 
+     $lonCFMIP, latCFMIP)
+c
+c identification des
+c 1) coordonnees lonGCM, latGCM des points CFMIP dans la grille de LMDZ
+c 2) indices points tabijGCM de la grille physique 1d sur klon points
+c 3) indices iGCM, jGCM de la grille physique 2d
+c
+         CALL LMDZ_CFMIP_point_locations(nCFMIP, lonCFMIP, latCFMIP,
+     $tabijGCM, lonGCM, latGCM, iGCM, jGCM)
+c
+999      CONTINUE
          ENDIF !debut
-
+ 
            DO i=1,klon
              rugoro(i) = f_rugoro * MAX(1.0e-05, zstd(i)*zsig(i)/2.0)
@@ -1512,6 +1575,4 @@
      .                   lmt_pas
 c
-cIM 030306 END
-
       capemaxcels = 't_max(X)'
       t2mincels = 't_min(X)'
@@ -1530,9 +1591,12 @@
 
 c$OMP MASTER
-       call phys_output_open(jjmp1,nlevSTD,clevSTD,nbteta, 
-     &                        ctetaSTD,dtime,ok_veget,
-     &                        type_ocean,iflag_pbl,ok_mensuel,ok_journe,
-     &                        ok_hf,ok_instan,ok_LES,ok_ade,ok_aie, 
-     &                        read_climoz, new_aod, aerosol_couple
+       call phys_output_open(rlon,rlat,nCFMIP,tabijGCM,
+     &                       iGCM,jGCM,lonGCM,latGCM,
+     &                       jjmp1,nlevSTD,clevSTD,
+     &                       nbteta, ctetaSTD, dtime,ok_veget,
+     &                       type_ocean,iflag_pbl,ok_mensuel,ok_journe,
+     &                       ok_hf,ok_instan,ok_LES,ok_ade,ok_aie, 
+     &                       read_climoz, phys_out_filestations,
+     &                       new_aod, aerosol_couple
      &                        )
 c$OMP END MASTER
@@ -1555,5 +1619,4 @@
 #endif
 
-cIM 250308bad guide        ecrit_hf2mth = 30*1/ecrit_hf 
          ecrit_hf2mth = ecrit_mth/ecrit_hf
 
@@ -1568,5 +1631,4 @@
          ecrit_reg = ecrit_reg * un_jour
          ecrit_tra = ecrit_tra * un_jour
-         ecrit_ISCCP = ecrit_ISCCP * un_jour
          ecrit_LES = ecrit_LES * un_jour
 c
@@ -1574,6 +1636,4 @@
      .   ecrit_hf,ecrit_day,ecrit_mth,ecrit_reg,ecrit_tra,ecrit_ISCCP,
      .   ecrit_hf2mth
-cIM 030306 END
-
 
 cXXXPB Positionner date0 pour initialisation de ORCHIDEE
@@ -1633,4 +1693,36 @@
       END IF
 C$omp end single
+c
+cIM betaCRF
+      pfree=70000. !Pa
+      beta_pbl=1.
+      beta_free=1.
+      lon1_beta=-180.
+      lon2_beta=+180.
+      lat1_beta=90.
+      lat2_beta=-90.
+      mskocean_beta=.FALSE.
+
+      OPEN(99,file='beta_crf.data',status='old',
+     $          form='formatted',err=9999)
+      READ(99,*,end=9998) pfree
+      READ(99,*,end=9998) beta_pbl
+      READ(99,*,end=9998) beta_free
+      READ(99,*,end=9998) lon1_beta
+      READ(99,*,end=9998) lon2_beta
+      READ(99,*,end=9998) lat1_beta
+      READ(99,*,end=9998) lat2_beta
+      READ(99,*,end=9998) mskocean_beta
+9998  Continue
+      CLOSE(99)
+9999  Continue
+      WRITE(*,*)'pfree=',pfree
+      WRITE(*,*)'beta_pbl=',beta_pbl
+      WRITE(*,*)'beta_free=',beta_free
+      WRITE(*,*)'lon1_beta=',lon1_beta
+      WRITE(*,*)'lon2_beta=',lon2_beta
+      WRITE(*,*)'lat1_beta=',lat1_beta
+      WRITE(*,*)'lat2_beta=',lat2_beta
+      WRITE(*,*)'mskocean_beta=',mskocean_beta
       ENDIF
 !
@@ -1949,5 +2041,5 @@
      s     zxtsol,    zxfluxlat, zt2m,    qsat2m, 
      s     d_t_vdf,   d_q_vdf,   d_u_vdf, d_v_vdf,
-     s     coefh,     slab_wfbils,                
+     s     coefh,     coefm,     slab_wfbils,                
      d     qsol,      zq2m,      s_pblh,  s_lcl,
      d     s_capCL,   s_oliqCL,  s_cteiCL,s_pblT,
@@ -1965,5 +2057,4 @@
 ! ajout des tendances de la diffusion turbulente
       CALL add_phys_tend(d_u_vdf,d_v_vdf,d_t_vdf,d_q_vdf,dql0,'vdf')
-
 !-----------------------------------------------------------------------------------------
 
@@ -2103,5 +2194,4 @@
             enddo
          enddo
-
       
 cc--   Calcul de l'energie disponible ALE (J/kg) et de la puissance disponible ALP (W/m2)
@@ -2524,5 +2614,4 @@
 
 
-
 c  Ajustement sec
 c  ==============
@@ -2740,5 +2829,4 @@
 
 
-
 c
 c Appeler le processus de condensation a grande echelle
@@ -2873,7 +2961,5 @@
      &        tausum_aero, tau3d_aero)
       ELSE
-cIM 170310 BEG
          tausum_aero(:,:,:) = 0.
-cIM 170310 END
          tau_aero(:,:,:,:) = 0.
          piz_aero(:,:,:,:) = 0.
@@ -3149,4 +3235,55 @@
       endif
 c
+cIM betaCRF
+c
+      cldtaurad = cldtau
+      cldemirad = cldemi
+c
+      if(lon1_beta.EQ.-180..AND.lon2_beta.EQ.180..AND.
+     $lat1_beta.EQ.90..AND.lat2_beta.EQ.-90.) THEN
+c
+c global
+c
+       DO k=1, klev
+       DO i=1, klon
+        if (pplay(i,k).GE.pfree) THEN
+         beta(i,k) = beta_pbl
+        else
+         beta(i,k) = beta_free
+        endif
+        if (mskocean_beta) THEN
+         beta(i,k) = beta(i,k) * pctsrf(i,is_oce)
+        endif
+        cldtaurad(i,k) = cldtau(i,k) * beta(i,k)
+        cldemirad(i,k) = cldemi(i,k) * beta(i,k)
+       ENDDO
+       ENDDO 
+c
+      else
+c
+c regional
+c
+       DO k=1, klev
+       DO i=1,klon
+c
+        if (rlon(i).ge.lon1_beta.AND.rlon(i).le.lon2_beta.AND.
+     $      rlat(i).le.lat1_beta.AND.rlat(i).ge.lat2_beta) THEN
+         if (pplay(i,k).GE.pfree) THEN
+          beta(i,k) = beta_pbl
+         else
+          beta(i,k) = beta_free
+         endif
+         if (mskocean_beta) THEN
+          beta(i,k) = beta(i,k) * pctsrf(i,is_oce)
+         endif
+        cldtaurad(i,k) = cldtau(i,k) * beta(i,k)
+        cldemirad(i,k) = cldemi(i,k) * beta(i,k)
+        endif
+c
+       ENDDO
+       ENDDO
+c
+      endif
+c
 c Appeler le rayonnement mais calculer tout d'abord l'albedo du sol.
 c
@@ -3177,5 +3314,5 @@
      e        paprs, pplay,zxtsol,albsol1, albsol2, t_seri,q_seri,
      e        wo(:, :, 1),
-     e        cldfra, cldemi, cldtau,
+     e        cldfra, cldemirad, cldtaurad,
      s        heat,heat0,cool,cool0,radsol,albpla,
      s        topsw,toplw,solsw,sollw,
@@ -3195,10 +3332,18 @@
 #endif
       ELSE
-
+c
+cIM calcul radiatif pour le cas actuel
+c
+       RCO2 = RCO2_act
+       RCH4 = RCH4_act
+       RN2O = RN2O_act
+       RCFC11 = RCFC11_act
+       RCFC12 = RCFC12_act
+c
          CALL radlwsw
      e        (dist, rmu0, fract, 
      e        paprs, pplay,zxtsol,albsol1, albsol2, 
      e        t_seri,q_seri,wo,
-     e        cldfra, cldemi, cldtau,
+     e        cldfra, cldemirad, cldtaurad,
      e        ok_ade, ok_aie,
      e        tau_aero, piz_aero, cg_aero,
@@ -3218,5 +3363,42 @@
      o        topswcf_aero, solswcf_aero)
          
-
+c
+cIM 2eme calcul radiatif pour le cas perturbe ou au moins un
+cIM des taux doit etre different du taux actuel
+cIM Par defaut on a les taux perturbes egaux aux taux actuels
+c
+       if (RCO2_per.NE.RCO2_act.OR.RCH4_per.NE.RCH4_act.OR.
+     $RN2O_per.NE.RN2O_act.OR.RCFC11_per.NE.RCFC11_act.OR.
+     $RCFC12_per.NE.RCFC12_act) THEN
+c
+       RCO2 = RCO2_per
+       RCH4 = RCH4_per
+       RN2O = RN2O_per
+       RCFC11 = RCFC11_per
+       RCFC12 = RCFC12_per
+c
+         CALL radlwsw
+     e        (dist, rmu0, fract, 
+     e        paprs, pplay,zxtsol,albsol1, albsol2, 
+     e        t_seri,q_seri,wo,
+     e        cldfra, cldemi, cldtau,
+     e        ok_ade, ok_aie,
+     e        tau_aero, piz_aero, cg_aero,
+     e        cldtaupi,new_aod,
+     e        zqsat, flwc, fiwc,
+     s        heatp,heat0p,coolp,cool0p,radsolp,albplap,
+     s        topswp,toplwp,solswp,sollwp,
+     s        sollwdownp,
+     s        topsw0p,toplw0p,solsw0p,sollw0p,
+     s        lwdn0p, lwdnp, lwup0p, lwupp, 
+     s        swdn0p, swdnp, swup0p, swupp,
+     s        topswad_aerop, solswad_aerop,
+     s        topswai_aerop, solswai_aerop,
+     o        topswad0_aerop, solswad0_aerop,
+     o        topsw_aerop, topsw0_aerop,
+     o        solsw_aerop, solsw0_aerop,
+     o        topswcf_aerop, solswcf_aerop)
+       endif
+c
       ENDIF ! aerosol_couple
       itaprad = 0
@@ -3384,5 +3566,5 @@
 c
 c  ajout des tendances
-        CALL add_phys_tend(d_u_hin,d_v_hin,d_t_hin,dq0,dql0,'lif')
+        CALL add_phys_tend(d_u_hin,d_v_hin,d_t_hin,dq0,dql0,'hin')
 
       ENDIF
@@ -3397,5 +3579,5 @@
         call writefield_phy('v_seri',v_seri,llm)
         call writefield_phy('t_seri',t_seri,llm)
-        call writefield_phy('q_seri',q_seri,llm)
+	call writefield_phy('q_seri',q_seri,llm)
       endif
 
@@ -3465,5 +3647,5 @@
      $                   prfl(:,1:klev),psfl(:,1:klev),
      $                   pmflxr(:,1:klev),pmflxs(:,1:klev),
-     $                   mr_ozone,cldtau, cldemi)
+     $                   mr_ozone,cldtaurad, cldemirad)
 
 !     L          calipso2D,calipso3D,cfadlidar,parasolrefl,atb,betamol,
@@ -3616,5 +3798,4 @@
 c
 cIM initialisation 5eme fichier de sortie 
-cIM ajoute 5eme niveau 170310 BEG
       twriteSTD(:,:,5)=tlevSTD(:,:)
       qwriteSTD(:,:,5)=qlevSTD(:,:)
@@ -3624,4 +3805,13 @@
       vwriteSTD(:,:,5)=vlevSTD(:,:)
       wwriteSTD(:,:,5)=wlevSTD(:,:)
+c
+cIM initialisation 6eme fichier de sortie 
+      twriteSTD(:,:,6)=tlevSTD(:,:)
+      qwriteSTD(:,:,6)=qlevSTD(:,:)
+      rhwriteSTD(:,:,6)=rhlevSTD(:,:)
+      phiwriteSTD(:,:,6)=philevSTD(:,:)
+      uwriteSTD(:,:,6)=ulevSTD(:,:)
+      vwriteSTD(:,:,6)=vlevSTD(:,:)
+      wwriteSTD(:,:,6)=wlevSTD(:,:)
 cIM for NMC files
       DO n=1, nlevSTD3
Index: /LMDZ5/trunk/libf/phylmd/phystokenc.F90
===================================================================
--- /LMDZ5/trunk/libf/phylmd/phystokenc.F90	(revision 1538)
+++ /LMDZ5/trunk/libf/phylmd/phystokenc.F90	(revision 1539)
@@ -125,4 +125,5 @@
   LOGICAL ok_sync
   CHARACTER(len=12) :: nvar
+  logical, parameter :: lstokenc=.FALSE.
 !
 !======================================================================
@@ -164,8 +165,8 @@
      
      ! Write field phis and aire only once
-     CALL histwrite_phy(physid,"phis",itap,pphis)
-     CALL histwrite_phy(physid,"aire",itap,paire)
-     CALL histwrite_phy(physid,"longitudes",itap,rlon)
-     CALL histwrite_phy(physid,"latitudes",itap,rlat)
+     CALL histwrite_phy(physid,lstokenc,"phis",itap,pphis)
+     CALL histwrite_phy(physid,lstokenc,"aire",itap,paire)
+     CALL histwrite_phy(physid,lstokenc,"longitudes",itap,rlon)
+     CALL histwrite_phy(physid,lstokenc,"latitudes",itap,rlat)
 
   END IF
@@ -288,31 +289,31 @@
 
      ! write fields
-     CALL histwrite_phy(physid,"t",itap,t)
-     CALL histwrite_phy(physid,"mfu",itap,mfu)
-     CALL histwrite_phy(physid,"mfd",itap,mfd)
-     CALL histwrite_phy(physid,"en_u",itap,en_u)
-     CALL histwrite_phy(physid,"de_u",itap,de_u)
-     CALL histwrite_phy(physid,"en_d",itap,en_d)
-     CALL histwrite_phy(physid,"de_d",itap,de_d)
-     CALL histwrite_phy(physid,"coefh",itap,coefh)	
-     CALL histwrite_phy(physid,"fm_th",itap,fm_therm)
-     CALL histwrite_phy(physid,"en_th",itap,entr_therm)
-     CALL histwrite_phy(physid,"frac_impa",itap,frac_impa)
-     CALL histwrite_phy(physid,"frac_nucl",itap,frac_nucl)
-     CALL histwrite_phy(physid,"pyu1",itap,pyu1)
-     CALL histwrite_phy(physid,"pyv1",itap,pyv1)
-     CALL histwrite_phy(physid,"ftsol1",itap,pftsol(:,1))
-     CALL histwrite_phy(physid,"ftsol2",itap,pftsol(:,2))
-     CALL histwrite_phy(physid,"ftsol3",itap,pftsol(:,3))
-     CALL histwrite_phy(physid,"ftsol4",itap,pftsol(:,4))
-     CALL histwrite_phy(physid,"psrf1",itap,ppsrf(:,1))
-     CALL histwrite_phy(physid,"psrf2",itap,ppsrf(:,2))
-     CALL histwrite_phy(physid,"psrf3",itap,ppsrf(:,3))
-     CALL histwrite_phy(physid,"psrf4",itap,ppsrf(:,4))
-     CALL histwrite_phy(physid,"sh",itap,sh)
-     CALL histwrite_phy(physid,"da",itap,da)
-     CALL histwrite_phy(physid,"mp",itap,mp)
-     CALL histwrite_phy(physid,"upwd",itap,upwd)
-     CALL histwrite_phy(physid,"dnwd",itap,dnwd)
+     CALL histwrite_phy(physid,lstokenc,"t",itap,t)
+     CALL histwrite_phy(physid,lstokenc,"mfu",itap,mfu)
+     CALL histwrite_phy(physid,lstokenc,"mfd",itap,mfd)
+     CALL histwrite_phy(physid,lstokenc,"en_u",itap,en_u)
+     CALL histwrite_phy(physid,lstokenc,"de_u",itap,de_u)
+     CALL histwrite_phy(physid,lstokenc,"en_d",itap,en_d)
+     CALL histwrite_phy(physid,lstokenc,"de_d",itap,de_d)
+     CALL histwrite_phy(physid,lstokenc,"coefh",itap,coefh)	
+     CALL histwrite_phy(physid,lstokenc,"fm_th",itap,fm_therm)
+     CALL histwrite_phy(physid,lstokenc,"en_th",itap,entr_therm)
+     CALL histwrite_phy(physid,lstokenc,"frac_impa",itap,frac_impa)
+     CALL histwrite_phy(physid,lstokenc,"frac_nucl",itap,frac_nucl)
+     CALL histwrite_phy(physid,lstokenc,"pyu1",itap,pyu1)
+     CALL histwrite_phy(physid,lstokenc,"pyv1",itap,pyv1)
+     CALL histwrite_phy(physid,lstokenc,"ftsol1",itap,pftsol(:,1))
+     CALL histwrite_phy(physid,lstokenc,"ftsol2",itap,pftsol(:,2))
+     CALL histwrite_phy(physid,lstokenc,"ftsol3",itap,pftsol(:,3))
+     CALL histwrite_phy(physid,lstokenc,"ftsol4",itap,pftsol(:,4))
+     CALL histwrite_phy(physid,lstokenc,"psrf1",itap,ppsrf(:,1))
+     CALL histwrite_phy(physid,lstokenc,"psrf2",itap,ppsrf(:,2))
+     CALL histwrite_phy(physid,lstokenc,"psrf3",itap,ppsrf(:,3))
+     CALL histwrite_phy(physid,lstokenc,"psrf4",itap,ppsrf(:,4))
+     CALL histwrite_phy(physid,lstokenc,"sh",itap,sh)
+     CALL histwrite_phy(physid,lstokenc,"da",itap,da)
+     CALL histwrite_phy(physid,lstokenc,"mp",itap,mp)
+     CALL histwrite_phy(physid,lstokenc,"upwd",itap,upwd)
+     CALL histwrite_phy(physid,lstokenc,"dnwd",itap,dnwd)
 
 
@@ -328,5 +329,5 @@
         nvar='phi_lev'//trim(nvar)
         
-        CALL histwrite_phy(physid,nvar,itap,phi(:,:,k))
+        CALL histwrite_phy(physid,lstokenc,nvar,itap,phi(:,:,k))
      END DO
      
Index: /LMDZ5/trunk/libf/phylmd/write_histdayNMC.h
===================================================================
--- /LMDZ5/trunk/libf/phylmd/write_histdayNMC.h	(revision 1538)
+++ /LMDZ5/trunk/libf/phylmd/write_histdayNMC.h	(revision 1539)
@@ -15,21 +15,37 @@
 ccc
       IF(lev_histdayNMC.EQ.nlevSTD) THEN
-       CALL histwrite_phy(nid_daynmc,"tnondef",itau_w,tnondef(:,:,2))
-       CALL histwrite_phy(nid_daynmc,"ta",itau_w,twriteSTD(:,:,2))
-       CALL histwrite_phy(nid_daynmc,"zg",itau_w,phiwriteSTD(:,:,2))
-       CALL histwrite_phy(nid_daynmc,"hus",itau_w,qwriteSTD(:,:,2))
-       CALL histwrite_phy(nid_daynmc,"hur",itau_w,rhwriteSTD(:,:,2))
-       CALL histwrite_phy(nid_daynmc,"ua",itau_w,uwriteSTD(:,:,2))
-       CALL histwrite_phy(nid_daynmc,"va",itau_w,vwriteSTD(:,:,2))
-       CALL histwrite_phy(nid_daynmc,"wap",itau_w,wwriteSTD(:,:,2))
+       CALL histwrite_phy(nid_daynmc,lNMC,"tnondef",itau_w,
+     $tnondef(:,:,2))
+       CALL histwrite_phy(nid_daynmc,lNMC,"ta",itau_w,
+     $twriteSTD(:,:,2))
+       CALL histwrite_phy(nid_daynmc,lNMC,"zg",itau_w,
+     $phiwriteSTD(:,:,2))
+       CALL histwrite_phy(nid_daynmc,lNMC,"hus",itau_w,
+     $qwriteSTD(:,:,2))
+       CALL histwrite_phy(nid_daynmc,lNMC,"hur",itau_w,
+     $rhwriteSTD(:,:,2))
+       CALL histwrite_phy(nid_daynmc,lNMC,"ua",itau_w,
+     $uwriteSTD(:,:,2))
+       CALL histwrite_phy(nid_daynmc,lNMC,"va",itau_w,
+     $vwriteSTD(:,:,2))
+       CALL histwrite_phy(nid_daynmc,lNMC,"wap",itau_w,
+     $wwriteSTD(:,:,2))
       ELSE IF(lev_histdayNMC.EQ.nlevSTD8) THEN
-       CALL histwrite_phy(nid_daynmc,"tnondef",itau_w,tnondefSTD8)
-       CALL histwrite_phy(nid_daynmc,"ta",itau_w,twriteSTD8)
-       CALL histwrite_phy(nid_daynmc,"zg",itau_w,phiwriteSTD8)
-       CALL histwrite_phy(nid_daynmc,"hus",itau_w,qwriteSTD8)
-       CALL histwrite_phy(nid_daynmc,"hur",itau_w,rhwriteSTD8)
-       CALL histwrite_phy(nid_daynmc,"ua",itau_w,uwriteSTD8)
-       CALL histwrite_phy(nid_daynmc,"va",itau_w,vwriteSTD8)
-       CALL histwrite_phy(nid_daynmc,"wap",itau_w,wwriteSTD8)
+       CALL histwrite_phy(nid_daynmc,lNMC,"tnondef",itau_w,
+     $tnondefSTD8)
+       CALL histwrite_phy(nid_daynmc,lNMC,"ta",itau_w,
+     $twriteSTD8)
+       CALL histwrite_phy(nid_daynmc,lNMC,"zg",itau_w,
+     $phiwriteSTD8)
+       CALL histwrite_phy(nid_daynmc,lNMC,"hus",itau_w,
+     $qwriteSTD8)
+       CALL histwrite_phy(nid_daynmc,lNMC,"hur",itau_w,
+     $rhwriteSTD8)
+       CALL histwrite_phy(nid_daynmc,lNMC,"ua",itau_w,
+     $uwriteSTD8)
+       CALL histwrite_phy(nid_daynmc,lNMC,"va",itau_w,
+     $vwriteSTD8)
+       CALL histwrite_phy(nid_daynmc,lNMC,"wap",itau_w,
+     $wwriteSTD8)
       ENDIF
 c
Index: /LMDZ5/trunk/libf/phylmd/write_histhfNMC.h
===================================================================
--- /LMDZ5/trunk/libf/phylmd/write_histhfNMC.h	(revision 1538)
+++ /LMDZ5/trunk/libf/phylmd/write_histhfNMC.h	(revision 1539)
@@ -14,19 +14,29 @@
 c nout=3 : in=pdtphys,    out=hf
 ccc
-       CALL histwrite_phy(nid_hfnmc,"tnondef",itau_w,tnondef(:,:,3))
+      CALL histwrite_phy(nid_hfnmc,lNMC,"tnondef",itau_w,
+     $tnondef(:,:,3))
 c
-       CALL histwrite_phy(nid_hfnmc,"ta",itau_w,twriteSTD3)
+       CALL histwrite_phy(nid_hfnmc,lNMC,"ta",itau_w,
+     $twriteSTD3)
 c
-       CALL histwrite_phy(nid_hfnmc,"zg",itau_w,phiwriteSTD3)
+       CALL histwrite_phy(nid_hfnmc,lNMC,"zg",itau_w,
+     $phiwriteSTD3)
 c
-       CALL histwrite_phy(nid_hfnmc,"hus",itau_w,qwriteSTD3)
+       CALL histwrite_phy(nid_hfnmc,lNMC,"hus",itau_w,
+     $qwriteSTD3)
 c
-       CALL histwrite_phy(nid_hfnmc,"hur",itau_w,rhwriteSTD3)
+       CALL histwrite_phy(nid_hfnmc,lNMC,"hur",itau_w,
+     $rhwriteSTD3)
 c
-       CALL histwrite_phy(nid_hfnmc,"ua",itau_w,uwriteSTD3)
+       CALL histwrite_phy(nid_hfnmc,lNMC,"ua",itau_w,
+     $uwriteSTD3)
 c
-       CALL histwrite_phy(nid_hfnmc,"va",itau_w,vwriteSTD3)
+       CALL histwrite_phy(nid_hfnmc,lNMC,"va",itau_w,
+     $vwriteSTD3)
 c
-       CALL histwrite_phy(nid_hfnmc,"wap",itau_w,wwriteSTD3)
+       CALL histwrite_phy(nid_hfnmc,lNMC,"wap",itau_w,
+     $wwriteSTD3)
+c
+       IF (1.EQ.0) THEN
 c
        DO k=1, nlevSTD
@@ -40,25 +50,35 @@
        ENDDO !k=1, nlevSTD
 c
-       CALL histwrite_phy(nid_hfnmc,"psbg",itau_w,zx_tmp_fiNC)
+       CALL histwrite_phy(nid_hfnmc,lNMC,"psbg",itau_w,
+     $zx_tmp_fiNC)
 c
-       CALL histwrite_phy(nid_hfnmc,"uv",itau_w,uvsumSTD(:,:,3))
+       CALL histwrite_phy(nid_hfnmc,lNMC,"uv",itau_w,
+     $uvsumSTD(:,:,3))
 c
-       CALL histwrite_phy(nid_hfnmc,"vq",itau_w,vqsumSTD(:,:,3))
+       CALL histwrite_phy(nid_hfnmc,lNMC,"vq",itau_w,
+     $vqsumSTD(:,:,3))
 c
-       CALL histwrite_phy(nid_hfnmc,"vT",itau_w,vTsumSTD(:,:,3))
+       CALL histwrite_phy(nid_hfnmc,lNMC,"vT",itau_w,
+     $vTsumSTD(:,:,3))
 c
-       CALL histwrite_phy(nid_hfnmc,"wq",itau_w,wqsumSTD(:,:,3))
+       CALL histwrite_phy(nid_hfnmc,lNMC,"wq",itau_w,
+     $wqsumSTD(:,:,3))
 c
-       CALL histwrite_phy(nid_hfnmc,"vphi",itau_w,vphisumSTD(:,:,3))
+      CALL histwrite_phy(nid_hfnmc,lNMC,"vphi",itau_w,
+     $vphisumSTD(:,:,3))
 c
-       CALL histwrite_phy(nid_hfnmc,"wT",itau_w,wTsumSTD(:,:,3))
+       CALL histwrite_phy(nid_hfnmc,lNMC,"wT",itau_w,
+     $wTsumSTD(:,:,3))
 c
-       CALL histwrite_phy(nid_hfnmc,"uxu",itau_w,u2sumSTD(:,:,3))
+       CALL histwrite_phy(nid_hfnmc,lNMC,"uxu",itau_w,
+     $u2sumSTD(:,:,3))
 c
-       CALL histwrite_phy(nid_hfnmc,"vxv",itau_w,v2sumSTD(:,:,3))
+       CALL histwrite_phy(nid_hfnmc,lNMC,"vxv",itau_w,
+     $v2sumSTD(:,:,3))
 c
-       CALL histwrite_phy(nid_hfnmc,"TxT",itau_w,T2sumSTD(:,:,3))
+       CALL histwrite_phy(nid_hfnmc,lNMC,"TxT",itau_w,
+     $T2sumSTD(:,:,3))
 c
-c     ENDIF !type_run
+       ENDIF !(1.EQ.0) THEN
 c
       if (ok_sync) then
Index: /LMDZ5/trunk/libf/phylmd/write_histmthNMC.h
===================================================================
--- /LMDZ5/trunk/libf/phylmd/write_histmthNMC.h	(revision 1538)
+++ /LMDZ5/trunk/libf/phylmd/write_histmthNMC.h	(revision 1539)
@@ -14,19 +14,27 @@
 c nout=3 : in=pdtphys,    out=hf
 ccc
-       CALL histwrite_phy(nid_mthnmc,"tnondef",itau_w,tnondef(:,:,1))
+      CALL histwrite_phy(nid_mthnmc,lNMC,"tnondef",itau_w,
+     $tnondef(:,:,1))
 c
-       CALL histwrite_phy(nid_mthnmc,"ta",itau_w,twriteSTD(:,:,1))
+      CALL histwrite_phy(nid_mthnmc,lNMC,"ta",itau_w,
+     $twriteSTD(:,:,1))
 c
-       CALL histwrite_phy(nid_mthnmc,"zg",itau_w,phiwriteSTD(:,:,1))
+      CALL histwrite_phy(nid_mthnmc,lNMC,"zg",itau_w,
+     $phiwriteSTD(:,:,1))
 c
-       CALL histwrite_phy(nid_mthnmc,"hus",itau_w,qwriteSTD(:,:,1))
+       CALL histwrite_phy(nid_mthnmc,lNMC,"hus",itau_w,
+     $qwriteSTD(:,:,1))
 c
-       CALL histwrite_phy(nid_mthnmc,"hur",itau_w,rhwriteSTD(:,:,1))
+       CALL histwrite_phy(nid_mthnmc,lNMC,"hur",itau_w,
+     $rhwriteSTD(:,:,1))
 c
-       CALL histwrite_phy(nid_mthnmc,"ua",itau_w,uwriteSTD(:,:,1))
+       CALL histwrite_phy(nid_mthnmc,lNMC,"ua",itau_w,
+     $uwriteSTD(:,:,1))
 c
-       CALL histwrite_phy(nid_mthnmc,"va",itau_w,vwriteSTD(:,:,1))
+       CALL histwrite_phy(nid_mthnmc,lNMC,"va",itau_w,
+     $vwriteSTD(:,:,1))
 c
-       CALL histwrite_phy(nid_mthnmc,"wap",itau_w,wwriteSTD(:,:,1))
+       CALL histwrite_phy(nid_mthnmc,lNMC,"wap",itau_w,
+     $wwriteSTD(:,:,1))
 c
        DO k=1, nlevSTD
@@ -40,23 +48,33 @@
        ENDDO !k=1, nlevSTD
 c
-       CALL histwrite_phy(nid_mthnmc,"psbg",itau_w,zx_tmp_fiNC)
+      CALL histwrite_phy(nid_mthnmc,lNMC,"psbg",itau_w,
+     $zx_tmp_fiNC)
 c
-       CALL histwrite_phy(nid_mthnmc,"uv",itau_w,uvsumSTD(:,:,1))
+      CALL histwrite_phy(nid_mthnmc,lNMC,"uv",itau_w,
+     $uvsumSTD(:,:,1))
 c
-       CALL histwrite_phy(nid_mthnmc,"vq",itau_w,vqsumSTD(:,:,1))
+      CALL histwrite_phy(nid_mthnmc,lNMC,"vq",itau_w,
+     $vqsumSTD(:,:,1))
 c
-       CALL histwrite_phy(nid_mthnmc,"vT",itau_w,vTsumSTD(:,:,1))
+      CALL histwrite_phy(nid_mthnmc,lNMC,"vT",itau_w,
+     $vTsumSTD(:,:,1))
 c
-       CALL histwrite_phy(nid_mthnmc,"wq",itau_w,wqsumSTD(:,:,1))
+      CALL histwrite_phy(nid_mthnmc,lNMC,"wq",itau_w,
+     $wqsumSTD(:,:,1))
 c
-       CALL histwrite_phy(nid_mthnmc,"vphi",itau_w,vphisumSTD(:,:,1))
+      CALL histwrite_phy(nid_mthnmc,lNMC,"vphi",itau_w,
+     $vphisumSTD(:,:,1))
 c
-       CALL histwrite_phy(nid_mthnmc,"wT",itau_w,wTsumSTD(:,:,1))
+       CALL histwrite_phy(nid_mthnmc,lNMC,"wT",itau_w,
+     $wTsumSTD(:,:,1))
 c
-       CALL histwrite_phy(nid_mthnmc,"uxu",itau_w,u2sumSTD(:,:,1))
+       CALL histwrite_phy(nid_mthnmc,lNMC,"uxu",itau_w,
+     $u2sumSTD(:,:,1))
 c
-       CALL histwrite_phy(nid_mthnmc,"vxv",itau_w,v2sumSTD(:,:,1))
+       CALL histwrite_phy(nid_mthnmc,lNMC,"vxv",itau_w,
+     $v2sumSTD(:,:,1))
 c
-       CALL histwrite_phy(nid_mthnmc,"TxT",itau_w,T2sumSTD(:,:,1))
+       CALL histwrite_phy(nid_mthnmc,lNMC,"TxT",itau_w,
+     $T2sumSTD(:,:,1))
 c
        DO k=1, nlevSTD
@@ -69,5 +87,5 @@
         ENDDO
        ENDDO !k=1, nlevSTD
-       CALL histwrite_phy(nid_mthnmc,"tro3",itau_w,
+       CALL histwrite_phy(nid_mthnmc,lNMC,"tro3",itau_w,
      $ zx_tmp_fiNC)
 c
@@ -83,6 +101,6 @@
        ENDDO !k=1, nlevSTD
 c
-        CALL histwrite_phy(nid_mthnmc,"tro3_daylight",itau_w,
-     $  zx_tmp_fiNC)
+        CALL histwrite_phy(nid_mthnmc,lNMC,"tro3_daylight",
+     $itau_w, zx_tmp_fiNC)
        endif 
 c
