[1926] | 1 | !!!! Abderrahmane Idelkadi aout 2013 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 2 | ! Module pour definir (au 1er appel) et ecrire les variables dans les fichiers de sortie cosp |
---|
| 3 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 4 | MODULE cosp_output_write_mod |
---|
| 5 | |
---|
| 6 | USE cosp_output_mod |
---|
| 7 | |
---|
| 8 | INTEGER, SAVE :: itau_iocosp |
---|
| 9 | !$OMP THREADPRIVATE(itau_iocosp) |
---|
[2080] | 10 | INTEGER, save :: Nlevout, Ncolout |
---|
| 11 | !$OMP THREADPRIVATE(Nlevout, Ncolout) |
---|
[1926] | 12 | |
---|
| 13 | ! INTERFACE histwrite_cosp |
---|
| 14 | ! MODULE PROCEDURE histwrite2d_cosp,histwrite3d_cosp |
---|
| 15 | ! END INTERFACE |
---|
| 16 | |
---|
| 17 | CONTAINS |
---|
| 18 | |
---|
[2822] | 19 | SUBROUTINE cosp_output_write(Nlevlmdz, Npoints, Ncolumns, itap, dtime, freq_COSP, missing_cosp, & |
---|
[2428] | 20 | cfg, gbx, vgrid, sglidar, sgradar, stlidar, stradar, & |
---|
| 21 | isccp, misr, modis) |
---|
[1926] | 22 | |
---|
| 23 | USE ioipsl |
---|
[2345] | 24 | USE time_phylmdz_mod, ONLY: itau_phy, start_time, day_step_phy |
---|
[2311] | 25 | USE print_control_mod, ONLY: lunout,prt_level |
---|
[1926] | 26 | |
---|
| 27 | #ifdef CPP_XIOS |
---|
[2137] | 28 | USE wxios, only: wxios_closedef |
---|
| 29 | USE xios, only: xios_update_calendar |
---|
[1926] | 30 | #endif |
---|
| 31 | |
---|
| 32 | !!! Variables d'entree |
---|
| 33 | integer :: itap, Nlevlmdz, Ncolumns, Npoints |
---|
[2822] | 34 | real :: freq_COSP, dtime, missing_val, missing_cosp |
---|
[1926] | 35 | type(cosp_config) :: cfg ! Control outputs |
---|
| 36 | type(cosp_gridbox) :: gbx ! Gridbox information. Input for COSP |
---|
| 37 | type(cosp_sglidar) :: sglidar ! Output from lidar simulator |
---|
[2428] | 38 | type(cosp_sgradar) :: sgradar ! Output from radar simulator |
---|
[1926] | 39 | type(cosp_isccp) :: isccp ! Output from ISCCP simulator |
---|
| 40 | type(cosp_lidarstats) :: stlidar ! Summary statistics from lidar simulator |
---|
[2428] | 41 | type(cosp_radarstats) :: stradar |
---|
| 42 | type(cosp_misr) :: misr ! Output from MISR |
---|
| 43 | type(cosp_modis) :: modis ! Outputs from Modis |
---|
[2080] | 44 | type(cosp_vgrid) :: vgrid ! Information on vertical grid of stats |
---|
[1926] | 45 | |
---|
| 46 | !!! Variables locales |
---|
[2137] | 47 | integer :: icl |
---|
[1926] | 48 | logical :: ok_sync |
---|
| 49 | integer :: itau_wcosp |
---|
| 50 | real, dimension(Npoints,PARASOL_NREFL) :: parasolcrefl, Ncref |
---|
| 51 | |
---|
[2822] | 52 | |
---|
| 53 | #ifdef CPP_XIOS |
---|
| 54 | missing_val=missing_cosp |
---|
| 55 | #else |
---|
| 56 | missing_val=0. |
---|
| 57 | #endif |
---|
| 58 | |
---|
[2080] | 59 | Nlevout = vgrid%Nlvgrid |
---|
| 60 | Ncolout = Ncolumns |
---|
| 61 | |
---|
[1926] | 62 | ! A refaire |
---|
[2345] | 63 | itau_wcosp = itau_phy + itap + start_time * day_step_phy |
---|
[2137] | 64 | if (prt_level >= 10) then |
---|
[2345] | 65 | WRITE(lunout,*)'itau_wcosp, itap, start_time, day_step_phy =', & |
---|
| 66 | itau_wcosp, itap, start_time, day_step_phy |
---|
[2137] | 67 | endif |
---|
[1926] | 68 | |
---|
| 69 | ! On le donne a cosp_output_write_mod pour que les histwrite y aient acces: |
---|
| 70 | CALL set_itau_iocosp(itau_wcosp) |
---|
[2137] | 71 | if (prt_level >= 10) then |
---|
| 72 | WRITE(lunout,*)'itau_iocosp =',itau_iocosp |
---|
| 73 | endif |
---|
[1926] | 74 | |
---|
| 75 | ok_sync = .TRUE. |
---|
| 76 | |
---|
[2137] | 77 | !DO iinit=1, iinitend |
---|
| 78 | ! AI sept 2014 cette boucle supprimee |
---|
| 79 | ! On n'ecrit pas quand itap=1 (cosp) |
---|
[1926] | 80 | |
---|
[2137] | 81 | if (prt_level >= 10) then |
---|
| 82 | WRITE(lunout,*)'DO iinit=1, iinitend ',iinitend |
---|
| 83 | endif |
---|
| 84 | |
---|
[2268] | 85 | !#ifdef CPP_XIOS |
---|
| 86 | ! !$OMP MASTER |
---|
| 87 | !IF (cosp_varsdefined) THEN |
---|
| 88 | ! if (prt_level >= 10) then |
---|
| 89 | ! WRITE(lunout,*)'Apell xios_update_calendar cosp_varsdefined iinitend ', & |
---|
| 90 | ! cosp_varsdefined,iinitend |
---|
| 91 | ! endif |
---|
| 92 | ! CALL xios_update_calendar(itau_wcosp) |
---|
| 93 | !ENDIF |
---|
| 94 | ! !$OMP END MASTER |
---|
| 95 | ! !$OMP BARRIER |
---|
| 96 | !#endif |
---|
[1926] | 97 | |
---|
| 98 | if (cfg%Llidar_sim) then |
---|
| 99 | ! Pb des valeurs indefinies, on les met a 0 |
---|
| 100 | ! A refaire proprement |
---|
| 101 | do k = 1,Nlevout |
---|
| 102 | do ip = 1,Npoints |
---|
| 103 | if(stlidar%lidarcld(ip,k).eq.R_UNDEF)then |
---|
[2794] | 104 | stlidar%lidarcld(ip,k)=missing_val |
---|
[1926] | 105 | endif |
---|
| 106 | enddo |
---|
| 107 | |
---|
| 108 | do ii= 1,SR_BINS |
---|
| 109 | do ip = 1,Npoints |
---|
| 110 | if(stlidar%cfad_sr(ip,ii,k).eq.R_UNDEF)then |
---|
[2794] | 111 | stlidar%cfad_sr(ip,ii,k)=missing_val |
---|
[1926] | 112 | endif |
---|
| 113 | enddo |
---|
| 114 | enddo |
---|
| 115 | enddo |
---|
| 116 | |
---|
| 117 | do ip = 1,Npoints |
---|
| 118 | do k = 1,Nlevlmdz |
---|
| 119 | if(sglidar%beta_mol(ip,k).eq.R_UNDEF)then |
---|
[2794] | 120 | sglidar%beta_mol(ip,k)=missing_val |
---|
[1926] | 121 | endif |
---|
| 122 | |
---|
| 123 | do ii= 1,Ncolumns |
---|
| 124 | if(sglidar%beta_tot(ip,ii,k).eq.R_UNDEF)then |
---|
[2794] | 125 | sglidar%beta_tot(ip,ii,k)=missing_val |
---|
[1926] | 126 | endif |
---|
| 127 | enddo |
---|
| 128 | |
---|
| 129 | enddo !k = 1,Nlevlmdz |
---|
| 130 | enddo !ip = 1,Npoints |
---|
| 131 | |
---|
| 132 | do k = 1,LIDAR_NCAT |
---|
| 133 | do ip = 1,Npoints |
---|
| 134 | if(stlidar%cldlayer(ip,k).eq.R_UNDEF)then |
---|
[2794] | 135 | stlidar%cldlayer(ip,k)=missing_val |
---|
[1926] | 136 | endif |
---|
| 137 | enddo |
---|
| 138 | enddo |
---|
| 139 | |
---|
[2428] | 140 | ! AI 11 / 2015 |
---|
| 141 | |
---|
[2794] | 142 | where(stlidar%parasolrefl == R_UNDEF) stlidar%parasolrefl = missing_val |
---|
| 143 | where(stlidar%lidarcldtmp == R_UNDEF) stlidar%lidarcldtmp = missing_val |
---|
| 144 | where(stlidar%cldlayerphase == R_UNDEF) stlidar%cldlayerphase = missing_val |
---|
| 145 | where(stlidar%lidarcldphase == R_UNDEF) stlidar%lidarcldphase = missing_val |
---|
| 146 | where(stlidar%lidarcldtmp == R_UNDEF) stlidar%lidarcldtmp = missing_val |
---|
[2428] | 147 | |
---|
| 148 | |
---|
[2137] | 149 | print*,'Appel histwrite2d_cosp' |
---|
[1926] | 150 | CALL histwrite2d_cosp(o_cllcalipso,stlidar%cldlayer(:,1)) |
---|
| 151 | CALL histwrite2d_cosp(o_clhcalipso,stlidar%cldlayer(:,3)) |
---|
| 152 | CALL histwrite2d_cosp(o_clmcalipso,stlidar%cldlayer(:,2)) |
---|
| 153 | CALL histwrite2d_cosp(o_cltcalipso,stlidar%cldlayer(:,4)) |
---|
| 154 | CALL histwrite3d_cosp(o_clcalipso,stlidar%lidarcld,nvert) |
---|
[2428] | 155 | CALL histwrite3d_cosp(o_clcalipsotmp,stlidar%lidarcldtmp(:,:,1),nverttemp) |
---|
[1926] | 156 | |
---|
[2428] | 157 | CALL histwrite2d_cosp(o_cllcalipsoice,stlidar%cldlayerphase(:,1,1)) |
---|
| 158 | CALL histwrite2d_cosp(o_clhcalipsoice,stlidar%cldlayerphase(:,3,1)) |
---|
| 159 | CALL histwrite2d_cosp(o_clmcalipsoice,stlidar%cldlayerphase(:,2,1)) |
---|
| 160 | CALL histwrite2d_cosp(o_cltcalipsoice,stlidar%cldlayerphase(:,4,1)) |
---|
| 161 | CALL histwrite3d_cosp(o_clcalipsoice,stlidar%lidarcldphase(:,:,1),nvert) |
---|
| 162 | CALL histwrite3d_cosp(o_clcalipsotmpice,stlidar%lidarcldtmp(:,:,2),nverttemp) |
---|
| 163 | |
---|
| 164 | CALL histwrite2d_cosp(o_cllcalipsoliq,stlidar%cldlayerphase(:,1,2)) |
---|
| 165 | CALL histwrite2d_cosp(o_clhcalipsoliq,stlidar%cldlayerphase(:,3,2)) |
---|
| 166 | CALL histwrite2d_cosp(o_clmcalipsoliq,stlidar%cldlayerphase(:,2,2)) |
---|
| 167 | CALL histwrite2d_cosp(o_cltcalipsoliq,stlidar%cldlayerphase(:,4,2)) |
---|
| 168 | CALL histwrite3d_cosp(o_clcalipsoliq,stlidar%lidarcldphase(:,:,2),nvert) |
---|
| 169 | CALL histwrite3d_cosp(o_clcalipsotmpliq,stlidar%lidarcldtmp(:,:,3),nverttemp) |
---|
| 170 | |
---|
| 171 | CALL histwrite2d_cosp(o_cllcalipsoun,stlidar%cldlayerphase(:,1,3)) |
---|
| 172 | CALL histwrite2d_cosp(o_clhcalipsoun,stlidar%cldlayerphase(:,3,3)) |
---|
| 173 | CALL histwrite2d_cosp(o_clmcalipsoun,stlidar%cldlayerphase(:,2,3)) |
---|
| 174 | CALL histwrite2d_cosp(o_cltcalipsoun,stlidar%cldlayerphase(:,4,3)) |
---|
[2479] | 175 | CALL histwrite3d_cosp(o_clcalipsoun,stlidar%lidarcldphase(:,:,3),nvert) |
---|
[2428] | 176 | CALL histwrite3d_cosp(o_clcalipsotmpun,stlidar%lidarcldtmp(:,:,4),nverttemp) |
---|
| 177 | |
---|
[2822] | 178 | #ifdef CPP_XIOS |
---|
| 179 | CALL histwrite4d_cosp(o_cfad_lidarsr532,stlidar%cfad_sr) |
---|
| 180 | #else |
---|
[1926] | 181 | do icl=1,SR_BINS |
---|
| 182 | CALL histwrite3d_cosp(o_cfad_lidarsr532,stlidar%cfad_sr(:,icl,:),nvert,icl) |
---|
| 183 | enddo |
---|
[2822] | 184 | #endif |
---|
[1926] | 185 | |
---|
[2867] | 186 | CALL histwrite3d_cosp(o_parasol_refl,stlidar%parasolrefl,nvertp) |
---|
[1926] | 187 | do k=1,PARASOL_NREFL |
---|
| 188 | do ip=1, Npoints |
---|
[2867] | 189 | if (stlidar%cldlayer(ip,4).gt.0.01.and.stlidar%parasolrefl(ip,k).ne.missing_val) then |
---|
[1926] | 190 | parasolcrefl(ip,k)=(stlidar%parasolrefl(ip,k)-0.03*(1.-stlidar%cldlayer(ip,4)))/ & |
---|
| 191 | stlidar%cldlayer(ip,4) |
---|
| 192 | Ncref(ip,k) = 1. |
---|
| 193 | else |
---|
[2822] | 194 | parasolcrefl(ip,k)=missing_val |
---|
[1926] | 195 | Ncref(ip,k) = 0. |
---|
| 196 | endif |
---|
| 197 | enddo |
---|
[2867] | 198 | |
---|
[1926] | 199 | enddo |
---|
[2268] | 200 | CALL histwrite3d_cosp(o_Ncrefl,Ncref,nvertp) |
---|
[1926] | 201 | CALL histwrite3d_cosp(o_parasol_crefl,parasolcrefl,nvertp) |
---|
| 202 | |
---|
[2822] | 203 | #ifdef CPP_XIOS |
---|
| 204 | CALL histwrite4d_cosp(o_atb532,sglidar%beta_tot) |
---|
| 205 | #else |
---|
[1926] | 206 | do icl=1,Ncolumns |
---|
| 207 | CALL histwrite3d_cosp(o_atb532,sglidar%beta_tot(:,icl,:),nvertmcosp,icl) |
---|
| 208 | enddo |
---|
[2822] | 209 | #endif |
---|
| 210 | |
---|
[1926] | 211 | CALL histwrite3d_cosp(o_beta_mol532,sglidar%beta_mol,nvertmcosp) |
---|
| 212 | endif !Lidar |
---|
| 213 | |
---|
[2428] | 214 | if (cfg%Lradar_sim) then |
---|
[2822] | 215 | |
---|
| 216 | #ifdef CPP_XIOS |
---|
| 217 | CALL histwrite4d_cosp(o_dbze94,sgradar%Ze_tot) |
---|
| 218 | CALL histwrite4d_cosp(o_cfadDbze94,stradar%cfad_ze) |
---|
| 219 | #else |
---|
[2428] | 220 | do icl=1,Ncolumns |
---|
| 221 | CALL histwrite3d_cosp(o_dbze94,sgradar%Ze_tot(:,icl,:),nvertmcosp,icl) |
---|
| 222 | enddo |
---|
| 223 | do icl=1,DBZE_BINS |
---|
| 224 | CALL histwrite3d_cosp(o_cfadDbze94,stradar%cfad_ze(:,icl,:),nvert,icl) |
---|
| 225 | enddo |
---|
[2822] | 226 | #endif |
---|
[2428] | 227 | endif |
---|
| 228 | |
---|
| 229 | if (cfg%Llidar_sim .and. cfg%Lradar_sim) then |
---|
| 230 | where(stradar%lidar_only_freq_cloud == R_UNDEF) & |
---|
[2794] | 231 | stradar%lidar_only_freq_cloud = missing_val |
---|
[2428] | 232 | CALL histwrite3d_cosp(o_clcalipso2,stradar%lidar_only_freq_cloud,nvert) |
---|
[2447] | 233 | where(stradar%radar_lidar_tcc == R_UNDEF) & |
---|
[2794] | 234 | stradar%radar_lidar_tcc = missing_val |
---|
[2447] | 235 | CALL histwrite2d_cosp(o_cltlidarradar,stradar%radar_lidar_tcc) |
---|
[2428] | 236 | endif |
---|
| 237 | |
---|
[1926] | 238 | if (cfg%Lisccp_sim) then |
---|
| 239 | |
---|
| 240 | ! Traitement des valeurs indefinies |
---|
| 241 | do ip = 1,Npoints |
---|
[2428] | 242 | if(isccp%totalcldarea(ip).eq.R_UNDEF)then |
---|
[2794] | 243 | isccp%totalcldarea(ip)=missing_val |
---|
[1926] | 244 | endif |
---|
[2428] | 245 | if(isccp%meanptop(ip).eq.R_UNDEF)then |
---|
[2794] | 246 | isccp%meanptop(ip)=missing_val |
---|
[1926] | 247 | endif |
---|
[2428] | 248 | if(isccp%meantaucld(ip).eq.R_UNDEF)then |
---|
[2794] | 249 | isccp%meantaucld(ip)=missing_val |
---|
[1926] | 250 | endif |
---|
[2428] | 251 | if(isccp%meanalbedocld(ip).eq.R_UNDEF)then |
---|
[2794] | 252 | isccp%meanalbedocld(ip)=missing_val |
---|
[1926] | 253 | endif |
---|
[2428] | 254 | if(isccp%meantb(ip).eq.R_UNDEF)then |
---|
[2794] | 255 | isccp%meantb(ip)=missing_val |
---|
[1926] | 256 | endif |
---|
[2428] | 257 | if(isccp%meantbclr(ip).eq.R_UNDEF)then |
---|
[2794] | 258 | isccp%meantbclr(ip)=missing_val |
---|
[1926] | 259 | endif |
---|
| 260 | |
---|
| 261 | do k=1,7 |
---|
| 262 | do ii=1,7 |
---|
[2428] | 263 | if(isccp%fq_isccp(ip,ii,k).eq.R_UNDEF)then |
---|
[2794] | 264 | isccp%fq_isccp(ip,ii,k)=missing_val |
---|
[1926] | 265 | endif |
---|
| 266 | enddo |
---|
| 267 | enddo |
---|
| 268 | |
---|
| 269 | do ii=1,Ncolumns |
---|
[2428] | 270 | if(isccp%boxtau(ip,ii).eq.R_UNDEF)then |
---|
[2794] | 271 | isccp%boxtau(ip,ii)=missing_val |
---|
[1926] | 272 | endif |
---|
| 273 | enddo |
---|
| 274 | |
---|
| 275 | do ii=1,Ncolumns |
---|
[2428] | 276 | if(isccp%boxptop(ip,ii).eq.R_UNDEF)then |
---|
[2794] | 277 | isccp%boxptop(ip,ii)=missing_val |
---|
[1926] | 278 | endif |
---|
| 279 | enddo |
---|
| 280 | enddo |
---|
| 281 | |
---|
| 282 | CALL histwrite2d_cosp(o_sunlit,gbx%sunlit) |
---|
[2822] | 283 | #ifdef CPP_XIOS |
---|
| 284 | CALL histwrite4d_cosp(o_clisccp2,isccp%fq_isccp) |
---|
| 285 | #else |
---|
[1926] | 286 | do icl=1,7 |
---|
| 287 | CALL histwrite3d_cosp(o_clisccp2,isccp%fq_isccp(:,icl,:),nvertisccp,icl) |
---|
| 288 | enddo |
---|
[2822] | 289 | #endif |
---|
[1926] | 290 | CALL histwrite3d_cosp(o_boxtauisccp,isccp%boxtau,nvertcol) |
---|
| 291 | CALL histwrite3d_cosp(o_boxptopisccp,isccp%boxptop,nvertcol) |
---|
| 292 | CALL histwrite2d_cosp(o_tclisccp,isccp%totalcldarea) |
---|
| 293 | CALL histwrite2d_cosp(o_ctpisccp,isccp%meanptop) |
---|
| 294 | CALL histwrite2d_cosp(o_tauisccp,isccp%meantaucld) |
---|
| 295 | CALL histwrite2d_cosp(o_albisccp,isccp%meanalbedocld) |
---|
| 296 | CALL histwrite2d_cosp(o_meantbisccp,isccp%meantb) |
---|
| 297 | CALL histwrite2d_cosp(o_meantbclrisccp,isccp%meantbclr) |
---|
| 298 | endif ! Isccp |
---|
| 299 | |
---|
[2428] | 300 | ! MISR simulator |
---|
| 301 | if (cfg%Lmisr_sim) then |
---|
| 302 | do ip=1,Npoints |
---|
| 303 | do ii=1,7 |
---|
| 304 | do k=1,MISR_N_CTH |
---|
| 305 | if(misr%fq_MISR(ip,ii,k).eq.R_UNDEF)then |
---|
[2794] | 306 | misr%fq_MISR(ip,ii,k)=missing_val |
---|
[2428] | 307 | endif |
---|
| 308 | enddo |
---|
| 309 | enddo |
---|
| 310 | enddo |
---|
| 311 | |
---|
[2822] | 312 | #ifdef CPP_XIOS |
---|
| 313 | CALL histwrite4d_cosp(o_clMISR,misr%fq_MISR) |
---|
| 314 | #else |
---|
[2428] | 315 | do icl=1,7 |
---|
| 316 | CALL histwrite3d_cosp(o_clMISR,misr%fq_MISR(:,icl,:),nvertmisr,icl) |
---|
| 317 | enddo |
---|
[2822] | 318 | #endif |
---|
[2428] | 319 | endif |
---|
| 320 | |
---|
| 321 | ! Modis simulator |
---|
| 322 | if (cfg%Lmodis_sim) then |
---|
| 323 | |
---|
| 324 | do ip=1,Npoints |
---|
| 325 | if(modis%Cloud_Fraction_Low_Mean(ip).eq.R_UNDEF)then |
---|
[2794] | 326 | modis%Cloud_Fraction_Low_Mean(ip)=missing_val |
---|
[2428] | 327 | endif |
---|
| 328 | if(modis%Cloud_Fraction_High_Mean(ip).eq.R_UNDEF)then |
---|
[2794] | 329 | modis%Cloud_Fraction_High_Mean(ip)=missing_val |
---|
[2428] | 330 | endif |
---|
| 331 | if(modis%Cloud_Fraction_Mid_Mean(ip).eq.R_UNDEF)then |
---|
[2794] | 332 | modis%Cloud_Fraction_Mid_Mean(ip)=missing_val |
---|
[2428] | 333 | endif |
---|
| 334 | if(modis%Cloud_Fraction_Total_Mean(ip).eq.R_UNDEF)then |
---|
[2794] | 335 | modis%Cloud_Fraction_Total_Mean(ip)=missing_val |
---|
[2428] | 336 | endif |
---|
| 337 | if(modis%Cloud_Fraction_Water_Mean(ip).eq.R_UNDEF)then |
---|
[2794] | 338 | modis%Cloud_Fraction_Water_Mean(ip)=missing_val |
---|
[2428] | 339 | endif |
---|
| 340 | if(modis%Cloud_Fraction_Ice_Mean(ip).eq.R_UNDEF)then |
---|
[2794] | 341 | modis%Cloud_Fraction_Ice_Mean(ip)=missing_val |
---|
[2428] | 342 | endif |
---|
| 343 | if(modis%Optical_Thickness_Total_Mean(ip).eq.R_UNDEF)then |
---|
[2794] | 344 | modis%Optical_Thickness_Total_Mean(ip)=missing_val |
---|
[2428] | 345 | endif |
---|
| 346 | if(modis%Optical_Thickness_Water_Mean(ip).eq.R_UNDEF)then |
---|
[2794] | 347 | modis%Optical_Thickness_Water_Mean(ip)=missing_val |
---|
[2428] | 348 | endif |
---|
| 349 | if(modis%Optical_Thickness_Ice_Mean(ip).eq.R_UNDEF)then |
---|
[2794] | 350 | modis%Optical_Thickness_Ice_Mean(ip)=missing_val |
---|
[2428] | 351 | endif |
---|
| 352 | if(modis%Cloud_Particle_Size_Water_Mean(ip).eq.R_UNDEF)then |
---|
[2794] | 353 | modis%Cloud_Particle_Size_Water_Mean(ip)=missing_val |
---|
[2428] | 354 | endif |
---|
[2560] | 355 | if(modis%Cloud_Particle_Size_Ice_Mean(ip).eq.R_UNDEF)then |
---|
[2794] | 356 | modis%Cloud_Particle_Size_Ice_Mean(ip)=missing_val |
---|
[2560] | 357 | endif |
---|
[2428] | 358 | if(modis%Cloud_Top_Pressure_Total_Mean(ip).eq.R_UNDEF)then |
---|
[2794] | 359 | modis%Cloud_Top_Pressure_Total_Mean(ip)=missing_val |
---|
[2428] | 360 | endif |
---|
| 361 | if(modis%Liquid_Water_Path_Mean(ip).eq.R_UNDEF)then |
---|
[2794] | 362 | modis%Liquid_Water_Path_Mean(ip)=missing_val |
---|
[2428] | 363 | endif |
---|
| 364 | if(modis%Ice_Water_Path_Mean(ip).eq.R_UNDEF)then |
---|
[2794] | 365 | modis%Ice_Water_Path_Mean(ip)=missing_val |
---|
[2428] | 366 | endif |
---|
| 367 | |
---|
| 368 | enddo |
---|
[2794] | 369 | |
---|
| 370 | where(modis%Optical_Thickness_Total_LogMean == R_UNDEF) & |
---|
| 371 | modis%Optical_Thickness_Total_LogMean = missing_val |
---|
| 372 | |
---|
| 373 | |
---|
| 374 | where(modis%Optical_Thickness_Water_LogMean == R_UNDEF) & |
---|
| 375 | modis%Optical_Thickness_Water_LogMean = missing_val |
---|
| 376 | |
---|
| 377 | where(modis%Optical_Thickness_Ice_LogMean == R_UNDEF) & |
---|
| 378 | modis%Optical_Thickness_Ice_LogMean = missing_val |
---|
[2428] | 379 | |
---|
| 380 | CALL histwrite2d_cosp(o_cllmodis,modis%Cloud_Fraction_Low_Mean) |
---|
| 381 | CALL histwrite2d_cosp(o_clhmodis,modis%Cloud_Fraction_High_Mean) |
---|
| 382 | CALL histwrite2d_cosp(o_clmmodis,modis%Cloud_Fraction_Mid_Mean) |
---|
| 383 | CALL histwrite2d_cosp(o_cltmodis,modis%Cloud_Fraction_Total_Mean) |
---|
| 384 | CALL histwrite2d_cosp(o_clwmodis,modis%Cloud_Fraction_Water_Mean) |
---|
| 385 | CALL histwrite2d_cosp(o_climodis,modis%Cloud_Fraction_Ice_Mean) |
---|
| 386 | CALL histwrite2d_cosp(o_tautmodis,modis%Optical_Thickness_Total_Mean) |
---|
| 387 | CALL histwrite2d_cosp(o_tauwmodis,modis%Optical_Thickness_Water_Mean) |
---|
| 388 | CALL histwrite2d_cosp(o_tauimodis,modis%Optical_Thickness_Ice_Mean) |
---|
| 389 | CALL histwrite2d_cosp(o_tautlogmodis,modis%Optical_Thickness_Total_LogMean) |
---|
| 390 | CALL histwrite2d_cosp(o_tauwlogmodis,modis%Optical_Thickness_Water_LogMean) |
---|
| 391 | CALL histwrite2d_cosp(o_tauilogmodis,modis%Optical_Thickness_Ice_LogMean) |
---|
| 392 | CALL histwrite2d_cosp(o_reffclwmodis,modis%Cloud_Particle_Size_Water_Mean) |
---|
| 393 | CALL histwrite2d_cosp(o_reffclimodis,modis%Cloud_Particle_Size_Ice_Mean) |
---|
| 394 | CALL histwrite2d_cosp(o_pctmodis,modis%Cloud_Top_Pressure_Total_Mean) |
---|
| 395 | CALL histwrite2d_cosp(o_lwpmodis,modis%Liquid_Water_Path_Mean) |
---|
| 396 | CALL histwrite2d_cosp(o_iwpmodis,modis%Ice_Water_Path_Mean) |
---|
| 397 | |
---|
| 398 | do ip=1,Npoints |
---|
| 399 | do ii=1,7 |
---|
| 400 | do k=1,7 |
---|
| 401 | if(modis%Optical_Thickness_vs_Cloud_Top_Pressure(ip,ii,k).eq.R_UNDEF)then |
---|
[2794] | 402 | modis%Optical_Thickness_vs_Cloud_Top_Pressure(ip,ii,k)=missing_val |
---|
[2428] | 403 | endif |
---|
| 404 | enddo |
---|
| 405 | enddo |
---|
| 406 | enddo |
---|
| 407 | |
---|
[2822] | 408 | #ifdef CPP_XIOS |
---|
| 409 | CALL histwrite4d_cosp(o_clmodis,modis%Optical_Thickness_vs_Cloud_Top_Pressure) |
---|
| 410 | #else |
---|
[2428] | 411 | do icl=1,7 |
---|
| 412 | CALL histwrite3d_cosp(o_clmodis, & |
---|
| 413 | modis%Optical_Thickness_vs_Cloud_Top_Pressure(:,icl,:),nvertisccp,icl) |
---|
| 414 | enddo |
---|
[2822] | 415 | #endif |
---|
[2428] | 416 | |
---|
[2713] | 417 | where(modis%Optical_Thickness_vs_ReffIce == R_UNDEF) & |
---|
[2794] | 418 | modis%Optical_Thickness_vs_ReffIce = missing_val |
---|
[2713] | 419 | |
---|
| 420 | where(modis%Optical_Thickness_vs_ReffLiq == R_UNDEF) & |
---|
[2794] | 421 | modis%Optical_Thickness_vs_ReffLiq = missing_val |
---|
[2713] | 422 | |
---|
[2822] | 423 | #ifdef CPP_XIOS |
---|
| 424 | ! print*,'dimension de crimodis=',size(modis%Optical_Thickness_vs_ReffIce,2),& |
---|
| 425 | ! size(modis%Optical_Thickness_vs_ReffIce,3) |
---|
| 426 | CALL histwrite4d_cosp(o_crimodis,modis%Optical_Thickness_vs_ReffIce) |
---|
| 427 | CALL histwrite4d_cosp(o_crlmodis,modis%Optical_Thickness_vs_ReffLiq) |
---|
| 428 | #else |
---|
[2713] | 429 | do icl=1,7 |
---|
| 430 | CALL histwrite3d_cosp(o_crimodis, & |
---|
| 431 | modis%Optical_Thickness_vs_ReffIce(:,icl,:),nvertReffIce,icl) |
---|
| 432 | CALL histwrite3d_cosp(o_crlmodis, & |
---|
| 433 | modis%Optical_Thickness_vs_ReffLiq(:,icl,:),nvertReffLiq,icl) |
---|
| 434 | enddo |
---|
[2822] | 435 | #endif |
---|
[2760] | 436 | endif |
---|
[2713] | 437 | |
---|
[1926] | 438 | IF(.NOT.cosp_varsdefined) THEN |
---|
| 439 | !$OMP MASTER |
---|
[2137] | 440 | #ifndef CPP_IOIPSL_NO_OUTPUT |
---|
[1926] | 441 | DO iff=1,3 |
---|
| 442 | IF (cosp_outfilekeys(iff)) THEN |
---|
| 443 | CALL histend(cosp_nidfiles(iff)) |
---|
| 444 | ENDIF ! cosp_outfilekeys |
---|
| 445 | ENDDO ! iff |
---|
[2137] | 446 | #endif |
---|
| 447 | ! Fermeture dans phys_output_write |
---|
| 448 | !#ifdef CPP_XIOS |
---|
[1926] | 449 | !On finalise l'initialisation: |
---|
[2137] | 450 | !CALL wxios_closedef() |
---|
| 451 | !#endif |
---|
| 452 | |
---|
[1926] | 453 | !$OMP END MASTER |
---|
| 454 | !$OMP BARRIER |
---|
| 455 | cosp_varsdefined = .TRUE. |
---|
| 456 | END IF |
---|
| 457 | |
---|
[2137] | 458 | IF(cosp_varsdefined) THEN |
---|
[1926] | 459 | ! On synchronise les fichiers pour IOIPSL |
---|
[2137] | 460 | #ifndef CPP_IOIPSL_NO_OUTPUT |
---|
[1926] | 461 | !$OMP MASTER |
---|
[2137] | 462 | DO iff=1,3 |
---|
[1926] | 463 | IF (ok_sync .AND. cosp_outfilekeys(iff)) THEN |
---|
| 464 | CALL histsync(cosp_nidfiles(iff)) |
---|
| 465 | ENDIF |
---|
[2137] | 466 | END DO |
---|
[1926] | 467 | !$OMP END MASTER |
---|
[2137] | 468 | #endif |
---|
| 469 | ENDIF !cosp_varsdefined |
---|
[1926] | 470 | |
---|
| 471 | END SUBROUTINE cosp_output_write |
---|
| 472 | |
---|
| 473 | ! ug Routine pour definir itau_iocosp depuis cosp_output_write_mod: |
---|
| 474 | SUBROUTINE set_itau_iocosp(ito) |
---|
| 475 | IMPLICIT NONE |
---|
| 476 | INTEGER, INTENT(IN) :: ito |
---|
| 477 | itau_iocosp = ito |
---|
| 478 | END SUBROUTINE |
---|
| 479 | |
---|
| 480 | SUBROUTINE histdef2d_cosp (iff,var) |
---|
| 481 | |
---|
| 482 | USE ioipsl |
---|
| 483 | USE dimphy |
---|
| 484 | use iophy |
---|
| 485 | USE mod_phys_lmdz_para |
---|
[2345] | 486 | USE mod_grid_phy_lmdz, ONLY: nbp_lon |
---|
[2311] | 487 | USE print_control_mod, ONLY: lunout,prt_level |
---|
[1986] | 488 | #ifdef CPP_XIOS |
---|
| 489 | USE wxios |
---|
| 490 | #endif |
---|
[1926] | 491 | |
---|
| 492 | IMPLICIT NONE |
---|
| 493 | |
---|
[2137] | 494 | INCLUDE "clesphys.h" |
---|
[1926] | 495 | |
---|
| 496 | INTEGER :: iff |
---|
| 497 | TYPE(ctrl_outcosp) :: var |
---|
| 498 | |
---|
| 499 | REAL zstophym |
---|
| 500 | CHARACTER(LEN=20) :: typeecrit |
---|
| 501 | |
---|
| 502 | ! ug On récupère le type écrit de la structure: |
---|
| 503 | ! Assez moche, Ã| refaire si meilleure méthode... |
---|
| 504 | IF (INDEX(var%cosp_typeecrit(iff), "once") > 0) THEN |
---|
| 505 | typeecrit = 'once' |
---|
| 506 | ELSE IF(INDEX(var%cosp_typeecrit(iff), "t_min") > 0) THEN |
---|
| 507 | typeecrit = 't_min(X)' |
---|
| 508 | ELSE IF(INDEX(var%cosp_typeecrit(iff), "t_max") > 0) THEN |
---|
| 509 | typeecrit = 't_max(X)' |
---|
| 510 | ELSE IF(INDEX(var%cosp_typeecrit(iff), "inst") > 0) THEN |
---|
| 511 | typeecrit = 'inst(X)' |
---|
| 512 | ELSE |
---|
| 513 | typeecrit = cosp_outfiletypes(iff) |
---|
| 514 | ENDIF |
---|
| 515 | |
---|
| 516 | IF (typeecrit=='inst(X)'.OR.typeecrit=='once') THEN |
---|
| 517 | zstophym=zoutm_cosp(iff) |
---|
| 518 | ELSE |
---|
| 519 | zstophym=zdtimemoy_cosp |
---|
| 520 | ENDIF |
---|
| 521 | |
---|
| 522 | #ifdef CPP_XIOS |
---|
[2137] | 523 | IF (.not. ok_all_xml) then |
---|
| 524 | IF ( var%cles(iff) ) THEN |
---|
| 525 | if (prt_level >= 10) then |
---|
| 526 | WRITE(lunout,*)'Appel wxios_add_field_to_file var%name =',var%name |
---|
| 527 | endif |
---|
[1986] | 528 | CALL wxios_add_field_to_file(var%name, 2, cosp_nidfiles(iff), cosp_outfilenames(iff), & |
---|
[2137] | 529 | var%description, var%unit, 1, typeecrit) |
---|
| 530 | ENDIF |
---|
| 531 | ENDIF |
---|
[1926] | 532 | #endif |
---|
[2137] | 533 | |
---|
| 534 | #ifndef CPP_IOIPSL_NO_OUTPUT |
---|
[1926] | 535 | IF ( var%cles(iff) ) THEN |
---|
| 536 | CALL histdef (cosp_nidfiles(iff), var%name, var%description, var%unit, & |
---|
[2345] | 537 | nbp_lon,jj_nb,nhoricosp(iff), 1,1,1, -99, 32, & |
---|
[1926] | 538 | typeecrit, zstophym,zoutm_cosp(iff)) |
---|
| 539 | ENDIF |
---|
[2137] | 540 | #endif |
---|
[1926] | 541 | |
---|
| 542 | END SUBROUTINE histdef2d_cosp |
---|
| 543 | |
---|
| 544 | SUBROUTINE histdef3d_cosp (iff,var,nvertsave,ncols) |
---|
| 545 | USE ioipsl |
---|
| 546 | USE dimphy |
---|
| 547 | use iophy |
---|
| 548 | USE mod_phys_lmdz_para |
---|
[2345] | 549 | USE mod_grid_phy_lmdz, ONLY: nbp_lon |
---|
[2311] | 550 | USE print_control_mod, ONLY: lunout,prt_level |
---|
[1926] | 551 | |
---|
[1986] | 552 | #ifdef CPP_XIOS |
---|
| 553 | USE wxios |
---|
| 554 | #endif |
---|
| 555 | |
---|
| 556 | |
---|
[1926] | 557 | IMPLICIT NONE |
---|
| 558 | |
---|
[2137] | 559 | INCLUDE "clesphys.h" |
---|
[1926] | 560 | |
---|
| 561 | INTEGER :: iff, klevs |
---|
| 562 | INTEGER, INTENT(IN), OPTIONAL :: ncols ! ug RUSTINE POUR LES variables 4D |
---|
| 563 | INTEGER, INTENT(IN) :: nvertsave |
---|
| 564 | TYPE(ctrl_outcosp) :: var |
---|
| 565 | |
---|
| 566 | REAL zstophym |
---|
| 567 | CHARACTER(LEN=20) :: typeecrit, nomi |
---|
| 568 | CHARACTER(LEN=20) :: nom |
---|
| 569 | character(len=2) :: str2 |
---|
[2137] | 570 | CHARACTER(len=20) :: nam_axvert |
---|
[1926] | 571 | |
---|
| 572 | ! Axe vertical |
---|
| 573 | IF (nvertsave.eq.nvertp(iff)) THEN |
---|
| 574 | klevs=PARASOL_NREFL |
---|
[2137] | 575 | nam_axvert="sza" |
---|
[1926] | 576 | ELSE IF (nvertsave.eq.nvertisccp(iff)) THEN |
---|
| 577 | klevs=7 |
---|
[2137] | 578 | nam_axvert="pressure2" |
---|
[1926] | 579 | ELSE IF (nvertsave.eq.nvertcol(iff)) THEN |
---|
| 580 | klevs=Ncolout |
---|
[2137] | 581 | nam_axvert="column" |
---|
[2428] | 582 | ELSE IF (nvertsave.eq.nverttemp(iff)) THEN |
---|
| 583 | klevs=LIDAR_NTEMP |
---|
| 584 | nam_axvert="temp" |
---|
| 585 | ELSE IF (nvertsave.eq.nvertmisr(iff)) THEN |
---|
| 586 | klevs=MISR_N_CTH |
---|
[2713] | 587 | nam_axvert="cth16" |
---|
| 588 | ELSE IF (nvertsave.eq.nvertReffIce(iff)) THEN |
---|
| 589 | klevs= numMODISReffIceBins |
---|
| 590 | nam_axvert="ReffIce" |
---|
| 591 | ELSE IF (nvertsave.eq.nvertReffLiq(iff)) THEN |
---|
| 592 | klevs= numMODISReffLiqBins |
---|
| 593 | nam_axvert="ReffLiq" |
---|
[1926] | 594 | ELSE |
---|
[2137] | 595 | klevs=Nlevout |
---|
| 596 | nam_axvert="presnivs" |
---|
[1926] | 597 | ENDIF |
---|
[2137] | 598 | |
---|
[1926] | 599 | ! ug RUSTINE POUR LES Champs 4D |
---|
| 600 | IF (PRESENT(ncols)) THEN |
---|
| 601 | write(str2,'(i2.2)')ncols |
---|
| 602 | nomi=var%name |
---|
| 603 | nom="c"//str2//"_"//nomi |
---|
| 604 | ELSE |
---|
| 605 | nom=var%name |
---|
| 606 | END IF |
---|
| 607 | |
---|
| 608 | ! ug On récupère le type écrit de la structure: |
---|
| 609 | ! Assez moche, Ã| refaire si meilleure méthode... |
---|
| 610 | IF (INDEX(var%cosp_typeecrit(iff), "once") > 0) THEN |
---|
| 611 | typeecrit = 'once' |
---|
| 612 | ELSE IF(INDEX(var%cosp_typeecrit(iff), "t_min") > 0) THEN |
---|
| 613 | typeecrit = 't_min(X)' |
---|
| 614 | ELSE IF(INDEX(var%cosp_typeecrit(iff), "t_max") > 0) THEN |
---|
| 615 | typeecrit = 't_max(X)' |
---|
| 616 | ELSE IF(INDEX(var%cosp_typeecrit(iff), "inst") > 0) THEN |
---|
| 617 | typeecrit = 'inst(X)' |
---|
| 618 | ELSE |
---|
| 619 | typeecrit = cosp_outfiletypes(iff) |
---|
| 620 | ENDIF |
---|
| 621 | |
---|
| 622 | IF (typeecrit=='inst(X)'.OR.typeecrit=='once') THEN |
---|
| 623 | zstophym=zoutm_cosp(iff) |
---|
| 624 | ELSE |
---|
| 625 | zstophym=zdtimemoy_cosp |
---|
| 626 | ENDIF |
---|
| 627 | |
---|
| 628 | #ifdef CPP_XIOS |
---|
[2137] | 629 | IF (.not. ok_all_xml) then |
---|
| 630 | IF ( var%cles(iff) ) THEN |
---|
| 631 | if (prt_level >= 10) then |
---|
| 632 | WRITE(lunout,*)'Appel wxios_add_field_to_file 3d nom variable nam_axvert = ',nom, nam_axvert |
---|
| 633 | endif |
---|
| 634 | CALL wxios_add_field_to_file(nom, 3, cosp_nidfiles(iff), cosp_outfilenames(iff), & |
---|
| 635 | var%description, var%unit, 1, typeecrit, nam_axvert) |
---|
| 636 | ENDIF |
---|
| 637 | ENDIF |
---|
[1926] | 638 | #endif |
---|
[2137] | 639 | |
---|
| 640 | #ifndef CPP_IOIPSL_NO_OUTPUT |
---|
[1926] | 641 | IF ( var%cles(iff) ) THEN |
---|
| 642 | CALL histdef (cosp_nidfiles(iff), nom, var%description, var%unit, & |
---|
[2345] | 643 | nbp_lon, jj_nb, nhoricosp(iff), klevs, 1, & |
---|
[1926] | 644 | klevs, nvertsave, 32, typeecrit, & |
---|
| 645 | zstophym, zoutm_cosp(iff)) |
---|
| 646 | ENDIF |
---|
[2137] | 647 | #endif |
---|
| 648 | |
---|
[1926] | 649 | END SUBROUTINE histdef3d_cosp |
---|
| 650 | |
---|
| 651 | SUBROUTINE histwrite2d_cosp(var,field) |
---|
| 652 | USE dimphy |
---|
| 653 | USE mod_phys_lmdz_para |
---|
| 654 | USE ioipsl |
---|
| 655 | use iophy |
---|
[2345] | 656 | USE mod_grid_phy_lmdz, ONLY: nbp_lon |
---|
[2311] | 657 | USE print_control_mod, ONLY: lunout,prt_level |
---|
[1926] | 658 | |
---|
| 659 | #ifdef CPP_XIOS |
---|
[2137] | 660 | USE xios, only: xios_send_field |
---|
[1926] | 661 | #endif |
---|
| 662 | |
---|
| 663 | IMPLICIT NONE |
---|
[2137] | 664 | INCLUDE 'clesphys.h' |
---|
[1926] | 665 | |
---|
| 666 | TYPE(ctrl_outcosp), INTENT(IN) :: var |
---|
| 667 | REAL, DIMENSION(:), INTENT(IN) :: field |
---|
| 668 | |
---|
| 669 | INTEGER :: iff |
---|
| 670 | |
---|
| 671 | REAL,DIMENSION(klon_mpi) :: buffer_omp |
---|
| 672 | INTEGER, allocatable, DIMENSION(:) :: index2d |
---|
[2345] | 673 | REAL :: Field2d(nbp_lon,jj_nb) |
---|
[1926] | 674 | CHARACTER(LEN=20) :: nomi, nom |
---|
| 675 | character(len=2) :: str2 |
---|
[2137] | 676 | LOGICAL, SAVE :: firstx |
---|
| 677 | !$OMP THREADPRIVATE(firstx) |
---|
[1926] | 678 | |
---|
| 679 | IF (prt_level >= 9) WRITE(lunout,*)'Begin histrwrite2d ',var%name |
---|
| 680 | |
---|
| 681 | ! On regarde si on est dans la phase de définition ou d'écriture: |
---|
| 682 | IF(.NOT.cosp_varsdefined) THEN |
---|
| 683 | !$OMP MASTER |
---|
| 684 | !Si phase de définition.... on définit |
---|
| 685 | CALL conf_cospoutputs(var%name,var%cles) |
---|
| 686 | DO iff=1, 3 |
---|
| 687 | IF (cosp_outfilekeys(iff)) THEN |
---|
| 688 | CALL histdef2d_cosp(iff, var) |
---|
| 689 | ENDIF |
---|
| 690 | ENDDO |
---|
| 691 | !$OMP END MASTER |
---|
| 692 | ELSE |
---|
| 693 | !Et sinon on.... écrit |
---|
| 694 | IF (SIZE(field)/=klon) & |
---|
[2311] | 695 | CALL abort_physic('iophy::histwrite2d_cosp','Field first DIMENSION not equal to klon',1) |
---|
[1926] | 696 | |
---|
| 697 | CALL Gather_omp(field,buffer_omp) |
---|
| 698 | !$OMP MASTER |
---|
| 699 | CALL grid1Dto2D_mpi(buffer_omp,Field2d) |
---|
| 700 | |
---|
| 701 | ! La boucle sur les fichiers: |
---|
[2137] | 702 | firstx=.true. |
---|
[1926] | 703 | DO iff=1, 3 |
---|
| 704 | IF (var%cles(iff) .AND. cosp_outfilekeys(iff)) THEN |
---|
[2345] | 705 | ALLOCATE(index2d(nbp_lon*jj_nb)) |
---|
[2137] | 706 | #ifndef CPP_IOIPSL_NO_OUTPUT |
---|
[2345] | 707 | CALL histwrite(cosp_nidfiles(iff),var%name,itau_iocosp,Field2d,nbp_lon*jj_nb,index2d) |
---|
[2137] | 708 | #endif |
---|
| 709 | deallocate(index2d) |
---|
[1926] | 710 | #ifdef CPP_XIOS |
---|
[2137] | 711 | IF (.not. ok_all_xml) then |
---|
| 712 | if (firstx) then |
---|
| 713 | if (prt_level >= 10) then |
---|
| 714 | WRITE(lunout,*)'xios_send_field variable ',var%name |
---|
| 715 | endif |
---|
| 716 | CALL xios_send_field(var%name, Field2d) |
---|
| 717 | firstx=.false. |
---|
| 718 | endif |
---|
| 719 | ENDIF |
---|
[1926] | 720 | #endif |
---|
[2137] | 721 | ENDIF |
---|
| 722 | ENDDO |
---|
[1926] | 723 | |
---|
[2137] | 724 | #ifdef CPP_XIOS |
---|
| 725 | IF (ok_all_xml) THEN |
---|
[2428] | 726 | if (prt_level >= 1) then |
---|
[2137] | 727 | WRITE(lunout,*)'xios_send_field variable ',var%name |
---|
| 728 | endif |
---|
| 729 | CALL xios_send_field(var%name, Field2d) |
---|
| 730 | ENDIF |
---|
| 731 | #endif |
---|
| 732 | |
---|
[1926] | 733 | !$OMP END MASTER |
---|
| 734 | ENDIF ! vars_defined |
---|
[2137] | 735 | IF (prt_level >= 9) WRITE(lunout,*)'End histrwrite2d_cosp ',var%name |
---|
[1926] | 736 | END SUBROUTINE histwrite2d_cosp |
---|
| 737 | |
---|
| 738 | ! ug NOUVELLE VERSION DES WRITE AVEC LA BOUCLE DO RENTREE |
---|
| 739 | ! AI sept 2013 |
---|
| 740 | SUBROUTINE histwrite3d_cosp(var, field, nverts, ncols) |
---|
| 741 | USE dimphy |
---|
| 742 | USE mod_phys_lmdz_para |
---|
| 743 | USE ioipsl |
---|
| 744 | use iophy |
---|
[2345] | 745 | USE mod_grid_phy_lmdz, ONLY: nbp_lon |
---|
[2311] | 746 | USE print_control_mod, ONLY: lunout,prt_level |
---|
[1926] | 747 | |
---|
| 748 | #ifdef CPP_XIOS |
---|
[2137] | 749 | USE xios, only: xios_send_field |
---|
[1926] | 750 | #endif |
---|
| 751 | |
---|
| 752 | |
---|
| 753 | IMPLICIT NONE |
---|
[2137] | 754 | INCLUDE 'clesphys.h' |
---|
[1926] | 755 | |
---|
| 756 | TYPE(ctrl_outcosp), INTENT(IN) :: var |
---|
| 757 | REAL, DIMENSION(:,:), INTENT(IN) :: field ! --> field(klon,:) |
---|
| 758 | INTEGER, INTENT(IN), OPTIONAL :: ncols ! ug RUSTINE POUR LES Champs 4D..... |
---|
| 759 | INTEGER, DIMENSION(3), INTENT(IN) :: nverts |
---|
| 760 | |
---|
| 761 | INTEGER :: iff, k |
---|
| 762 | |
---|
| 763 | REAL,DIMENSION(klon_mpi,SIZE(field,2)) :: buffer_omp |
---|
[2345] | 764 | REAL :: Field3d(nbp_lon,jj_nb,SIZE(field,2)) |
---|
[1926] | 765 | INTEGER :: ip, n, nlev |
---|
| 766 | INTEGER, ALLOCATABLE, DIMENSION(:) :: index3d |
---|
| 767 | CHARACTER(LEN=20) :: nomi, nom |
---|
| 768 | character(len=2) :: str2 |
---|
[2137] | 769 | LOGICAL, SAVE :: firstx |
---|
| 770 | !$OMP THREADPRIVATE(firstx) |
---|
[1926] | 771 | |
---|
| 772 | IF (prt_level >= 9) write(lunout,*)'Begin histrwrite3d ',var%name |
---|
| 773 | |
---|
| 774 | ! ug RUSTINE POUR LES STD LEVS..... |
---|
| 775 | IF (PRESENT(ncols)) THEN |
---|
| 776 | write(str2,'(i2.2)')ncols |
---|
| 777 | nomi=var%name |
---|
| 778 | nom="c"//str2//"_"//nomi |
---|
| 779 | ELSE |
---|
| 780 | nom=var%name |
---|
| 781 | END IF |
---|
| 782 | ! On regarde si on est dans la phase de définition ou d'écriture: |
---|
| 783 | IF(.NOT.cosp_varsdefined) THEN |
---|
| 784 | !Si phase de définition.... on définit |
---|
| 785 | !$OMP MASTER |
---|
| 786 | CALL conf_cospoutputs(var%name,var%cles) |
---|
| 787 | DO iff=1, 3 |
---|
| 788 | IF (cosp_outfilekeys(iff)) THEN |
---|
| 789 | CALL histdef3d_cosp(iff, var, nverts(iff), ncols) |
---|
| 790 | ENDIF |
---|
| 791 | ENDDO |
---|
| 792 | !$OMP END MASTER |
---|
| 793 | ELSE |
---|
| 794 | !Et sinon on.... écrit |
---|
| 795 | IF (SIZE(field,1)/=klon) & |
---|
[2311] | 796 | CALL abort_physic('iophy::histwrite3d','Field first DIMENSION not equal to klon',1) |
---|
[1926] | 797 | nlev=SIZE(field,2) |
---|
| 798 | |
---|
| 799 | |
---|
| 800 | CALL Gather_omp(field,buffer_omp) |
---|
| 801 | !$OMP MASTER |
---|
| 802 | CALL grid1Dto2D_mpi(buffer_omp,field3d) |
---|
| 803 | |
---|
| 804 | ! BOUCLE SUR LES FICHIERS |
---|
[2137] | 805 | firstx=.true. |
---|
[1926] | 806 | DO iff=1, 3 |
---|
| 807 | IF (var%cles(iff) .AND. cosp_outfilekeys(iff)) THEN |
---|
[2345] | 808 | ALLOCATE(index3d(nbp_lon*jj_nb*nlev)) |
---|
[2137] | 809 | #ifndef CPP_IOIPSL_NO_OUTPUT |
---|
[2345] | 810 | CALL histwrite(cosp_nidfiles(iff),nom,itau_iocosp,Field3d,nbp_lon*jj_nb*nlev,index3d) |
---|
[2137] | 811 | #endif |
---|
[1926] | 812 | |
---|
| 813 | #ifdef CPP_XIOS |
---|
[2137] | 814 | IF (.not. ok_all_xml) then |
---|
| 815 | IF (firstx) THEN |
---|
| 816 | CALL xios_send_field(nom, Field3d(:,:,1:nlev)) |
---|
| 817 | IF (prt_level >= 9) WRITE(lunout,*)'xios_send_field ',var%name |
---|
| 818 | firstx=.FALSE. |
---|
[1926] | 819 | ENDIF |
---|
[2137] | 820 | ENDIF |
---|
[1926] | 821 | #endif |
---|
| 822 | deallocate(index3d) |
---|
| 823 | ENDIF |
---|
| 824 | ENDDO |
---|
[2137] | 825 | #ifdef CPP_XIOS |
---|
| 826 | IF (ok_all_xml) THEN |
---|
| 827 | CALL xios_send_field(nom, Field3d(:,:,1:nlev)) |
---|
[2428] | 828 | IF (prt_level >= 1) WRITE(lunout,*)'xios_send_field ',var%name |
---|
[2137] | 829 | ENDIF |
---|
| 830 | #endif |
---|
| 831 | |
---|
[1926] | 832 | !$OMP END MASTER |
---|
| 833 | ENDIF ! vars_defined |
---|
| 834 | IF (prt_level >= 9) write(lunout,*)'End histrwrite3d_cosp ',nom |
---|
| 835 | END SUBROUTINE histwrite3d_cosp |
---|
| 836 | |
---|
[2822] | 837 | ! ug NOUVELLE VERSION DES WRITE AVEC LA BOUCLE DO RENTREE |
---|
| 838 | ! AI sept 2013 |
---|
| 839 | SUBROUTINE histwrite4d_cosp(var, field) |
---|
| 840 | USE dimphy |
---|
| 841 | USE mod_phys_lmdz_para |
---|
| 842 | USE ioipsl |
---|
| 843 | use iophy |
---|
| 844 | USE mod_grid_phy_lmdz, ONLY: nbp_lon |
---|
| 845 | USE print_control_mod, ONLY: lunout,prt_level |
---|
| 846 | |
---|
| 847 | #ifdef CPP_XIOS |
---|
| 848 | USE xios, only: xios_send_field |
---|
| 849 | #endif |
---|
| 850 | |
---|
| 851 | |
---|
| 852 | IMPLICIT NONE |
---|
| 853 | INCLUDE 'clesphys.h' |
---|
| 854 | |
---|
| 855 | TYPE(ctrl_outcosp), INTENT(IN) :: var |
---|
| 856 | REAL, DIMENSION(:,:,:), INTENT(IN) :: field ! --> field(klon,:) |
---|
| 857 | |
---|
| 858 | INTEGER :: iff, k |
---|
| 859 | |
---|
| 860 | REAL,DIMENSION(klon_mpi,SIZE(field,2),SIZE(field,3)) :: buffer_omp |
---|
| 861 | REAL :: field4d(nbp_lon,jj_nb,SIZE(field,2),SIZE(field,3)) |
---|
| 862 | INTEGER :: ip, n, nlev, nlev2 |
---|
| 863 | INTEGER, ALLOCATABLE, DIMENSION(:) :: index4d |
---|
| 864 | CHARACTER(LEN=20) :: nomi, nom |
---|
| 865 | |
---|
| 866 | IF (prt_level >= 9) write(lunout,*)'Begin histrwrite4d ',var%name |
---|
| 867 | |
---|
| 868 | IF(cosp_varsdefined) THEN |
---|
| 869 | !Et sinon on.... écrit |
---|
| 870 | IF (SIZE(field,1)/=klon) & |
---|
| 871 | CALL abort_physic('iophy::histwrite3d','Field first DIMENSION not equal to klon',1) |
---|
| 872 | |
---|
| 873 | nlev=SIZE(field,2) |
---|
| 874 | nlev2=SIZE(field,3) |
---|
| 875 | CALL Gather_omp(field,buffer_omp) |
---|
| 876 | !$OMP MASTER |
---|
| 877 | CALL grid1Dto2D_mpi(buffer_omp,field4d) |
---|
| 878 | |
---|
| 879 | #ifdef CPP_XIOS |
---|
| 880 | IF (ok_all_xml) THEN |
---|
| 881 | CALL xios_send_field(var%name, Field4d(:,:,1:nlev,1:nlev2)) |
---|
| 882 | IF (prt_level >= 1) WRITE(lunout,*)'xios_send_field ',var%name |
---|
| 883 | ENDIF |
---|
| 884 | #endif |
---|
| 885 | |
---|
| 886 | !$OMP END MASTER |
---|
| 887 | ENDIF ! vars_defined |
---|
| 888 | IF (prt_level >= 9) write(lunout,*)'End histrwrite4d_cosp ',nom |
---|
| 889 | END SUBROUTINE histwrite4d_cosp |
---|
| 890 | |
---|
[1926] | 891 | SUBROUTINE conf_cospoutputs(nam_var,cles_var) |
---|
| 892 | !!! Lecture des noms et cles de sortie des variables dans config.def |
---|
| 893 | ! en utilisant les routines getin de IOIPSL |
---|
| 894 | use ioipsl |
---|
[2311] | 895 | USE print_control_mod, ONLY: lunout,prt_level |
---|
[1926] | 896 | |
---|
| 897 | IMPLICIT NONE |
---|
| 898 | |
---|
| 899 | CHARACTER(LEN=20) :: nam_var, nnam_var |
---|
| 900 | LOGICAL, DIMENSION(3) :: cles_var |
---|
| 901 | |
---|
| 902 | ! Lecture dans config.def ou output.def de cles_var et name_var |
---|
| 903 | CALL getin('cles_'//nam_var,cles_var) |
---|
| 904 | CALL getin('name_'//nam_var,nam_var) |
---|
| 905 | IF(prt_level>10) WRITE(lunout,*)'nam_var cles_var ',nam_var,cles_var(:) |
---|
| 906 | |
---|
| 907 | END SUBROUTINE conf_cospoutputs |
---|
| 908 | |
---|
| 909 | END MODULE cosp_output_write_mod |
---|