anchor.diff:                             linInterpol(INT(alb_dim(1),KIND=i4), re_alb, &
                              sw_clear_5D(srf_dim(1)+1-isrf,ialt,1:alb_dim(1),vza_dim(1)+1-ivza,sza_dim(1)+1-isza), &
                              local_alb(1), status=status)
  -                      ! --------------------------------------
  -                      ! Cloud pressure loop only for cloud sky
  -                      ! --------------------------------------
  -                      DO icld = 1, clp_dim(1)
  -                         sw_cloud_5D(srf_dim(1)+1-isrf,ialt,clp_dim(1)+1-icld,vza_dim(1)+1-ivza,sza_dim(1)+1-isza) = &
  -                              REAL( lut_dI0_cld(toms_idx,isrf,ialt,icld,ivza,isza), KIND=r8 ) + &
  -                              REAL( lut_dI1_cld(toms_idx,isrf,ialt,icld,ivza,isza), KIND=r8 ) * cos( local_raa(1) ) + &
  -                              REAL( lut_dI2_cld(toms_idx,isrf,ialt,icld,ivza,isza), KIND=r8 ) * cos(2.0_r8 * local_raa(1) )
  -                      END DO
  -                      ! -----------------------------------
  -                      ! Interpolate to local cloud pressure
  -                      ! SW below cloud pressure are equal
  -                      ! to cero
  -                      ! -----------------------------------
  -                      sw_cloud_4D(srf_dim(1)+1-isrf,ialt,vza_dim(1)+1-ivza,sza_dim(1)+1-isza) = &
  -                           linInterpol(INT(clp_dim(1),KIND=i4), re_cld, &
  -                           sw_cloud_5D(srf_dim(1)+1-isrf,ialt,1:clp_dim(1),vza_dim(1)+1-ivza,sza_dim(1)+1-isza), &
  -                           local_cld(1), status=status)
  -                   END DO ! End suface pressure loop
  +                   END DO
  +                   ! --------------------------------------
  +                   ! Cloud sky
  +                   ! --------------------------------------
  +                   DO icld = 1, clp_dim(1)
  +                      sw_cloud_4D(ialt,clp_dim(1)+1-icld,vza_dim(1)+1-ivza,sza_dim(1)+1-isza) = &
  +                           REAL( lut_dI0_cld(toms_idx,ialt,icld,ivza,isza), KIND=r8 ) + &
  +                           REAL( lut_dI1_cld(toms_idx,ialt,icld,ivza,isza), KIND=r8 ) * cos( local_raa(1) ) + &
  +                           REAL( lut_dI2_cld(toms_idx,ialt,icld,ivza,isza), KIND=r8 ) * cos(2.0_r8 * local_raa(1) )
  +                   END DO
                      ! -------------------------------------
                      ! Interpolate to local surface pressure
                      ! If cloud pressure is greater than
                      ! surface pressure then cloud SW are to
                      ! be cero.
                      ! -------------------------------------
  -                   sw_clear_3D(ialt,vza_dim(1)+1-ivza,sza_dim(1)+1-isza) = &
  -                        linInterpol(INT(srf_dim(1),KIND=i4), re_srf, &
  -                        sw_clear_4D(1:srf_dim(1),ialt,vza_dim(1)+1-ivza,sza_dim(1)+1-isza), &
  -                        local_srf(1), status=status)
  -                   sw_cloud_3D(ialt,vza_dim(1)+1-ivza,sza_dim(1)+1-isza) = &
  -                        linInterpol(INT(srf_dim(1),KIND=i4), re_srf, &
  -                        sw_cloud_4D(1:srf_dim(1),ialt,vza_dim(1)+1-ivza,sza_dim(1)+1-isza), &
  -                        local_srf(1), status=status)
  +                CALL ezspline_1d_interpolation (INT(srf_dim(1),KIND=i4), re_srf, &
  +                     sw_clear_4D(1:srf_dim(1),ialt,vza_dim(1)+1-ivza,sza_dim(1)+1-isza), &
  +                     one, local_srf(1), &
  +                     sw_clear_3D(ialt,vza_dim(1)+1-ivza,sza_dim(1)+1-isza), status)
  +                CALL ezspline_1d_interpolation (INT(clp_dim(1),KIND=i4), re_cld, &
  +                     sw_cloud_4D(ialt,1:clp_dim(1),vza_dim(1)+1-ivza,sza_dim(1)+1-isza), &
  +                     one, local_cld(1), &
  +                     sw_cloud_3D(ialt,vza_dim(1)+1-ivza,sza_dim(1)+1-isza), status)
                   END DO ! End VZA loop
                   ! ------------------------
                   ! Interpolate to local VZA
  
positive.code:     INTEGER (KIND=i4), DIMENSION(1) :: iwavs, iwavf
      REAL    (KIND=r8) :: grad, raa, tmp_saa, tmp_vaa
      REAL    (KIND=r8) :: crf, nwavs
      REAL    (KIND=r8), DIMENSION(srf_dim(1), vza_dim(1), sza_dim(1)) :: Inte_clear_3D
      REAL    (KIND=r8), DIMENSION(vza_dim(1), sza_dim(1))             :: Inte_clear_2D
      REAL    (KIND=r8), DIMENSION(sza_dim(1))                         :: Inte_clear_1D
      REAL    (KIND=r8), DIMENSION(1)                                  :: Radiance_clr
      REAL    (KIND=r8), DIMENSION(srf_dim(1), clp_dim(1), vza_dim(1), sza_dim(1)) :: Inte_cloud_4D
      REAL    (KIND=r8), DIMENSION(srf_dim(1), vza_dim(1), sza_dim(1))             :: Inte_cloud_3D
      REAL    (KIND=r8), DIMENSION(vza_dim(1), sza_dim(1))                         :: Inte_cloud_2D
      REAL    (KIND=r8), DIMENSION(sza_dim(1))                                     :: Inte_cloud_1D
      REAL    (KIND=r8), DIMENSION(1)                                              :: Radiance_cld
      REAL    (KIND=r8), DIMENSION(srf_dim(1),alt_lay_dim(2),alb_dim(1),vza_dim(1),sza_dim(1)) :: sw_clear_5D
      REAL    (KIND=r8), DIMENSION(srf_dim(1),alt_lay_dim(2),vza_dim(1),sza_dim(1))            :: sw_clear_4D
      REAL    (KIND=r8), DIMENSION(alt_lay_dim(2),vza_dim(1),sza_dim(1))                       :: sw_clear_3D
      REAL    (KIND=r8), DIMENSION(alt_lay_dim(2),sza_dim(1))                                  :: sw_clear_2D
      REAL    (KIND=r8), DIMENSION(alt_lay_dim(2))                                             :: sw_clear_1D
      REAL    (KIND=r8), DIMENSION(ngeos5-1)                                                   :: sw_clear
      REAL    (KIND=r8), DIMENSION(srf_dim(1),alt_lay_dim(2),clp_dim(1),vza_dim(1),sza_dim(1)) :: sw_cloud_5D
      REAL    (KIND=r8), DIMENSION(srf_dim(1),alt_lay_dim(2),vza_dim(1),sza_dim(1))            :: sw_cloud_4D
      REAL    (KIND=r8), DIMENSION(alt_lay_dim(2),vza_dim(1),sza_dim(1))                       :: sw_cloud_3D
      REAL    (KIND=r8), DIMENSION(alt_lay_dim(2),sza_dim(1))                                  :: sw_cloud_2D
      REAL    (KIND=r8), DIMENSION(alt_lay_dim(2))                                             :: sw_cloud_1D
      REAL    (KIND=r8), DIMENSION(ngeos5-1)                                                   :: sw_cloud
      REAL    (KIND=r8), DIMENSION(alt_lay_dim(2)) :: re_alt
      REAL    (KIND=r8), DIMENSION(srf_dim(1))     :: re_srf
      REAL    (KIND=r8), DIMENSION(alb_dim(1))     :: re_alb
  
negative.code:          alt_lev_dim, hdferr)
      CALL h5dread_f(pre_lay_did, H5T_NATIVE_REAL, lut_pre_lay(1:srf_dim(1),1:alt_lay_dim(2)), &
           alt_lay_dim, hdferr)
      CALL h5dread_f(pre_lev_cld_did, H5T_NATIVE_REAL, lut_pre_lev_cld(1:clp_dim(1),1:alt_lev_dim(2)), &
           alt_lev_cld_dim, hdferr)
      CALL h5dread_f(pre_lay_cld_did, H5T_NATIVE_REAL, lut_pre_lay_cld(1:clp_dim(1),1:alt_lay_dim(2)), &
           alt_lay_cld_dim, hdferr)
      CALL h5dread_f(ozo_did,     H5T_NATIVE_REAL, lut_ozo(1:toz_dim(1),1:srf_dim(1),1:alt_lay_dim(2)), &
           air_dim, hdferr)
      CALL h5dread_f(tem_did,     H5T_NATIVE_REAL, lut_tem(1:toz_dim(1),1:srf_dim(1),1:alt_lev_dim(2)), &
  