Ignore:
Timestamp:
Mar 30, 2017, 4:16:38 PM (8 years ago)
Author:
Laurent Fairhead
Message:

Merged trunk changes r2785:2838 into testing branch

Location:
LMDZ5/branches/testing
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • LMDZ5/branches/testing

  • LMDZ5/branches/testing/libf/phylmd/cosp/cosp_output_mod.F90

    r2720 r2839  
    2020      INTEGER, DIMENSION(3), SAVE  :: nhoricosp,nvert,nvertmcosp,nvertcol,nvertbze, &
    2121                                      nvertsratio,nvertisccp,nvertp,nverttemp,nvertmisr, &
    22                                       nvertReffIce,nvertReffLiq
     22                                      nvertReffIce,nvertReffLiq,nverttau
    2323      REAL, DIMENSION(3), SAVE                :: zoutm_cosp
    2424!$OMP THREADPRIVATE(nhoricosp, nvert,nvertmcosp,nvertcol,nvertsratio,nvertbze,nvertisccp,nvertp,zoutm_cosp,nverttemp,nvertmisr)
    25 !$OMP THREADPRIVATE(nvertReffIce,nvertReffLiq)
     25!$OMP THREADPRIVATE(nvertReffIce,nvertReffLiq,nverttau)
    2626      REAL, SAVE                   :: zdtimemoy_cosp
    2727!$OMP THREADPRIVATE(zdtimemoy_cosp)
     
    207207  SUBROUTINE cosp_output_open(Nlevlmdz, Ncolumns, presnivs, dtime, freq_cosp, &
    208208                              ok_mensuelCOSP, ok_journeCOSP, ok_hfCOSP, ok_all_xml,  &
    209                               ecrit_mth, ecrit_day, ecrit_hf, use_vgrid, vgrid)
    210 
     209                              ecrit_mth, ecrit_day, ecrit_hf, use_vgrid, vgrid, stlidar)
    211210
    212211  USE iophy
     
    229228  logical                  :: ok_mensuelCOSP, ok_journeCOSP, ok_hfCOSP, use_vgrid, ok_all_xml                   
    230229  type(cosp_vgrid)   :: vgrid   ! Information on vertical grid of stats
     230  type(cosp_lidarstats) :: stlidar ! Summary statistics from lidar simulator
    231231
    232232!!! Variables locales
     
    236236  real,dimension(2,SR_BINS) :: sratio_bounds
    237237  real,dimension(SR_BINS)   ::  sratio_ax
     238  real,dimension(DBZE_BINS) ::  dbze_ax
    238239  CHARACTER(LEN=20), DIMENSION(3)  :: chfreq = (/ '1day', '1d  ', '3h  ' /)           
    239240
     
    257258    enddo
    258259
    259 !    do ii=1,DBZE_BINS
    260 !     dbze_ax(i) = CFAD_ZE_MIN + CFAD_ZE_WIDTH*(ii - 0.5)
    261 !    enddo
    262 
    263 !   sratio_bounds(2,:)=stlidar%srbval(:) ! srbval contains the upper
     260    do i=1,DBZE_BINS
     261     dbze_ax(i) = CFAD_ZE_MIN + CFAD_ZE_WIDTH*(i - 0.5)
     262    enddo
     263 
     264
     265    sratio_bounds(2,:)=stlidar%srbval(:) ! srbval contains the upper
    264266!                                         limits from lmd_ipsl_stats.f90
    265 !   sratio_bounds(1,2:SR_BINS) = stlidar%srbval(1:SR_BINS-1)
    266 !   sratio_bounds(1,1)         = 0.0
    267 !   sratio_bounds(2,SR_BINS)   = 1.e5 ! This matches with Chepfer et al., JGR,
     267    sratio_bounds(1,2:SR_BINS) = stlidar%srbval(1:SR_BINS-1)
     268    sratio_bounds(1,1)         = 0.0
     269    sratio_bounds(2,SR_BINS)   = 1.e5 ! This matches with Chepfer et al., JGR,
    268270!                                    ! 2009. However, it is not consistent
    269271                                     ! with the upper limit in
    270272                                     ! lmd_ipsl_stats.f90, which is
    271273                                     ! LIDAR_UNDEF-1=998.999
    272 !    sratio_ax(:) = (sratio_bounds(1,:)+sratio_bounds(2,:))/2.0
     274     sratio_ax(:) = (sratio_bounds(1,:)+sratio_bounds(2,:))/2.0
    273275
    274276    cosp_outfilenames(1) = 'histmthCOSP'
     
    331333   CALL wxios_add_vaxis("temp", LIDAR_NTEMP, LIDAR_PHASE_TEMP)
    332334   CALL wxios_add_vaxis("cth16", MISR_N_CTH, MISR_CTH)
    333 !   CALL wxios_add_vaxis("dbze", DBZE_BINS, dbze_ax)
    334 !   CALL wxios_add_vaxis("scatratio", SR_BINS, sratio_ax)
     335   CALL wxios_add_vaxis("dbze", DBZE_BINS, dbze_ax)
     336   CALL wxios_add_vaxis("scatratio", SR_BINS, sratio_ax)
    335337   CALL wxios_add_vaxis("ReffIce", numMODISReffIceBins, reffICE_binCenters)
    336338   CALL wxios_add_vaxis("ReffLiq", numMODISReffLiqBins, reffLIQ_binCenters)
     339   print*,'reffICE_binCenters=',reffICE_binCenters
     340   CALL wxios_add_vaxis("tau", 7, ISCCP_TAU)
    337341
    338342#endif
     
    384388                    nvertReffLiq(iff))
    385389
    386 !      CALL histvert(cosp_nidfiles(iff),"dbze","equivalent_reflectivity_factor","dBZ",DBZE_BINS,dbze_ax,nvertbze(iff))
     390      CALL histvert(cosp_nidfiles(iff),"dbze","equivalent_reflectivity_factor","dBZ",DBZE_BINS,dbze_ax,nvertbze(iff))
    387391     
    388 !      CALL histvert(cosp_nidfiles(iff),"scatratio","backscattering_ratio","1",SR_BINS,sratio_ax,nvertsratio(iff))
     392      CALL histvert(cosp_nidfiles(iff),"scatratio","backscattering_ratio","1",SR_BINS,sratio_ax,nvertsratio(iff))
     393
     394      CALL histvert(cosp_nidfiles(iff),"tau","cloud optical depth","1",7,ISCCP_TAU,nverttau(iff))
    389395     
    390396!!! Valeur indefinie en cas IOIPSL
  • LMDZ5/branches/testing/libf/phylmd/cosp/cosp_output_write_mod.F90

    r2787 r2839  
    1717   CONTAINS
    1818
    19   SUBROUTINE cosp_output_write(Nlevlmdz, Npoints, Ncolumns, itap, dtime, freq_COSP, &
     19  SUBROUTINE cosp_output_write(Nlevlmdz, Npoints, Ncolumns, itap, dtime, freq_COSP, missing_cosp, &
    2020                               cfg, gbx, vgrid, sglidar, sgradar, stlidar, stradar, &
    2121                               isccp, misr, modis)
     
    3232!!! Variables d'entree
    3333  integer               :: itap, Nlevlmdz, Ncolumns, Npoints
    34   real                  :: freq_COSP, dtime
     34  real                  :: freq_COSP, dtime, missing_val, missing_cosp
    3535  type(cosp_config)     :: cfg     ! Control outputs
    3636  type(cosp_gridbox)    :: gbx     ! Gridbox information. Input for COSP
     
    4949  integer               :: itau_wcosp
    5050  real, dimension(Npoints,PARASOL_NREFL) :: parasolcrefl, Ncref
     51
     52
     53#ifdef CPP_XIOS
     54  missing_val=missing_cosp
     55#else
     56  missing_val=0.
     57#endif
    5158
    5259  Nlevout = vgrid%Nlvgrid
     
    95102     do ip = 1,Npoints
    96103     if(stlidar%lidarcld(ip,k).eq.R_UNDEF)then
    97       stlidar%lidarcld(ip,k)=Cosp_fill_value
     104      stlidar%lidarcld(ip,k)=missing_val
    98105     endif
    99106     enddo
     
    102109      do ip = 1,Npoints
    103110       if(stlidar%cfad_sr(ip,ii,k).eq.R_UNDEF)then
    104         stlidar%cfad_sr(ip,ii,k)=Cosp_fill_value
     111        stlidar%cfad_sr(ip,ii,k)=missing_val
    105112       endif
    106113      enddo
     
    111118   do k = 1,Nlevlmdz
    112119     if(sglidar%beta_mol(ip,k).eq.R_UNDEF)then
    113       sglidar%beta_mol(ip,k)=Cosp_fill_value
     120      sglidar%beta_mol(ip,k)=missing_val
    114121     endif
    115122
    116123     do ii= 1,Ncolumns
    117124       if(sglidar%beta_tot(ip,ii,k).eq.R_UNDEF)then
    118         sglidar%beta_tot(ip,ii,k)=Cosp_fill_value
     125        sglidar%beta_tot(ip,ii,k)=missing_val
    119126       endif
    120127     enddo
     
    126133    do ip = 1,Npoints
    127134     if(stlidar%cldlayer(ip,k).eq.R_UNDEF)then
    128       stlidar%cldlayer(ip,k)=Cosp_fill_value
     135       stlidar%cldlayer(ip,k)=missing_val
    129136     endif
    130137    enddo
     
    133140! AI 11 / 2015
    134141
    135    where(stlidar%parasolrefl == R_UNDEF) stlidar%parasolrefl = 0.0
    136    where(stlidar%lidarcldtmp == R_UNDEF) stlidar%lidarcldtmp = 0.0
    137    where(stlidar%cldlayerphase == R_UNDEF) stlidar%cldlayerphase = 0.0
    138    where(stlidar%lidarcldphase == R_UNDEF) stlidar%lidarcldphase = 0.0
    139    where(stlidar%lidarcldtmp == R_UNDEF) stlidar%lidarcldtmp = 0.0
     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
    140147   
    141148
     
    169176   CALL histwrite3d_cosp(o_clcalipsotmpun,stlidar%lidarcldtmp(:,:,4),nverttemp)
    170177
     178#ifdef CPP_XIOS
     179   CALL histwrite4d_cosp(o_cfad_lidarsr532,stlidar%cfad_sr)
     180#else
    171181   do icl=1,SR_BINS
    172182      CALL histwrite3d_cosp(o_cfad_lidarsr532,stlidar%cfad_sr(:,icl,:),nvert,icl)
    173183   enddo
    174 
    175    CALL histwrite3d_cosp(o_parasol_refl,stlidar%parasolrefl,nvertp)
     184     CALL histwrite3d_cosp(o_parasol_refl,stlidar%parasolrefl,nvertp)
     185#endif
    176186
    177187   do k=1,PARASOL_NREFL
     
    182192        Ncref(ip,k) = 1.
    183193     else
    184         parasolcrefl(ip,k)=0.
     194        parasolcrefl(ip,k)=missing_val
    185195        Ncref(ip,k) = 0.
    186196     endif
     
    190200   CALL histwrite3d_cosp(o_parasol_crefl,parasolcrefl,nvertp)
    191201
     202#ifdef CPP_XIOS
     203   CALL histwrite4d_cosp(o_atb532,sglidar%beta_tot)
     204#else
    192205   do icl=1,Ncolumns
    193206      CALL histwrite3d_cosp(o_atb532,sglidar%beta_tot(:,icl,:),nvertmcosp,icl)
    194207   enddo
     208#endif
     209
    195210   CALL histwrite3d_cosp(o_beta_mol532,sglidar%beta_mol,nvertmcosp)
    196211 endif !Lidar
    197212
    198213 if (cfg%Lradar_sim) then
     214
     215#ifdef CPP_XIOS
     216   CALL histwrite4d_cosp(o_dbze94,sgradar%Ze_tot)
     217   CALL histwrite4d_cosp(o_cfadDbze94,stradar%cfad_ze)
     218#else
    199219   do icl=1,Ncolumns
    200220      CALL histwrite3d_cosp(o_dbze94,sgradar%Ze_tot(:,icl,:),nvertmcosp,icl)
     
    203223    CALL histwrite3d_cosp(o_cfadDbze94,stradar%cfad_ze(:,icl,:),nvert,icl)
    204224   enddo
     225#endif
    205226 endif
    206227
    207228 if (cfg%Llidar_sim .and. cfg%Lradar_sim) then
    208229   where(stradar%lidar_only_freq_cloud == R_UNDEF) &
    209                            stradar%lidar_only_freq_cloud = 0.0
     230                           stradar%lidar_only_freq_cloud = missing_val
    210231   CALL histwrite3d_cosp(o_clcalipso2,stradar%lidar_only_freq_cloud,nvert)
    211232   where(stradar%radar_lidar_tcc == R_UNDEF) &
    212                            stradar%radar_lidar_tcc = 0.0
     233                           stradar%radar_lidar_tcc = missing_val
    213234   CALL histwrite2d_cosp(o_cltlidarradar,stradar%radar_lidar_tcc)
    214235 endif
     
    219240   do ip = 1,Npoints
    220241    if(isccp%totalcldarea(ip).eq.R_UNDEF)then
    221       isccp%totalcldarea(ip)=Cosp_fill_value
     242      isccp%totalcldarea(ip)=missing_val
    222243    endif
    223244    if(isccp%meanptop(ip).eq.R_UNDEF)then
    224       isccp%meanptop(ip)=Cosp_fill_value
     245      isccp%meanptop(ip)=missing_val
    225246    endif
    226247    if(isccp%meantaucld(ip).eq.R_UNDEF)then
    227       isccp%meantaucld(ip)=Cosp_fill_value
     248      isccp%meantaucld(ip)=missing_val
    228249    endif
    229250    if(isccp%meanalbedocld(ip).eq.R_UNDEF)then
    230       isccp%meanalbedocld(ip)=Cosp_fill_value
     251     isccp%meanalbedocld(ip)=missing_val
    231252    endif
    232253    if(isccp%meantb(ip).eq.R_UNDEF)then
    233       isccp%meantb(ip)=Cosp_fill_value
     254     isccp%meantb(ip)=missing_val
    234255    endif
    235256    if(isccp%meantbclr(ip).eq.R_UNDEF)then
    236       isccp%meantbclr(ip)=Cosp_fill_value
     257       isccp%meantbclr(ip)=missing_val
    237258    endif
    238259
     
    240261     do ii=1,7
    241262     if(isccp%fq_isccp(ip,ii,k).eq.R_UNDEF)then
    242       isccp%fq_isccp(ip,ii,k)=Cosp_fill_value
     263      isccp%fq_isccp(ip,ii,k)=missing_val
    243264     endif
    244265     enddo
     
    247268    do ii=1,Ncolumns
    248269     if(isccp%boxtau(ip,ii).eq.R_UNDEF)then
    249        isccp%boxtau(ip,ii)=Cosp_fill_value
     270       isccp%boxtau(ip,ii)=missing_val
    250271     endif
    251272    enddo
     
    253274    do ii=1,Ncolumns
    254275     if(isccp%boxptop(ip,ii).eq.R_UNDEF)then
    255        isccp%boxptop(ip,ii)=Cosp_fill_value
     276      isccp%boxptop(ip,ii)=missing_val
    256277     endif
    257278    enddo
     
    259280
    260281   CALL histwrite2d_cosp(o_sunlit,gbx%sunlit)
     282#ifdef CPP_XIOS
     283   CALL histwrite4d_cosp(o_clisccp2,isccp%fq_isccp)
     284#else
    261285   do icl=1,7
    262286   CALL histwrite3d_cosp(o_clisccp2,isccp%fq_isccp(:,icl,:),nvertisccp,icl)
    263287   enddo
     288#endif
    264289   CALL histwrite3d_cosp(o_boxtauisccp,isccp%boxtau,nvertcol)
    265290   CALL histwrite3d_cosp(o_boxptopisccp,isccp%boxptop,nvertcol)
     
    278303       do k=1,MISR_N_CTH
    279304        if(misr%fq_MISR(ip,ii,k).eq.R_UNDEF)then
    280               misr%fq_MISR(ip,ii,k)=Cosp_fill_value
     305            misr%fq_MISR(ip,ii,k)=missing_val
    281306        endif
    282307       enddo
     
    284309   enddo
    285310
     311#ifdef CPP_XIOS
     312   CALL histwrite4d_cosp(o_clMISR,misr%fq_MISR)
     313#else
    286314   do icl=1,7
    287315      CALL histwrite3d_cosp(o_clMISR,misr%fq_MISR(:,icl,:),nvertmisr,icl)
    288316   enddo
     317#endif
    289318 endif
    290319
     
    294323  do ip=1,Npoints
    295324    if(modis%Cloud_Fraction_Low_Mean(ip).eq.R_UNDEF)then
    296        modis%Cloud_Fraction_Low_Mean(ip)=Cosp_fill_value
     325      modis%Cloud_Fraction_Low_Mean(ip)=missing_val
    297326    endif
    298327    if(modis%Cloud_Fraction_High_Mean(ip).eq.R_UNDEF)then
    299        modis%Cloud_Fraction_High_Mean(ip)=Cosp_fill_value
     328       modis%Cloud_Fraction_High_Mean(ip)=missing_val
    300329    endif
    301330    if(modis%Cloud_Fraction_Mid_Mean(ip).eq.R_UNDEF)then
    302        modis%Cloud_Fraction_Mid_Mean(ip)=Cosp_fill_value
     331       modis%Cloud_Fraction_Mid_Mean(ip)=missing_val
    303332    endif
    304333    if(modis%Cloud_Fraction_Total_Mean(ip).eq.R_UNDEF)then
    305        modis%Cloud_Fraction_Total_Mean(ip)=Cosp_fill_value
     334       modis%Cloud_Fraction_Total_Mean(ip)=missing_val
    306335    endif
    307336    if(modis%Cloud_Fraction_Water_Mean(ip).eq.R_UNDEF)then
    308        modis%Cloud_Fraction_Water_Mean(ip)=Cosp_fill_value
     337       modis%Cloud_Fraction_Water_Mean(ip)=missing_val
    309338    endif
    310339    if(modis%Cloud_Fraction_Ice_Mean(ip).eq.R_UNDEF)then
    311        modis%Cloud_Fraction_Ice_Mean(ip)=Cosp_fill_value
     340       modis%Cloud_Fraction_Ice_Mean(ip)=missing_val
    312341    endif
    313342    if(modis%Optical_Thickness_Total_Mean(ip).eq.R_UNDEF)then
    314        modis%Optical_Thickness_Total_Mean(ip)=Cosp_fill_value
     343       modis%Optical_Thickness_Total_Mean(ip)=missing_val
    315344    endif
    316345    if(modis%Optical_Thickness_Water_Mean(ip).eq.R_UNDEF)then
    317        modis%Optical_Thickness_Water_Mean(ip)=Cosp_fill_value
     346       modis%Optical_Thickness_Water_Mean(ip)=missing_val
    318347    endif
    319348    if(modis%Optical_Thickness_Ice_Mean(ip).eq.R_UNDEF)then
    320        modis%Optical_Thickness_Ice_Mean(ip)=Cosp_fill_value
     349       modis%Optical_Thickness_Ice_Mean(ip)=missing_val
    321350    endif
    322351    if(modis%Cloud_Particle_Size_Water_Mean(ip).eq.R_UNDEF)then
    323        modis%Cloud_Particle_Size_Water_Mean(ip)=Cosp_fill_value
     352       modis%Cloud_Particle_Size_Water_Mean(ip)=missing_val
    324353    endif
    325354    if(modis%Cloud_Particle_Size_Ice_Mean(ip).eq.R_UNDEF)then
    326        modis%Cloud_Particle_Size_Ice_Mean(ip)=Cosp_fill_value
     355       modis%Cloud_Particle_Size_Ice_Mean(ip)=missing_val
    327356    endif
    328357    if(modis%Cloud_Top_Pressure_Total_Mean(ip).eq.R_UNDEF)then
    329        modis%Cloud_Top_Pressure_Total_Mean(ip)=Cosp_fill_value
     358       modis%Cloud_Top_Pressure_Total_Mean(ip)=missing_val
    330359    endif
    331360    if(modis%Liquid_Water_Path_Mean(ip).eq.R_UNDEF)then
    332        modis%Liquid_Water_Path_Mean(ip)=Cosp_fill_value
     361       modis%Liquid_Water_Path_Mean(ip)=missing_val
    333362    endif
    334363    if(modis%Ice_Water_Path_Mean(ip).eq.R_UNDEF)then
    335        modis%Ice_Water_Path_Mean(ip)=Cosp_fill_value
     364       modis%Ice_Water_Path_Mean(ip)=missing_val
    336365    endif
    337366
    338367  enddo
     368
     369    where(modis%Optical_Thickness_Total_LogMean == R_UNDEF) &
     370          modis%Optical_Thickness_Total_LogMean = missing_val
     371           
     372 
     373    where(modis%Optical_Thickness_Water_LogMean == R_UNDEF) &
     374          modis%Optical_Thickness_Water_LogMean = missing_val
     375
     376    where(modis%Optical_Thickness_Ice_LogMean == R_UNDEF) &
     377          modis%Optical_Thickness_Ice_LogMean = missing_val
    339378   
    340379   CALL histwrite2d_cosp(o_cllmodis,modis%Cloud_Fraction_Low_Mean)
     
    360399       do k=1,7
    361400       if(modis%Optical_Thickness_vs_Cloud_Top_Pressure(ip,ii,k).eq.R_UNDEF)then
    362           modis%Optical_Thickness_vs_Cloud_Top_Pressure(ip,ii,k)=0.
     401          modis%Optical_Thickness_vs_Cloud_Top_Pressure(ip,ii,k)=missing_val
    363402        endif
    364403       enddo
     
    366405    enddo
    367406
     407#ifdef CPP_XIOS
     408   CALL histwrite4d_cosp(o_clmodis,modis%Optical_Thickness_vs_Cloud_Top_Pressure)
     409#else
    368410   do icl=1,7
    369411   CALL histwrite3d_cosp(o_clmodis, &
    370412     modis%Optical_Thickness_vs_Cloud_Top_Pressure(:,icl,:),nvertisccp,icl)           
    371413   enddo
     414#endif
    372415
    373416    where(modis%Optical_Thickness_vs_ReffIce == R_UNDEF) &
    374           modis%Optical_Thickness_vs_ReffIce = Cosp_fill_value
     417          modis%Optical_Thickness_vs_ReffIce = missing_val
    375418
    376419    where(modis%Optical_Thickness_vs_ReffLiq == R_UNDEF) &
    377           modis%Optical_Thickness_vs_ReffLiq = Cosp_fill_value
    378 
     420          modis%Optical_Thickness_vs_ReffLiq = missing_val
     421
     422#ifdef CPP_XIOS
     423!    print*,'dimension de crimodis=',size(modis%Optical_Thickness_vs_ReffIce,2),&
     424!                                    size(modis%Optical_Thickness_vs_ReffIce,3)
     425    CALL histwrite4d_cosp(o_crimodis,modis%Optical_Thickness_vs_ReffIce)
     426    CALL histwrite4d_cosp(o_crlmodis,modis%Optical_Thickness_vs_ReffLiq)
     427#else
    379428    do icl=1,7
    380429   CALL histwrite3d_cosp(o_crimodis, &
     
    383432     modis%Optical_Thickness_vs_ReffLiq(:,icl,:),nvertReffLiq,icl)
    384433    enddo
     434#endif
    385435 endif
    386436
     
    784834  END SUBROUTINE histwrite3d_cosp
    785835
     836! ug NOUVELLE VERSION DES WRITE AVEC LA BOUCLE DO RENTREE
     837! AI sept 2013
     838  SUBROUTINE histwrite4d_cosp(var, field)
     839  USE dimphy
     840  USE mod_phys_lmdz_para
     841  USE ioipsl
     842  use iophy
     843  USE mod_grid_phy_lmdz, ONLY: nbp_lon
     844  USE print_control_mod, ONLY: lunout,prt_level
     845
     846#ifdef CPP_XIOS
     847  USE xios, only: xios_send_field
     848#endif
     849
     850
     851  IMPLICIT NONE
     852  INCLUDE 'clesphys.h'
     853
     854    TYPE(ctrl_outcosp), INTENT(IN)    :: var
     855    REAL, DIMENSION(:,:,:), INTENT(IN)  :: field ! --> field(klon,:)
     856
     857    INTEGER :: iff, k
     858
     859    REAL,DIMENSION(klon_mpi,SIZE(field,2),SIZE(field,3)) :: buffer_omp
     860    REAL :: field4d(nbp_lon,jj_nb,SIZE(field,2),SIZE(field,3))
     861    INTEGER :: ip, n, nlev, nlev2
     862    INTEGER, ALLOCATABLE, DIMENSION(:) :: index4d
     863    CHARACTER(LEN=20) ::  nomi, nom
     864
     865  IF (prt_level >= 9) write(lunout,*)'Begin histrwrite4d ',var%name
     866
     867  IF(cosp_varsdefined) THEN
     868    !Et sinon on.... écrit
     869    IF (SIZE(field,1)/=klon) &
     870   CALL abort_physic('iophy::histwrite3d','Field first DIMENSION not equal to klon',1)           
     871
     872    nlev=SIZE(field,2)
     873    nlev2=SIZE(field,3)
     874    CALL Gather_omp(field,buffer_omp)
     875!$OMP MASTER
     876    CALL grid1Dto2D_mpi(buffer_omp,field4d)
     877
     878#ifdef CPP_XIOS
     879    IF (ok_all_xml) THEN
     880     CALL xios_send_field(var%name, Field4d(:,:,1:nlev,1:nlev2))
     881     IF (prt_level >= 1) WRITE(lunout,*)'xios_send_field ',var%name
     882    ENDIF
     883#endif
     884
     885!$OMP END MASTER   
     886  ENDIF ! vars_defined
     887  IF (prt_level >= 9) write(lunout,*)'End histrwrite4d_cosp ',nom
     888  END SUBROUTINE histwrite4d_cosp
     889
    786890  SUBROUTINE conf_cospoutputs(nam_var,cles_var)
    787891!!! Lecture des noms et cles de sortie des variables dans config.def
  • LMDZ5/branches/testing/libf/phylmd/cosp/modis_simulator.F90

    r2720 r2839  
    532532
    533533    ! ########################################################################################
    534     ! Normalize pixel counts to fraction. The first three cloud fractions have been set to -1
    535     ! in cloud-free areas, so set those places to 0.
    536     ! ########################################################################################
    537     Cloud_Fraction_High_Mean(1:nPoints)  = Cloud_Fraction_High_Mean(1:nPoints) /nSubcols
    538     Cloud_Fraction_Mid_Mean(1:nPoints)   = Cloud_Fraction_Mid_Mean(1:nPoints)  /nSubcols
    539     Cloud_Fraction_Low_Mean(1:nPoints)   = Cloud_Fraction_Low_Mean(1:nPoints)  /nSubcols
    540 
     534    ! Normalize pixel counts to fraction.
     535    ! ########################################################################################
     536    Cloud_Fraction_High_Mean(1:nPoints)  = Cloud_Fraction_High_Mean(1:nPoints)  /nSubcols
     537    Cloud_Fraction_Mid_Mean(1:nPoints)   = Cloud_Fraction_Mid_Mean(1:nPoints)   /nSubcols
     538    Cloud_Fraction_Low_Mean(1:nPoints)   = Cloud_Fraction_Low_Mean(1:nPoints)   /nSubcols
     539    Cloud_Fraction_Total_Mean(1:nPoints) = Cloud_Fraction_Total_Mean(1:nPoints) /nSubcols
     540    Cloud_Fraction_Ice_Mean(1:nPoints)   = Cloud_Fraction_Ice_Mean(1:nPoints)   /nSubcols
     541    Cloud_Fraction_Water_Mean(1:nPoints) = Cloud_Fraction_Water_Mean(1:nPoints) /nSubcols
     542   
    541543    ! ########################################################################################
    542544    ! Set clear-scenes to undefined
  • LMDZ5/branches/testing/libf/phylmd/cosp/phys_cosp.F90

    r2594 r2839  
    77  subroutine phys_cosp( itap,dtime,freq_cosp, &
    88                        ok_mensuelCOSP,ok_journeCOSP,ok_hfCOSP, &
    9                         ecrit_mth,ecrit_day,ecrit_hf, ok_all_xml, &
     9                        ecrit_mth,ecrit_day,ecrit_hf, ok_all_xml, missing_val, &
    1010                        Nptslmdz,Nlevlmdz,lon,lat, presnivs,overlaplmdz,sunlit, &
    1111                        ref_liq,ref_ice,fracTerLic,u_wind,v_wind,phis,phi,ph,p,skt,t, &
     
    130130! Declaration necessaires pour les sorties IOIPSL
    131131  integer :: ii
    132   real    :: ecrit_day,ecrit_hf,ecrit_mth
     132  real    :: ecrit_day,ecrit_hf,ecrit_mth, missing_val
    133133  logical :: ok_mensuelCOSP,ok_journeCOSP,ok_hfCOSP, ok_all_xml
    134134
     
    192192! Allocate memory for gridbox type
    193193!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    194         print *, 'Allocating memory for gridbox type...'
     194! AI mars 2017
     195!        print *, 'Allocating memory for gridbox type...'
     196
    195197!! AI
    196198!        call construct_cosp_gridbox(dble(itap),radar_freq,surface_radar,use_mie_tables,use_gas_abs,do_ray,melt_lay,k2, &
     
    215217!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    216218
    217         print *, 'Populating input structure...'
     219!        print *, 'Populating input structure...'
    218220        gbx%longitude = lon
    219221        gbx%latitude = lat
     
    299301        ! Define new vertical grid
    300302!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    301         print *, 'Defining new vertical grid...'
     303!        print *, 'Defining new vertical grid...'
    302304        call construct_cosp_vgrid(gbx,Nlr,use_vgrid,csat_vgrid,vgrid)
    303305
     
    305307       ! Allocate memory for other types
    306308!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    307         print *, 'Allocating memory for other types...'
     309!        print *, 'Allocating memory for other types...'
    308310        call construct_cosp_subgrid(Npoints, Ncolumns, Nlevels, sgx)
    309311        call construct_cosp_sgradar(cfg,Npoints,Ncolumns,Nlevels,N_HYDRO,sgradar)
     
    325327        call cosp_output_open(Nlevlmdz, Ncolumns, presnivs, dtime, freq_cosp, &
    326328                              ok_mensuelCOSP, ok_journeCOSP, ok_hfCOSP, ok_all_xml, &
    327                               ecrit_mth, ecrit_day, ecrit_hf, use_vgrid, vgrid)
     329                              ecrit_mth, ecrit_day, ecrit_hf, use_vgrid, vgrid, stlidar)
    328330      !$OMP END MASTER
    329331      !$OMP BARRIER
     
    333335        ! Call simulator
    334336!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    335         print *, 'Calling simulator...'
     337!        print *, 'Calling simulator...'
    336338!! AI
    337339!        call cosp(overlap,Ncolumns,cfg,vgrid,gbx,sgx,sgradar,sglidar,isccp,misr,stradar,stlidar)
     
    347349!!!!!!!!!!!!!!!!!! Ecreture des sorties Cosp !!!!!!!!!!!!!!r!!!!!!:!!!!!
    348350
    349        print *, 'Calling write output'
    350         call cosp_output_write(Nlevlmdz, Npoints, Ncolumns, itap, dtime, freq_COSP, &
     351!       print *, 'Calling write output'
     352        call cosp_output_write(Nlevlmdz, Npoints, Ncolumns, itap, dtime, freq_COSP, missing_val, &
    351353                               cfg, gbx, vgrid, sglidar, sgradar, stlidar, stradar, &
    352354                               isccp, misr, modis)
     
    355357        ! Deallocate memory in derived types
    356358!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    357         print *, 'Deallocating memory...'
     359!        print *, 'Deallocating memory...'
    358360        call free_cosp_gridbox(gbx)
    359361        call free_cosp_subgrid(sgx)
Note: See TracChangeset for help on using the changeset viewer.