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