source: LMDZ6/trunk/libf/phylmd/cospv2/lmdz_cosp_output_mod.F90 @ 4062

Last change on this file since 4062 was 3491, checked in by idelkadi, 6 years ago

Integration of version 2 of the COSP simulator in LMDZ
This line, and those below, will be ignored--

M makegcm
M makelmdz
M makelmdz_fcm
M libf/phylmd/physiq_mod.F90
A libf/phylmd/cospv2
A libf/phylmd/cospv2/mo_rng.F90
A libf/phylmd/cospv2/quickbeam_optics.F90
A libf/phylmd/cospv2/cosp_cloudsat_interface.F90
A libf/phylmd/cospv2/cosp_config.F90
A libf/phylmd/cospv2/lidar_simulator.F90
A libf/phylmd/cospv2/prec_scops.F90
A libf/phylmd/cospv2/mrgrnk.F90
A libf/phylmd/cospv2/lmdz_cosp_read_outputkeys.F90
A libf/phylmd/cospv2/cosp_atlid_interface.F90
A libf/phylmd/cospv2/lmdz_cosp_subsample_and_optics_mod.F90
A libf/phylmd/cospv2/cosp_math_constants.F90
A libf/phylmd/cospv2/MISR_simulator.F90
A libf/phylmd/cospv2/modis_simulator.F90
A libf/phylmd/cospv2/math_lib.F90
A libf/phylmd/cospv2/cosp_grLidar532_interface.F90
A libf/phylmd/cospv2/cosp_errorHandling.F90
A libf/phylmd/cospv2/cosp_stats.F90
A libf/phylmd/cospv2/lmdz_cosp_output_write_mod.F90
A libf/phylmd/cospv2/cosp_utils.F90
A libf/phylmd/cospv2/cosp_optics.F90
A libf/phylmd/cospv2/icarus.F90
A libf/phylmd/cospv2/scops.F90
A libf/phylmd/cospv2/optics_lib.F90
A libf/phylmd/cospv2/cosp_kinds.F90
A libf/phylmd/cospv2/cosp_calipso_interface.F90
A libf/phylmd/cospv2/quickbeam.F90
A libf/phylmd/cospv2/parasol.F90
A libf/phylmd/cospv2/cosp_phys_constants.F90
A libf/phylmd/cospv2/cosp.F90
A libf/phylmd/cospv2/array_lib.F90
A libf/phylmd/cospv2/cosp_isccp_interface.F90
A libf/phylmd/cospv2/cosp_parasol_interface.F90
A libf/phylmd/cospv2/lmdz_cosp_construct_destroy_mod.F90
A libf/phylmd/cospv2/lmdz_cosp_output_mod.F90
A libf/phylmd/cospv2/lmdz_cosp_interface.F90
A libf/phylmd/cospv2/cosp_misr_interface.F90
A libf/phylmd/cospv2/cosp_modis_interface.F90

File size: 32.1 KB
Line 
1! A.Idelkadi sept 2013 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2!! Module pour declarer et initialiser les parametres de controle des fichiers de sorties et des champs a sortir
3!! La routine cosp_output_open (appelee 1 seule fois dans phy_cosp.F90) permet :
4!! de creer les fichiers avec leurs grilles horizontales et verticales
5!
6! R.Guzman jan 2019 (mise a jour pour COSPv2)
7! On change le nom du module a "lmdz_cosp_output_mod" et celui de la routine a "lmdz_cosp_output_open"
8! pour qu'on sache qu'il s'agit d'un module specifique a l'implementation de COSP dans LMDZ
9!
10!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11  MODULE lmdz_cosp_output_mod
12
13     USE COSP_KINDS, ONLY: wp,dp
14     IMPLICIT NONE
15! cosp_output_mod
16      INTEGER          :: i
17!!!!!!! Controle des fichier de sorties Cosp !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
18      LOGICAL, DIMENSION(3), SAVE  :: cosp_outfilekeys
19      INTEGER, DIMENSION(3), SAVE  :: cosp_nidfiles
20!$OMP THREADPRIVATE(cosp_outfilekeys, cosp_nidfiles)
21      INTEGER, DIMENSION(3), SAVE  :: nhoricosp,nvert,nvertmcosp,nvertcol,nvertbze, &
22                                      nvertsratio,nvertisccp,nvertp,nverttemp,nvertmisr, &
23                                      nvertReffIce,nvertReffLiq,nverttau
24      REAL, DIMENSION(3), SAVE                :: zoutm_cosp
25!$OMP THREADPRIVATE(nhoricosp, nvert,nvertmcosp,nvertcol,nvertsratio,nvertbze,nvertisccp,nvertp,zoutm_cosp,nverttemp,nvertmisr)
26!$OMP THREADPRIVATE(nvertReffIce,nvertReffLiq,nverttau)
27      REAL, SAVE                   :: zdtimemoy_cosp
28!$OMP THREADPRIVATE(zdtimemoy_cosp)
29      CHARACTER(LEN=20), DIMENSION(3), SAVE  :: cosp_outfiletypes
30      CHARACTER(LEN=20), DIMENSION(3), SAVE  :: cosp_outfilenames
31      REAL, DIMENSION(3), SAVE               :: cosp_ecritfiles
32!$OMP THREADPRIVATE(cosp_outfiletypes, cosp_outfilenames, cosp_ecritfiles)
33
34!!!!  Controle des variables a sortir dans les fichiers !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35  TYPE ctrl_outcosp
36     LOGICAL,DIMENSION(3)                 :: cles             !!! Sortir ou non le champs
37     CHARACTER(len=20)                    :: name       
38     CHARACTER(len=150)                   :: description      !!! Nom
39     CHARACTER(len=20)                    :: unit             !!! Unite
40     CHARACTER(len=20),DIMENSION(3)  :: cosp_typeecrit        !!! Operation (ave, inst, ...)
41  END TYPE ctrl_outcosp
42
43! CALIPSO vars (43)
44  TYPE(ctrl_outcosp), SAVE :: o_cllcalipso = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
45         "cllcalipso", "CALIPSO Low-level Cloud Fraction", "1", (/ ('', i=1, 3) /))
46  TYPE(ctrl_outcosp), SAVE :: o_clmcalipso = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
47         "clmcalipso", "CALIPSO Mid-level Cloud Fraction", "1", (/ ('', i=1, 3) /))
48  TYPE(ctrl_outcosp), SAVE :: o_clhcalipso = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
49         "clhcalipso", "CALIPSO High-level Cloud Fraction", "1", (/ ('', i=1, 3) /))
50  TYPE(ctrl_outcosp), SAVE :: o_cltcalipso = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
51         "cltcalipso", "CALIPSO Total Cloud Fraction", "1", (/ ('', i=1, 3) /))
52  TYPE(ctrl_outcosp), SAVE :: o_clcalipso = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
53         "clcalipso", "CALIPSO Cloud Fraction (532 nm)", "1", (/ ('', i=1, 3) /))
54  TYPE(ctrl_outcosp), SAVE :: o_cfadLidarsr532 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
55         "cfadLidarsr532", "CALIPSO Scattering Ratio CFAD (532 nm)", "1", (/ ('', i=1, 3) /))   
56  TYPE(ctrl_outcosp), SAVE :: o_atb532 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
57         "atb532", "CALIPSO Attenuated Total Backscatter (532 nm)","1", (/ ('', i=1, 3) /))
58  TYPE(ctrl_outcosp), SAVE :: o_lidarBetaMol532 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
59         "lidarBetaMol532", "CALIPSO Molecular Backscatter (532 nm)","m-1 sr-1", (/ ('', i=1, 3) /))
60!! AI  11 2015
61  TYPE(ctrl_outcosp), SAVE :: o_cllcalipsoice = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
62         "cllcalipsoice", "CALIPSO Ice-Phase Low Level Cloud Fraction", "%", (/ ('', i=1, 3) /)) 
63  TYPE(ctrl_outcosp), SAVE :: o_cllcalipsoliq = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
64         "cllcalipsoliq", "CALIPSO Liq-Phase Low Level Cloud Fraction", "%", (/ ('', i=1, 3) /))
65  TYPE(ctrl_outcosp), SAVE :: o_clmcalipsoice = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
66         "clmcalipsoice", "CALIPSO Ice-Phase Mid Level Cloud Fraction", "%", (/ ('', i=1, 3) /))
67  TYPE(ctrl_outcosp), SAVE :: o_clmcalipsoliq = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
68         "clmcalipsoliq", "CALIPSO Liq-Phase Mid Level Cloud Fraction", "%", (/ ('', i=1, 3) /))
69  TYPE(ctrl_outcosp), SAVE :: o_clhcalipsoice = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
70         "clhcalipsoice", "CALIPSO Ice-Phase High Level Cloud Fraction", "%", (/ ('', i=1, 3) /)) 
71  TYPE(ctrl_outcosp), SAVE :: o_clhcalipsoliq = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
72         "clhcalipsoliq", "CALIPSO Liq-Phase High Level Cloud Fraction", "%", (/ ('', i=1, 3) /))
73  TYPE(ctrl_outcosp), SAVE :: o_cltcalipsoice = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
74         "cltcalipsoice", "CALIPSO Ice-Phase Tot Level Cloud Fraction", "%", (/ ('', i=1, 3) /))
75  TYPE(ctrl_outcosp), SAVE :: o_cltcalipsoliq = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
76         "cltcalipsoliq", "CALIPSO Liq-Phase Tot Level Cloud Fraction", "%", (/ ('', i=1, 3) /))
77  TYPE(ctrl_outcosp), SAVE :: o_cllcalipsoun = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
78         "cllcalipsoun", "CALIPSO Undefined-Phase Low Level Cloud Fraction", "%", (/ ('', i=1, 3) /)) 
79  TYPE(ctrl_outcosp), SAVE :: o_clmcalipsoun = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
80         "clmcalipsoun", "CALIPSO Undefined-Phase Mid Level Cloud Fraction", "%", (/ ('', i=1, 3) /))
81  TYPE(ctrl_outcosp), SAVE :: o_clhcalipsoun = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
82         "clhcalipsoun", "CALIPSO Undefined-Phase High Level Cloud Fraction", "%", (/ ('', i=1, 3) /))
83  TYPE(ctrl_outcosp), SAVE :: o_cltcalipsoun = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
84         "cltcalipsoun", "CALIPSO Undefined-Phase Tot Level Cloud Fraction", "%", (/ ('', i=1, 3) /))
85  TYPE(ctrl_outcosp), SAVE :: o_clcalipsoice = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
86         "clcalipsoice", "CALIPSO Ice-Phase Cloud Fraction", "%", (/ ('', i=1, 3) /))
87  TYPE(ctrl_outcosp), SAVE :: o_clcalipsoliq = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
88         "clcalipsoliq", "CALIPSO Liq-Phase Cloud Fraction", "%", (/ ('', i=1, 3) /))
89  TYPE(ctrl_outcosp), SAVE :: o_clcalipsoun = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
90         "clcalipsoun", "CALIPSO Undef-Phase Cloud Fraction", "%", (/ ('', i=1, 3) /))   
91  TYPE(ctrl_outcosp), SAVE :: o_clcalipsotmpice = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
92         "clcalipsotmpice", "CALIPSO Ice-Phase Cloud Fraction", "%", (/ ('', i=1, 3) /))
93  TYPE(ctrl_outcosp), SAVE :: o_clcalipsotmpliq = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
94         "clcalipsotmpliq", "CALIPSO Liq-Phase Cloud Fraction", "%", (/ ('', i=1, 3) /))
95  TYPE(ctrl_outcosp), SAVE :: o_clcalipsotmpun = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
96         "clcalipsotmpun", "CALIPSO Undef-Phase Cloud Fraction", "%", (/ ('', i=1, 3) /))
97  TYPE(ctrl_outcosp), SAVE :: o_clcalipsotmp = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
98         "clcalipsotmp", "CALIPSO Cloud Fraction", "%", (/ ('', i=1, 3) /))
99
100  TYPE(ctrl_outcosp), SAVE :: o_clopaquecalipso = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
101         "clopaquecalipso", "CALIPSO Opaque Cloud Fraction", "%", (/ ('', i=1, 3) /))
102  TYPE(ctrl_outcosp), SAVE :: o_clthincalipso = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
103         "clthincalipso", "CALIPSO Thin Cloud Fraction", "%", (/ ('', i=1, 3) /))     
104  TYPE(ctrl_outcosp), SAVE :: o_clzopaquecalipso = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
105         "clzopaquecalipso", "CALIPSO mean opacity altitude", "m", (/ ('', i=1, 3) /))   
106  TYPE(ctrl_outcosp), SAVE :: o_clcalipsoopaque = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
107         "clcalipsoopaque", "CALIPSO Opaque profile Cloud Fraction", "%", (/ ('', i=1, 3) /)) 
108  TYPE(ctrl_outcosp), SAVE :: o_clcalipsothin = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
109         "clcalipsothin", "CALIPSO Thin profile Cloud Fraction", "%", (/ ('', i=1, 3) /))     
110  TYPE(ctrl_outcosp), SAVE :: o_clcalipsozopaque = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
111         "clcalipsozopaque", "CALIPSO z_opaque Fraction", "%", (/ ('', i=1, 3) /))         
112  TYPE(ctrl_outcosp), SAVE :: o_clcalipsoopacity = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
113         "clcalipsoopacity", "CALIPSO opacity Fraction", "%", (/ ('', i=1, 3) /))
114  TYPE(ctrl_outcosp), SAVE :: o_clopaquetemp = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
115         "clopaquetemp", "CALIPSO Opaque Cloud Temperature", "K", (/ ('', i=1, 3) /))
116  TYPE(ctrl_outcosp), SAVE :: o_clthintemp = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
117         "clthintemp", "CALIPSO Thin Cloud Temperature", "K", (/ ('', i=1, 3) /))
118  TYPE(ctrl_outcosp), SAVE :: o_clzopaquetemp = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
119         "clzopaquetemp", "CALIPSO z_opaque Temperature", "K", (/ ('', i=1, 3) /))
120  TYPE(ctrl_outcosp), SAVE :: o_clopaquemeanz = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
121         "clopaquemeanz", "CALIPSO Opaque Cloud Altitude", "m", (/ ('', i=1, 3) /))
122  TYPE(ctrl_outcosp), SAVE :: o_clthinmeanz = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
123         "clthinmeanz", "CALIPSO Thin Cloud Altitude", "m", (/ ('', i=1, 3) /))
124  TYPE(ctrl_outcosp), SAVE :: o_clthinemis = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
125         "clthinemis", "CALIPSO Thin Cloud Emissivity", "1", (/ ('', i=1, 3) /))
126  TYPE(ctrl_outcosp), SAVE :: o_clopaquemeanzse = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
127         "clopaquemeanzse", "CALIPSO Opaque Cloud Altitude with respect to Surface Elevation", "m", (/ ('', i=1, 3) /))
128  TYPE(ctrl_outcosp), SAVE :: o_clthinmeanzse = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
129         "clthinmeanzse", "CALIPSO Thin Cloud Altitude with respect to Surface Elevation", "m", (/ ('', i=1, 3) /))
130  TYPE(ctrl_outcosp), SAVE :: o_clzopaquecalipsose = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
131         "clzopaquecalipsose", "CALIPSO mean opacity Altitude with respect to Surface Elevation", "m", (/ ('', i=1, 3) /))
132
133! GROUND LIDAR 532 nm vars (8)
134  TYPE(ctrl_outcosp), SAVE :: o_cllgrLidar532 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
135         "cllgrLidar532", "GROUND LIDAR 532 nm Low-level Cloud Fraction", "1", (/ ('', i=1, 3) /))
136  TYPE(ctrl_outcosp), SAVE :: o_clmgrLidar532 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
137         "clmgrLidar532", "GROUND LIDAR 532 nm Mid-level Cloud Fraction", "1", (/ ('', i=1, 3) /))
138  TYPE(ctrl_outcosp), SAVE :: o_clhgrLidar532 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
139         "clhgrLidar532", "GROUND LIDAR 532 nm High-level Cloud Fraction", "1", (/ ('', i=1, 3) /))
140  TYPE(ctrl_outcosp), SAVE :: o_cltgrLidar532 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
141         "cltgrLidar532", "GROUND LIDAR 532 nm Total Cloud Fraction", "1", (/ ('', i=1, 3) /))
142  TYPE(ctrl_outcosp), SAVE :: o_clgrLidar532 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
143         "clgrLidar532", "GROUND LIDAR 532 nm Cloud Fraction", "1", (/ ('', i=1, 3) /))
144  TYPE(ctrl_outcosp), SAVE :: o_cfadLidarsr532gr = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
145         "cfadLidarsr532gr", "GROUND LIDAR 532 nm Scattering Ratio CFAD", "1", (/ ('', i=1, 3) /))
146  TYPE(ctrl_outcosp), SAVE :: o_atb532gr = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
147         "atb532gr", "GROUND LIDAR 532 nm Attenuated Total Backscatter (532 nm)","m-1 sr-1", (/ ('', i=1, 3) /))
148  TYPE(ctrl_outcosp), SAVE :: o_lidarBetaMol532gr = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
149         "lidarBetaMol532gr", "GROUND LIDAR 532 nm Molecular Backscatter (532 nm)","m-1 sr-1", (/ ('', i=1, 3) /))
150
151! ATLID vars (8)
152  TYPE(ctrl_outcosp), SAVE :: o_cllatlid = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
153         "cllatlid", "ATLID Low-level Cloud Fraction", "1", (/ ('', i=1, 3) /))
154  TYPE(ctrl_outcosp), SAVE :: o_clmatlid = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
155         "clmatlid", "ATLID Mid-level Cloud Fraction", "1", (/ ('', i=1, 3) /))
156  TYPE(ctrl_outcosp), SAVE :: o_clhatlid = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
157         "clhatlid", "ATLID High-level Cloud Fraction", "1", (/ ('', i=1, 3) /))
158  TYPE(ctrl_outcosp), SAVE :: o_cltatlid = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
159         "cltatlid", "ATLID Total Cloud Fraction", "1", (/ ('', i=1, 3) /))
160  TYPE(ctrl_outcosp), SAVE :: o_clatlid = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
161         "clatlid", "ATLID Cloud Fraction (532 nm)", "1", (/ ('', i=1, 3) /))
162  TYPE(ctrl_outcosp), SAVE :: o_cfadLidarsr355 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
163         "cfadLidarsr355", "ATLID Scattering Ratio CFAD (532 nm)", "1", (/ ('', i=1, 3) /))
164  TYPE(ctrl_outcosp), SAVE :: o_atb355 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
165         "atb355", "ATLID Attenuated Total Backscatter (532 nm)","m-1 sr-1", (/ ('', i=1, 3) /))
166  TYPE(ctrl_outcosp), SAVE :: o_lidarBetaMol355 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
167         "lidarBetaMol355", "ATLID Molecular Backscatter (532 nm)","m-1 sr-1", (/ ('', i=1, 3) /))
168
169! PARASOL vars (2)
170  TYPE(ctrl_outcosp), SAVE :: o_parasolGrid_refl = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
171         "parasolGrid_refl", "PARASOL Reflectance","1", (/ ('', i=1, 3) /))
172  TYPE(ctrl_outcosp), SAVE :: o_parasolPix_refl = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
173         "parasolPix_refl", "PARASOL Subcolumn Reflectance","1", (/ ('', i=1, 3) /))                 
174!  TYPE(ctrl_outcosp), SAVE :: o_Ncrefl = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
175!         "Ncrefl", "Nb PARASOL-like mono-directional reflectance (integral)","1", (/ ('', i=1, 3) /))
176
177
178! Radar CloudSat vars (13)
179  TYPE(ctrl_outcosp), SAVE :: o_cfadDbze94 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
180         "cfadDbze94", "CloudSat Radar Reflectivity CFAD", "%", (/ ('', i=1, 3) /))
181  TYPE(ctrl_outcosp), SAVE :: o_dbze94 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
182         "dbze94", "CloudSat Radar Reflectivity", "%", (/ ('', i=1, 3) /))
183  TYPE(ctrl_outcosp), SAVE :: o_ptradarflag0 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
184         "ptradarflag0", "CloudSat Radar Precipitation frequency flag 0", "1", (/ ('', i=1, 3) /))
185  TYPE(ctrl_outcosp), SAVE :: o_ptradarflag1 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
186         "ptradarflag1", "CloudSat Radar Precipitation frequency flag 1", "1", (/ ('', i=1, 3) /))
187  TYPE(ctrl_outcosp), SAVE :: o_ptradarflag2 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
188         "ptradarflag2", "CloudSat Radar Precipitation frequency flag 2", "1", (/ ('', i=1, 3) /))
189  TYPE(ctrl_outcosp), SAVE :: o_ptradarflag3 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
190         "ptradarflag3", "CloudSat Radar Precipitation frequency flag 3", "1", (/ ('', i=1, 3) /))
191  TYPE(ctrl_outcosp), SAVE :: o_ptradarflag4 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
192         "ptradarflag4", "CloudSat Radar Precipitation frequency flag 4", "1", (/ ('', i=1, 3) /))
193  TYPE(ctrl_outcosp), SAVE :: o_ptradarflag5 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
194         "ptradarflag5", "CloudSat Radar Precipitation frequency flag 5", "1", (/ ('', i=1, 3) /))
195  TYPE(ctrl_outcosp), SAVE :: o_ptradarflag6 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
196         "ptradarflag6", "CloudSat Radar Precipitation frequency flag 6", "1", (/ ('', i=1, 3) /))
197  TYPE(ctrl_outcosp), SAVE :: o_ptradarflag7 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
198         "ptradarflag7", "CloudSat Radar Precipitation frequency flag 7", "1", (/ ('', i=1, 3) /))
199  TYPE(ctrl_outcosp), SAVE :: o_ptradarflag8 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
200         "ptradarflag8", "CloudSat Radar Precipitation frequency flag 8", "1", (/ ('', i=1, 3) /))
201  TYPE(ctrl_outcosp), SAVE :: o_ptradarflag9 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
202         "ptradarflag9", "CloudSat Radar Precipitation frequency flag 9", "1", (/ ('', i=1, 3) /))
203  TYPE(ctrl_outcosp), SAVE :: o_radarpia = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
204         "radarpia", "CloudSat Radar PIA", "1", (/ ('', i=1, 3) /))
205
206! CALIPSO + CloudSat vars (4)
207  TYPE(ctrl_outcosp), SAVE :: o_clcalipso2 = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
208         "clcalipso2", "CALIPSO Cloud Fraction Undetected by CloudSat", "1", (/ ('', i=1, 3) /))
209  TYPE(ctrl_outcosp), SAVE :: o_cltlidarradar = ctrl_outcosp((/ .TRUE., .TRUE.,.TRUE. /), &         
210         "cltlidarradar", "CALIPSO and CloudSat Radar Total Cloud Fraction", "%", (/ ('', i=1, 3) /))
211  TYPE(ctrl_outcosp), SAVE :: o_cloudsat_tcc = ctrl_outcosp((/ .TRUE., .TRUE.,.TRUE. /), &         
212         "cloudsat_tcc", "CALIPSO and CloudSat Radar Total Cloud Fraction?", "%", (/ ('', i=1, 3) /))
213  TYPE(ctrl_outcosp), SAVE :: o_cloudsat_tcc2 = ctrl_outcosp((/ .TRUE., .TRUE.,.TRUE. /), &         
214         "cloudsat_tcc2", "CALIPSO and CloudSat Radar Total Cloud Fraction?", "%", (/ ('', i=1, 3) /))
215
216! ISCCP vars (9) + sunlit (1)
217!  TYPE(ctrl_outcosp), SAVE :: o_sunlit = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
218!         "sunlit", "1 for day points, 0 for nightime", "1", (/ ('', i=1, 3) /))                   
219  TYPE(ctrl_outcosp), SAVE :: o_clisccp = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
220         "clisccp", "Cloud Fraction as Calculated by the ISCCP Simulator","%", (/ ('', i=1, 3) /))
221  TYPE(ctrl_outcosp), SAVE :: o_boxtauisccp = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
222         "boxtauisccp", "Optical Depth in Each Column as Calculated by the ISCCP Simulator","1", (/ ('', i=1, 3) /))
223  TYPE(ctrl_outcosp), SAVE :: o_boxptopisccp = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
224         "boxptopisccp", "Cloud Top Pressure in Each Column as Calculated by the ISCCP Simulator","Pa", (/ ('', i=1, 3) /))
225  TYPE(ctrl_outcosp), SAVE :: o_cltisccp = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
226          "cltisccp", "Total Cloud Fraction as Calculated by the ISCCP Simulator", "%", (/ ('', i=1, 3) /))
227  TYPE(ctrl_outcosp), SAVE :: o_pctisccp = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
228          "pctisccp", "Mean Cloud Top Pressure as Calculated by the ISCCP Simulator", "Pa", (/ ('', i=1, 3) /))
229  TYPE(ctrl_outcosp), SAVE :: o_tauisccp = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
230          "tauisccp", "Optical Depth as Calculated by the ISCCP Simulator", "1", (/ ('', i=1, 3) /))
231  TYPE(ctrl_outcosp), SAVE :: o_albisccp = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
232          "albisccp", "Mean Cloud Albedo as Calculated by the ISCCP Simulator", "1", (/ ('', i=1, 3) /))
233  TYPE(ctrl_outcosp), SAVE :: o_meantbisccp = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
234          "meantbisccp", " Mean all-sky 10.5 micron brightness temperature as calculated &
235           by the ISCCP Simulator","K", (/ ('', i=1, 3) /))
236  TYPE(ctrl_outcosp), SAVE :: o_meantbclrisccp = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
237          "meantbclrisccp", "Mean clear-sky 10.5 micron brightness temperature as calculated &
238           by the ISCCP Simulator","K", (/ ('', i=1, 3) /))
239
240! MISR simulator var (3)
241  TYPE(ctrl_outcosp), SAVE :: o_misr_fq = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
242         "misr_fq", "MISR joint-PDF of cloud top pressure and optical depth","%", (/ ('', i=1, 3) /))
243  TYPE(ctrl_outcosp), SAVE :: o_misr_meanztop = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
244         "misr_meanztop", "MISR Mean Cloud Top Height","%", (/ ('', i=1, 3) /))
245  TYPE(ctrl_outcosp), SAVE :: o_misr_cldarea = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
246         "misr_cldarea", "MISR cloud cover","%", (/ ('', i=1, 3) /))
247
248! MODIS simulator vars (20)
249  TYPE(ctrl_outcosp), SAVE :: o_cllmodis = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
250         "cllmodis", "MODIS Low-level Cloud Fraction", "%", (/ ('', i=1, 3) /))
251  TYPE(ctrl_outcosp), SAVE :: o_clmmodis = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
252         "clmmodis", "MODIS Mid-level Cloud Fraction", "%", (/ ('', i=1, 3) /))
253  TYPE(ctrl_outcosp), SAVE :: o_clhmodis = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
254         "clhmodis", "MODIS High-level Cloud Fraction", "%", (/ ('', i=1, 3) /))
255  TYPE(ctrl_outcosp), SAVE :: o_cltmodis = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
256         "cltmodis", "MODIS Total Cloud Fraction", "%", (/ ('', i=1, 3) /))
257  TYPE(ctrl_outcosp), SAVE :: o_clwmodis = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
258         "clwmodis", "MODIS Cloud Fraction water mean", "%", (/ ('', i=1, 3) /))
259  TYPE(ctrl_outcosp), SAVE :: o_climodis = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
260         "climodis", "MODIS Cloud Fraction ice mean", "%", (/ ('', i=1, 3) /))
261  TYPE(ctrl_outcosp), SAVE :: o_tautmodis = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
262         "tautmodis", "MODIS Optical_Thickness_Total_Mean", "1", (/ ('', i=1, 3) /))
263  TYPE(ctrl_outcosp), SAVE :: o_tauwmodis = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
264         "tauwmodis", "MODIS Optical_Thickness_Water_Mean", "1", (/ ('', i=1, 3) /))
265  TYPE(ctrl_outcosp), SAVE :: o_tauimodis= ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
266         "tauimodis", "MODIS Optical_Thickness_Ice_Mean", "1", (/ ('', i=1, 3) /))
267  TYPE(ctrl_outcosp), SAVE :: o_tautlogmodis = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
268         "tautlogmodis", "MODIS Optical_Thickness_Total_logMean", "1", (/ ('', i=1, 3) /))
269  TYPE(ctrl_outcosp), SAVE :: o_tauwlogmodis = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
270         "tauwlogmodis", "MODIS Optical_Thickness_Water_logMean", "1", (/ ('', i=1, 3) /))
271  TYPE(ctrl_outcosp), SAVE :: o_tauilogmodis = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
272         "tauilogmodis", "MODIS Optical_Thickness_Ice_logMean", "1", (/ ('', i=1, 3) /))
273  TYPE(ctrl_outcosp), SAVE :: o_reffclwmodis = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
274         "reffclwmodis", "Modis Cloud_Particle_Size_Water_Mean", "m", (/ ('', i=1, 3) /))
275  TYPE(ctrl_outcosp), SAVE :: o_reffclimodis = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
276         "reffclimodis", "Modis Cloud_Particle_Size_Ice_Mean", "m", (/ ('', i=1, 3) /))
277  TYPE(ctrl_outcosp), SAVE :: o_pctmodis = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
278         "pctmodis", "Modis Cloud_Top_Pressure_Total_Mean", "Pa", (/ ('', i=1, 3) /))
279  TYPE(ctrl_outcosp), SAVE :: o_lwpmodis = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
280         "lwpmodis", "Modis Liquid_Water_Path_Mean", "kg m-2", (/ ('', i=1, 3) /))
281  TYPE(ctrl_outcosp), SAVE :: o_iwpmodis = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
282         "iwpmodis", "Modis Ice_Water_Path_Mean", "kg m-2", (/ ('', i=1, 3) /))
283  TYPE(ctrl_outcosp), SAVE :: o_modis_ot_vs_ctp = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
284         "modis_ot_vs_ctp", "MODIS joint-PDF of cloud top pressure and optical depth", "%", (/ ('', i=1, 3) /))
285  TYPE(ctrl_outcosp), SAVE :: o_modis_ot_vs_reffice = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
286         "modis_ot_vs_reffice", "MODIS Joint-PDF of optical-depth and ice particle size", "%", (/ ('',i=1, 3) /))
287  TYPE(ctrl_outcosp), SAVE :: o_modis_ot_vs_reffliq = ctrl_outcosp((/ .TRUE., .TRUE.,.TRUE. /), &
288         "modis_ot_vs_reffliq", "MODIS Joint-PDF of optical-depth and liquid particle size", "%", (/ ('',i=1, 3) /))
289
290! Rttovs simulator var (1)
291  TYPE(ctrl_outcosp), SAVE :: o_tbrttov = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
292         "tbrttov", "Rttovs Cloud Area Fraction", "%", (/ ('', i=1, 3) /))
293
294! Scops and others var (1)
295  TYPE(ctrl_outcosp), SAVE :: o_fracout = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), &
296         "fracout", "Subcolumn output from SCOPS", "%", (/ ('', i=1, 3) /))
297
298  LOGICAL, SAVE :: cosp_varsdefined = .FALSE. ! ug PAS THREADPRIVATE ET C'EST NORMAL
299  REAL, SAVE  :: Cosp_fill_value
300!$OMP THREADPRIVATE(Cosp_fill_value)
301 
302
303CONTAINS
304
305!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
306!!!!!!!!! Ouverture des fichier et definition des  axes!!!!!!!!
307  !! histbeg, histvert
308!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
309
310  SUBROUTINE lmdz_cosp_output_open(Nlevlmdz, Ncolumns, presnivs, dtime, freq_cosp, &
311                              ok_mensuelCOSP, ok_journeCOSP, ok_hfCOSP, ok_all_xml,  &
312                              ecrit_mth, ecrit_day, ecrit_hf, use_vgrid, Nlvgrid, vgrid_z_loc, &
313                              vgrid_mz)
314
315  use mod_cosp_config, only : CLOUDSAT_DBZE_BINS, SR_BINS, CLOUDSAT_CFAD_ZE_MIN, PARASOL_NREFL, &
316                              CLOUDSAT_CFAD_ZE_WIDTH,PARASOL_SZA, &
317                              isccp_histPresCenters,tau_binCenters, LIDAR_NTEMP, &
318                              LIDAR_PHASE_TEMP,misr_histHgtCenters,numMISRHgtBins, &
319                              numMODISReffIceBins,reffICE_binCenters, &
320                              numMODISReffLiqBins, reffLIQ_binCenters, pres_binCenters, &
321                              cloudsat_binCenters, calipso_binCenters
322
323  USE iophy
324  USE ioipsl
325  USE phys_cal_mod
326  USE time_phylmdz_mod, ONLY: day_ref, annee_ref, day_ini, start_time, itau_phy
327  USE print_control_mod, ONLY: lunout
328
329#ifdef CPP_XIOS
330    ! ug Pour les sorties XIOS
331    USE wxios
332#endif
333
334  IMPLICIT NONE
335
336!!! Variables d'entree
337  integer                  :: Nlevlmdz, Ncolumns, Nlvgrid      ! Number of levels
338  real,dimension(Nlevlmdz) :: presnivs, vgrid_mz
339  real,dimension(Nlvgrid)  :: vgrid_z_loc
340  real                     :: dtime, freq_cosp, ecrit_day, ecrit_hf, ecrit_mth
341  logical                  :: use_vgrid
342  logical                  :: ok_mensuelCOSP, ok_journeCOSP, ok_hfCOSP, ok_all_xml
343
344!!! Variables locales
345  integer                   :: idayref, iff, ii
346  real                      :: zjulian,zjulian_start
347  real(wp),dimension(Ncolumns)  :: column_ax
348  CHARACTER(LEN=20), DIMENSION(3)  :: chfreq = (/ '1day', '1d  ', '3h  ' /)           
349
350!!! Variables d'entree
351
352#ifdef CPP_XIOS
353    ! ug Variables utilisées pour récupérer le calendrier pour xios
354    INTEGER :: x_an, x_mois, x_jour
355    REAL :: x_heure
356    INTEGER :: ini_an, ini_mois, ini_jour
357    REAL :: ini_heure
358#endif
359
360    WRITE(lunout,*) 'Debut lmdz_cosp_output_mod.F90'
361    print*,'cosp_varsdefined',cosp_varsdefined
362    ! Initialisations (Valeurs par defaut)
363
364
365!! Definition valeurs axes
366    do ii=1,Ncolumns
367      column_ax(ii) = real(ii)
368    enddo
369
370 
371    cosp_outfilenames(1) = 'histmthCOSP'
372    cosp_outfilenames(2) = 'histdayCOSP'
373    cosp_outfilenames(3) = 'histhfCOSP'
374
375    cosp_outfiletypes(1) = 'ave(X)'
376    cosp_outfiletypes(2) = 'ave(X)'
377    cosp_outfiletypes(3) = 'ave(X)'
378
379    cosp_outfilekeys(1) = ok_mensuelCOSP
380    cosp_outfilekeys(2) = ok_journeCOSP
381    cosp_outfilekeys(3) = ok_hfCOSP
382
383    cosp_ecritfiles(1) = mth_len*86400.
384    cosp_ecritfiles(2) = 1.*86400.
385    cosp_ecritfiles(3) = 0.125*86400.
386
387! Lecture des parametres dans output.def ou config.def
388
389    CALL getin('cosp_outfilenames',cosp_outfilenames)
390    CALL getin('cosp_outfilekeys',cosp_outfilekeys)
391    CALL getin('cosp_ecritfiles',cosp_ecritfiles)
392    CALL getin('cosp_outfiletypes',cosp_outfiletypes)
393
394    WRITE(lunout,*)'cosp_outfilenames=',cosp_outfilenames
395    WRITE(lunout,*)'cosp_outfilekeys=',cosp_outfilekeys
396    WRITE(lunout,*)'cosp_ecritfiles=',cosp_ecritfiles
397    WRITE(lunout,*)'cosp_outfiletypes=',cosp_outfiletypes
398   
399    idayref = day_ref
400    CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian)
401    CALL ymds2ju(annee_ref, 1, day_ini, start_time, zjulian_start)
402
403#ifdef CPP_XIOS
404   
405! recuperer la valeur indefine Xios
406!    CALL xios_get_field_attr("clcalipso",default_value=Cosp_fill_value)
407!         Cosp_fill_value=missing_val
408          Cosp_fill_value=0.
409         print*,'Cosp_fill_value=',Cosp_fill_value
410
411    CALL wxios_add_vaxis("height", Nlvgrid, vgrid_z_loc)
412    print*,'wxios_add_vaxis Nlvgrid, vgrid_z_loc',Nlvgrid,vgrid_z_loc
413
414    WRITE(lunout,*) 'wxios_add_vaxis height_mlev, Nlevlmdz vgrid_mz ', &
415                     Nlevlmdz,vgrid_mz
416    CALL wxios_add_vaxis("height_mlev", Nlevlmdz, vgrid_mz)
417
418    WRITE(lunout,*) 'wxios_add_vaxis sza, PARASOL_NREFL ', &
419                     PARASOL_NREFL, PARASOL_SZA
420    CALL wxios_add_vaxis("sza", PARASOL_NREFL, PARASOL_SZA)
421
422    WRITE(lunout,*) 'wxios_add_vaxis pressure2 ',7,pres_binCenters
423    CALL wxios_add_vaxis("pressure2", 7, pres_binCenters)
424
425    WRITE(lunout,*) 'wxios_add_vaxis column ',Ncolumns,column_ax
426    CALL wxios_add_vaxis("column", Ncolumns, column_ax)
427
428   WRITE(lunout,*) 'wxios_add_vaxis temp LIDAR_NTEMP, LIDAR_PHASE_TEMP ', &
429                    LIDAR_NTEMP, LIDAR_PHASE_TEMP
430   CALL wxios_add_vaxis("temp", LIDAR_NTEMP, LIDAR_PHASE_TEMP)
431
432   WRITE(lunout,*) 'wxios_add_vaxis cth16 numMISRHgtBins, misr_histHgtCenters ', &
433                    numMISRHgtBins, misr_histHgtCenters
434   CALL wxios_add_vaxis("cth", numMISRHgtBins, misr_histHgtCenters)
435
436   WRITE(lunout,*) 'wxios_add_vaxis dbze CLOUDSAT_DBZE_BINS, cloudsat_binCenters ', &
437                    CLOUDSAT_DBZE_BINS, cloudsat_binCenters
438   CALL wxios_add_vaxis("dbze", CLOUDSAT_DBZE_BINS, cloudsat_binCenters)
439
440   WRITE(lunout,*) 'wxios_add_vaxis scatratio SR_BINS, calipso_binCenters', &
441                   SR_BINS, calipso_binCenters
442   CALL wxios_add_vaxis("scatratio", SR_BINS, calipso_binCenters)
443
444   WRITE(lunout,*) 'wxios_add_vaxis ReffIce numMODISReffIceBins, &
445                   reffICE_binCenters',numMODISReffIceBins, reffICE_binCenters
446   CALL wxios_add_vaxis("ReffIce", numMODISReffIceBins, reffICE_binCenters)
447
448   WRITE(lunout,*) 'wxios_add_vaxis ReffLiq numMODISReffLiqBins, &
449                    reffLIQ_binCenters', numMODISReffLiqBins, reffLIQ_binCenters
450   CALL wxios_add_vaxis("ReffLiq", numMODISReffLiqBins, reffLIQ_binCenters)
451
452   WRITE(lunout,*) 'wxios_add_vaxis 7, tau_binCenters', &
453                    7, tau_binCenters
454   CALL wxios_add_vaxis("tau", 7, tau_binCenters)
455
456#endif
457   
458    zdtimemoy_cosp = freq_COSP         ! Frequence ou l on moyenne
459
460    DO iff=1,3
461       zoutm_cosp(iff) = cosp_ecritfiles(iff) ! Frequence ou l on ecrit en seconde
462
463       IF (cosp_outfilekeys(iff)) THEN
464           CALL histbeg_phy_all(cosp_outfilenames(iff),itau_phy,zjulian,&
465             dtime,nhoricosp(iff),cosp_nidfiles(iff))
466!           print*,'histbeg_phy nhoricosp(iff),cosp_nidfiles(iff)', &
467!                    nhoricosp(iff),cosp_nidfiles(iff)
468
469#ifdef CPP_XIOS
470        IF (.not. ok_all_xml) then
471         WRITE(lunout,*) 'wxios_add_file ',cosp_outfilenames(iff)
472         CALL wxios_add_file(cosp_outfilenames(iff),chfreq(iff),10)
473        ENDIF
474#endif
475
476#ifndef CPP_IOIPSL_NO_OUTPUT
477! Definition de l'axe vertical
478       if (use_vgrid) then
479! Axe vertical Cosp 40 niveaux (en m)
480      CALL histvert(cosp_nidfiles(iff),"height","height","m",Nlvgrid,vgrid_z_loc,nvert(iff))
481       else
482! Axe vertical modele LMDZ presnivs
483      CALL histvert(cosp_nidfiles(iff),"presnivs","Vertical levels","Pa",Nlevlmdz,presnivs,nvert(iff),"down")
484       endif
485! Axe vertical niveaux modele (en m)
486      CALL histvert(cosp_nidfiles(iff),"height_mlev","height_mlev","m",Nlevlmdz,vgrid_mz,nvertmcosp(iff))
487
488      CALL histvert(cosp_nidfiles(iff),"sza","solar_zenith_angle","degrees",PARASOL_NREFL,PARASOL_SZA,nvertp(iff))
489
490      CALL histvert(cosp_nidfiles(iff),"pressure2","pressure","mb",7,pres_binCenters,nvertisccp(iff),"down")
491
492      CALL histvert(cosp_nidfiles(iff),"column","column","count",Ncolumns,column_ax,nvertcol(iff)) !DBUG
493
494      CALL histvert(cosp_nidfiles(iff),"temp","temperature","C",LIDAR_NTEMP,LIDAR_PHASE_TEMP,nverttemp(iff))
495
496      CALL histvert(cosp_nidfiles(iff),"cth","altitude","m",numMISRHgtBins,misr_histHgtCenters,nvertmisr(iff))
497 
498      CALL histvert(cosp_nidfiles(iff),"ReffIce","Effective_particle_size_Ice","microns",numMODISReffIceBins, reffICE_binCenters, &
499                    nvertReffIce(iff))                                         
500     
501      CALL histvert(cosp_nidfiles(iff),"ReffLiq","Effective_particle_size_Liq","microns",numMODISReffLiqBins, reffLIQ_binCenters, &                                 
502                    nvertReffLiq(iff))
503
504      CALL histvert(cosp_nidfiles(iff),"dbze","equivalent_reflectivity_factor","dBZ",CLOUDSAT_DBZE_BINS,cloudsat_binCenters,nvertbze(iff))
505     
506      CALL histvert(cosp_nidfiles(iff),"scatratio","backscattering_ratio","1",SR_BINS,calipso_binCenters,nvertsratio(iff))
507
508      CALL histvert(cosp_nidfiles(iff),"tau","cloud optical depth","1",7,tau_binCenters,nverttau(iff))
509     
510!!! Valeur indefinie en cas IOIPSL
511     Cosp_fill_value=0.
512
513#endif
514
515      ENDIF
516  ENDDO
517
518    end SUBROUTINE lmdz_cosp_output_open
519
520 END MODULE lmdz_cosp_output_mod
Note: See TracBrowser for help on using the repository browser.