Index: LMDZ5/trunk/libf/cosp/phys_cosp.F90
===================================================================
--- LMDZ5/trunk/libf/cosp/phys_cosp.F90	(revision 1526)
+++ 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 1526)
+++ 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 1526)
+++ 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 1526)
+++ 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
