anchor.diff:    REAL(KIND=r4),    DIMENSION(:,:,:,:),   ALLOCATABLE :: lut_I0_cld, lut_I1_cld, lut_I2_cld, lut_Ir_cld
     REAL(KIND=r4),    DIMENSION(:,:,:,:,:), ALLOCATABLE :: lut_dI0_clr, lut_dI1_clr, lut_dI2_clr, &
          lut_dI0_cld, lut_dI1_cld, lut_dI2_cld
  +  ! To read the data:
  +  INTEGER(HSIZE_T), DIMENSION(1) :: alb_dim, alb_maxdim, &
  +       clp_dim, clp_maxdim, &
  +       sza_dim, sza_maxdim, &
  +       toz_dim, toz_maxdim, &
  +       vza_dim, vza_maxdim, &
  +       wav_dim, wav_maxdim, &
  +       alt_lev_dim, alt_lev_maxdim, &
  +       alt_lay_dim, alt_lay_maxdim, &
  +       Sb_clr_dim, Sb_clr_maxdim
  +  INTEGER(HSIZE_T), DIMENSION(2) :: Sb_cld_dim, Sb_cld_maxdim, &
  +       air_dim, air_maxdim, tem_dim, tem_maxdim
  +  INTEGER(HSIZE_T), DIMENSION(3) :: I0_clr_dim,  I0_clr_maxdim
  +  INTEGER(HSIZE_T), DIMENSION(4) :: I0_cld_dim,  I0_cld_maxdim
  +  INTEGER(HSIZE_T), DIMENSION(5) :: dI0_clr_dim,  dI0_clr_maxdim, &
  +       dI0_cld_dim, dI0_cld_maxdim
   
     ! ---------
     ! PCF stuff
  
positive.code: 
      SELECT CASE ( adlow )
      CASE ('a')
         ALLOCATE (vl_OzC0(anwav), STAT=estat ) ; errstat = MAX ( errstat, estat )
         ALLOCATE (vl_OzC1(anwav), STAT=estat ) ; errstat = MAX ( errstat, estat )
         ALLOCATE (vl_OzC2(anwav), STAT=estat ) ; errstat = MAX ( errstat, estat )
  
         ALLOCATE (vl_pre(ancld), STAT=estat )  ; errstat = MAX ( errstat, estat )
         ALLOCATE (vl_sza(ansza), STAT=estat )  ; errstat = MAX ( errstat, estat )
         ALLOCATE (vl_vza(anvza), STAT=estat )  ; errstat = MAX ( errstat, estat )
         ALLOCATE (vl_wav(anwav), STAT=estat )  ; errstat = MAX ( errstat, estat )
         ALLOCATE (vl_toms(anozo), STAT=estat ) ; errstat = MAX ( errstat, estat )
  
         ALLOCATE (vl_air(anozo,ancld,analt), STAT=estat ) ; errstat = MAX ( errstat, estat )
         ALLOCATE (vl_alt(anozo,ancld,analt), STAT=estat ) ; errstat = MAX ( errstat, estat )
         ALLOCATE (vl_ozo(anozo,ancld,analt), STAT=estat ) ; errstat = MAX ( errstat, estat )
         ALLOCATE (vl_tem(anozo,ancld,analt), STAT=estat ) ; errstat = MAX ( errstat, estat )
  
         ALLOCATE (vl_I0(anozo,ancld,ansza,anvza,anwav), STAT=estat ) ; errstat = MAX ( errstat, estat )
         ALLOCATE (vl_I1(anozo,ancld,ansza,anvza,anwav), STAT=estat ) ; errstat = MAX ( errstat, estat )
         ALLOCATE (vl_I2(anozo,ancld,ansza,anvza,anwav), STAT=estat ) ; errstat = MAX ( errstat, estat )
         ALLOCATE (vl_Ir(anozo,ancld,ansza,anvza,anwav), STAT=estat ) ; errstat = MAX ( errstat, estat )
         ALLOCATE (vl_Sb(anozo,ancld,anwav), STAT=estat )             ; errstat = MAX ( errstat, estat )
  
         ALLOCATE (vl_dI0(anozo,ancld,ansza,anvza,anwav,analt), STAT=estat ) ; errstat = MAX ( errstat, estat )
         ALLOCATE (vl_dI1(anozo,ancld,ansza,anvza,anwav,analt), STAT=estat ) ; errstat = MAX ( errstat, estat )
         ALLOCATE (vl_dI2(anozo,ancld,ansza,anvza,anwav,analt), STAT=estat ) ; errstat = MAX ( errstat, estat )
         ALLOCATE (vl_dIr(anozo,ancld,ansza,anvza,anwav,analt), STAT=estat ) ; errstat = MAX ( errstat, estat )
  
      CASE ('d')
  
         IF ( ALLOCATED ( vl_OzC0 ) )  DEALLOCATE ( vl_OzC0 )
         IF ( ALLOCATED ( vl_OzC1 ) )  DEALLOCATE ( vl_OzC1 )
         IF ( ALLOCATED ( vl_OzC2 ) )  DEALLOCATE ( vl_OzC2 )
  
         IF ( ALLOCATED ( vl_pre  ) )  DEALLOCATE ( vl_pre  )
         IF ( ALLOCATED ( vl_sza  ) )  DEALLOCATE ( vl_sza  )
         IF ( ALLOCATED ( vl_vza  ) )  DEALLOCATE ( vl_vza  )
         IF ( ALLOCATED ( vl_wav  ) )  DEALLOCATE ( vl_wav  )
         IF ( ALLOCATED ( vl_toms ) )  DEALLOCATE ( vl_toms )
  
         IF ( ALLOCATED ( vl_air ) )  DEALLOCATE ( vl_air )
         IF ( ALLOCATED ( vl_alt ) )  DEALLOCATE ( vl_alt )
         IF ( ALLOCATED ( vl_ozo ) )  DEALLOCATE ( vl_ozo )
         IF ( ALLOCATED ( vl_tem ) )  DEALLOCATE ( vl_tem )
  
         IF ( ALLOCATED ( vl_I0 ) )  DEALLOCATE ( vl_I0 )
         IF ( ALLOCATED ( vl_I1 ) )  DEALLOCATE ( vl_I1 )
         IF ( ALLOCATED ( vl_I2 ) )  DEALLOCATE ( vl_I2 )
         IF ( ALLOCATED ( vl_Ir ) )  DEALLOCATE ( vl_Ir )
         IF ( ALLOCATED ( vl_Sb ) )  DEALLOCATE ( vl_Sb )
  
         IF ( ALLOCATED ( vl_dI0 ) )  DEALLOCATE ( vl_dI0 )
         IF ( ALLOCATED ( vl_dI1 ) )  DEALLOCATE ( vl_dI1 )
         IF ( ALLOCATED ( vl_dI2 ) )  DEALLOCATE ( vl_dI2 )
         IF ( ALLOCATED ( vl_dIr ) )  DEALLOCATE ( vl_dIr )
  
      CASE DEFAULT
         ! Whatever. Nothing to be done here
  
negative.code:        ! ----------------------------
         ! Deallocate Vlidort variables
         ! ----------------------------
         CALL vlidort_allocate ("d", INT(toz_dim(1)),INT(clp_dim(1)),INT(alb_dim(1)), &
              INT(sza_dim(1)),INT(vza_dim(1)),INT(wav_dim(1)), &
              INT(alt_lay_dim(1)),INT(alt_lev_dim(1)),errstat)
  
         ! -----------------------------------------------------------------
         ! Work out the AMF using the scattering weights and the climatology
  