diff --git a/LIBTOOLS/tools/lfi2cdf/src/lfi2cdf.f90 b/LIBTOOLS/tools/lfi2cdf/src/lfi2cdf.f90
index cc67f8565f93815f7847fafcb1345e7191bc3545..b2ab840d0e763b19c45c4354b59f00f132cd6a8f 100644
--- a/LIBTOOLS/tools/lfi2cdf/src/lfi2cdf.f90
+++ b/LIBTOOLS/tools/lfi2cdf/src/lfi2cdf.f90
@@ -1,10 +1,14 @@
 program LFI2CDF
-  USE MODD_CONF,  ONLY: CPROGRAM
-  USE MODD_TIMEZ, ONLY: TIMEZ
-
-  USE MODE_FIELD,  ONLY: INI_FIELD_LIST
-  USE MODE_IO_ll,  ONLY: INITIO_ll, SET_CONFIO_ll
+  USE MODD_CONF,          ONLY: CPROGRAM
+  USE MODD_CONFZ,         ONLY: NB_PROCIO_R
+  USE MODD_DIM_n,         ONLY: NIMAX_ll, NJMAX_ll, NKMAX
+  USE MODD_PARAMETERS,    ONLY: JPHEXT, JPVEXT
+  USE MODD_TIMEZ,         ONLY: TIMEZ
+
+  USE MODE_IO_ll,         ONLY: INITIO_ll, SET_CONFIO_ll
+  USE MODE_FIELD,         ONLY: INI_FIELD_LIST
   USE mode_options
+  USE MODE_SPLITTINGZ_ll, ONLY: INI_PARAZ_ll
   USE mode_util
 
   USE MODN_CONFIO, ONLY: LCDF4, LLFIOUT, LLFIREAD
@@ -19,6 +23,7 @@ program LFI2CDF
   INTEGER :: nbvar_tbw  ! number of variables to be written
   INTEGER :: nbvar      ! number of defined variables
   INTEGER :: first_level, current_level, last_level, nb_levels
+  INTEGER :: IINFO_ll                   ! return code of // routines
   CHARACTER(LEN=:),allocatable :: hvarlist
   TYPE(filelist_struct) :: infiles, outfiles
   TYPE(workfield), DIMENSION(:), POINTER :: tzreclist
@@ -38,6 +43,12 @@ program LFI2CDF
 
   call read_commandline(options,hinfile,houtfile,runmode)
 
+  IF (options(OPTMERGE)%set) THEN
+    NB_PROCIO_R = options(OPTMERGE)%ivalue
+  ELSE
+    NB_PROCIO_R = 1
+  END IF
+
   IF (runmode == MODELFI2CDF) THEN
      LCDF4    = .TRUE.
      LLFIOUT  = .FALSE.
@@ -60,6 +71,18 @@ program LFI2CDF
   CALL OPEN_FILES(infiles, outfiles, hinfile, houtfile, nbvar_infile, options, runmode)
   IF (options(OPTLIST)%set) STOP
 
+  !Set and initialize parallel variables (necessary to read splitted files)
+  CALL SET_JP_ll(1,JPHEXT,JPVEXT,JPHEXT)
+  CALL SET_DAD0_ll()
+  CALL SET_DIM_ll(NIMAX_ll, NJMAX_ll, NKMAX)
+  CALL SET_XRATIO_ll(1, 1)
+  CALL SET_YRATIO_ll(1, 1)
+  CALL SET_XOR_ll(1, 1)
+  CALL SET_XEND_ll(NIMAX_ll+2*JPHEXT, 1)
+  CALL SET_YOR_ll(1, 1)
+  CALL SET_YEND_ll(NJMAX_ll+2*JPHEXT, 1)
+  CALL INI_PARAZ_ll(IINFO_ll)
+
   IF (runmode == MODELFI2CDF .OR. runmode == MODECDF2CDF) THEN
      IF (options(OPTVAR)%set) THEN
         ! nbvar_tbr is computed from number of requested variables
@@ -87,74 +110,17 @@ program LFI2CDF
 
   IF (runmode == MODELFI2CDF) THEN
      ! Conversion LFI -> NetCDF
-
-     !Standard treatment (one LFI file only)
-     IF (.not.options(OPTMERGE)%set) THEN
-       CALL parse_infiles(infiles,nbvar_infile,nbvar_tbr,nbvar_calc,nbvar_tbw,tzreclist,ibuflen,options)
-       IF (options(OPTSPLIT)%set) call open_split_ncfiles_out(outfiles,houtfile,nbvar,tzreclist,options)
-       CALL def_ncdf(outfiles,tzreclist,nbvar,options)
-       CALL fill_ncdf(infiles,outfiles,tzreclist,nbvar,ibuflen,options)
-
-     ELSE
-     !Treat several LFI files and merge into 1 NC file
-
-       !Determine first level (eg needed to find suffix of the variable name)
-       read( hinfile(len(hinfile)-2:len(hinfile)) , "(I3)" ) first_level
-       nb_levels = options(OPTMERGE)%ivalue
-       current_level = first_level
-       last_level    = first_level + nb_levels - 1
-
-       !Read 1st LFI file
-       CALL parse_infiles(infiles,nbvar_infile,nbvar_tbr,nbvar_calc,nbvar_tbw,tzreclist,ibuflen,options,current_level)
-       IF (options(OPTSPLIT)%set) call open_split_ncfiles_out(outfiles,houtfile,nbvar,tzreclist,options)
-       !Define NC variables
-       CALL def_ncdf(outfiles,tzreclist,nbvar,options)
-
-       DO current_level = first_level,last_level
-         print *,'Treating level ',current_level
-         IF (current_level/=first_level) THEN
-           CALL open_split_lfifile_in(infiles,hinfile,current_level)
-         END IF
-         CALL fill_ncdf(infiles,outfiles,tzreclist,nbvar,ibuflen,options,current_level)
-         IF (current_level/=last_level) CALL close_files(infiles)
-       END DO
-     END IF
+     CALL parse_infiles(infiles,nbvar_infile,nbvar_tbr,nbvar_calc,nbvar_tbw,tzreclist,ibuflen,options)
+     IF (options(OPTSPLIT)%set) call open_split_ncfiles_out(outfiles,houtfile,nbvar,tzreclist,options)
+     CALL def_ncdf(outfiles,tzreclist,nbvar,options)
+     CALL fill_ncdf(infiles,outfiles,tzreclist,nbvar,ibuflen,options)
 
   ELSE IF (runmode == MODECDF2CDF) THEN
      ! Conversion netCDF -> netCDF
-
-     !Standard treatment (one netCDF file only)
-     IF (.not.options(OPTMERGE)%set) THEN
-       CALL parse_infiles(infiles,nbvar_infile,nbvar_tbr,nbvar_calc,nbvar_tbw,tzreclist,ibuflen,options,current_level)
-       IF (options(OPTSPLIT)%set) call open_split_ncfiles_out(outfiles,houtfile,nbvar,tzreclist,options)
-       CALL def_ncdf(outfiles,tzreclist,nbvar,options)
-       CALL fill_ncdf(infiles,outfiles,tzreclist,nbvar,ibuflen,options)
-
-     ELSE
-     !Treat several NC files and merge into 1 NC file
-
-       !Determine first level (eg needed to find suffix of the variable name)
-       read( hinfile(len(hinfile)-2:len(hinfile)) , "(I3)" ) first_level
-       nb_levels = options(OPTMERGE)%ivalue
-       current_level = first_level
-       last_level    = first_level + nb_levels - 1
-
-       !Read 1st NC file
-       CALL parse_infiles(infiles,nbvar_infile,nbvar_tbr,nbvar_calc,nbvar_tbw,tzreclist,ibuflen,options,current_level)
-       IF (options(OPTSPLIT)%set) call open_split_ncfiles_out(outfiles,houtfile,nbvar,tzreclist,options)
-       !Define NC variables
-       CALL def_ncdf(outfiles,tzreclist,nbvar,options)
-
-       DO current_level = first_level,last_level
-         print *,'Treating level ',current_level
-         IF (current_level/=first_level) THEN
-           CALL open_split_ncfile_in(infiles,hinfile,current_level)
-           CALL update_varid_in(infiles,hinfile,tzreclist,nbvar,current_level)
-         END IF
-         CALL fill_ncdf(infiles,outfiles,tzreclist,nbvar,ibuflen,options,current_level)
-         IF (current_level/=last_level) CALL close_files(infiles)
-       END DO
-     END IF
+     CALL parse_infiles(infiles,nbvar_infile,nbvar_tbr,nbvar_calc,nbvar_tbw,tzreclist,ibuflen,options,current_level)
+     IF (options(OPTSPLIT)%set) call open_split_ncfiles_out(outfiles,houtfile,nbvar,tzreclist,options)
+     CALL def_ncdf(outfiles,tzreclist,nbvar,options)
+     CALL fill_ncdf(infiles,outfiles,tzreclist,nbvar,ibuflen,options)
 
   ELSE
      ! Conversion NetCDF -> LFI
diff --git a/LIBTOOLS/tools/lfi2cdf/src/mode_options.f90 b/LIBTOOLS/tools/lfi2cdf/src/mode_options.f90
index 56fc9afce37ee11100860cc3ee7a8b601e16a7e2..779810c9f4c6f642063244605a114d258e9672d9 100644
--- a/LIBTOOLS/tools/lfi2cdf/src/mode_options.f90
+++ b/LIBTOOLS/tools/lfi2cdf/src/mode_options.f90
@@ -80,18 +80,18 @@ subroutine read_commandline(options,hinfile,houtfile,runmode)
 
   call check_options(options,hinfile,runmode)
 
-  houtfile = options(OPTOUTPUT)%cvalue
-
   call remove_suffix(hinfile)
-  call remove_suffix(houtfile)
 
-  !Remove level in the filename if merging LFI splitted files and output name not set by option
+  !Determine outfile name if not given
   if (.NOT.options(OPTOUTPUT)%set) then
-    if (options(OPTMERGE)%set) then
-      houtfile=hinfile(1:len(hinfile)-5)
-    end if
+    idx = index(hinfile,'/',back=.true.)
+    options(OPTOUTPUT)%cvalue = hinfile(idx+1:len_trim(hinfile))//'_merged'
   end if
 
+  houtfile = options(OPTOUTPUT)%cvalue
+
+  call remove_suffix(houtfile)
+
 end subroutine read_commandline
 
 subroutine init_options(options)
@@ -254,13 +254,6 @@ subroutine check_options(options,infile,runmode)
       print *,"Warning: split option is forced to disable"
   end if
 
-  !Determine outfile name if not given
-  if (.NOT.options(OPTOUTPUT)%set) then
-    idx1 = index(infile,'/',back=.true.)
-    idx2 = index(infile,'.',back=.true.)
-    options(OPTOUTPUT)%cvalue = infile(idx1+1:idx2-1)
-  end if
-
 end subroutine check_options
 
 
@@ -296,7 +289,7 @@ subroutine help()
   print *,"                [-m --merge number_of_z_levels] [-s --split] [-o --output output-file.nc]"
   print *,"                [-c --compress compression_level] input-file.lfi"
   print *,"        cdf2cdf [-h --help] [-v --var var1[,...]] [-r --reduce-precision]"
-  print *,"                [-m --merge number_of_z_levels] [-s --split] [-o --output output-file.nc]"
+  print *,"                [-m --merge number_of_split_files] [-s --split] [-o --output output-file.nc]"
   print *,"                [-c --compress compression_level] input-file.nc"
   print *,"        cdf2lfi [-o --output output-file.lfi] input-file.nc"
   print *,""
@@ -308,8 +301,8 @@ subroutine help()
   print *,"     Print this text"
   print *,"  --list, -l"
   print *,"     List all the fields of the LFI file and returns (lfi2cdf only)"
-  print *,"  --merge, -m number_of_z_levels"
-  print *,"     Merge LFI files which are split by vertical level (cdf2cdf and lfi2cdf only)"
+  print *,"  --merge, -m number_of_split_files"
+  print *,"     Merge files which are split by vertical level (cdf2cdf and lfi2cdf only)"
   print *,"  --output, -o"
   print *,"     Name of file for the output"
   print *,"  --reduce-precision, -r"
diff --git a/LIBTOOLS/tools/lfi2cdf/src/mode_util.f90 b/LIBTOOLS/tools/lfi2cdf/src/mode_util.f90
index 49b9fd935620c1d2cb1948f8858bcf27b4889679..ab26c4a123458de457138cfcc2afb71854c922e7 100644
--- a/LIBTOOLS/tools/lfi2cdf/src/mode_util.f90
+++ b/LIBTOOLS/tools/lfi2cdf/src/mode_util.f90
@@ -1,7 +1,6 @@
 MODULE mode_util
   USE MODD_IO_ll,  ONLY: TFILE_ELT
   USE MODD_NETCDF, ONLY: DIMCDF, IDCDF_KIND
-  USE MODD_PARAM
 
   USE mode_dimlist
   USE MODE_FIELD
@@ -45,6 +44,7 @@ MODULE mode_util
      LOGICAL                               :: calc   ! T if computed from other variables
      LOGICAL                               :: tbw    ! to be written or not
      LOGICAL                               :: tbr    ! to be read or not
+     LOGICAL                               :: LSPLIT = .FALSE. ! TRUE if variable is split by vertical level
      INTEGER                               :: NSRC = 0 ! Number of variables used to compute the variable (needed only if calc=.true.)
      INTEGER,DIMENSION(MAXRAW)             :: src    ! List of variables used to compute the variable (needed only if calc=.true.)
      INTEGER                               :: tgt    ! Target: id of the variable that use it (calc variable)
@@ -74,8 +74,8 @@ CONTAINS
   END FUNCTION str_replace
 
   SUBROUTINE parse_infiles(infiles, nbvar_infile, nbvar_tbr, nbvar_calc, nbvar_tbw, tpreclist, kbuflen, options, icurrent_level)
-    USE MODD_DIM_n,         ONLY: NIMAX_ll, NJMAX_ll, NKMAX
-    USE MODD_PARAMETERS_ll, ONLY: JPHEXT, JPVEXT
+    USE MODD_DIM_n,      ONLY: NIMAX_ll, NJMAX_ll, NKMAX
+    USE MODD_PARAMETERS, ONLY: JPHEXT, JPVEXT
 
     TYPE(filelist_struct),      INTENT(IN) :: infiles
     INTEGER,                    INTENT(IN) :: nbvar_infile, nbvar_tbr, nbvar_calc, nbvar_tbw
@@ -84,7 +84,7 @@ CONTAINS
     TYPE(option),DIMENSION(:), INTENT(IN)  :: options
     INTEGER,          INTENT(IN), OPTIONAL :: icurrent_level
 
-    INTEGER                                  :: ji,jj, kcdf_id, itype
+    INTEGER                                  :: ji,jj, kcdf_id, kcdf_id2, itype
     INTEGER                                  :: ndb, nde, ndey, idx, idx_var, maxvar
     INTEGER                                  :: idims, idimtmp, jdim, status, var_id
     LOGICAL                                  :: ladvan
@@ -213,12 +213,43 @@ CONTAINS
           IF (infiles%files(1)%format == LFI_FORMAT) THEN
             CALL LFINFO(iresp2,ilu,trim(yrecfm)//trim(suffix),ileng,ipos)
             IF (iresp2 == 0 .AND. ileng /= 0) tpreclist(ji)%found = .true.
+            IF (iresp2==0 .AND. ileng == 0 .AND. ipos==0 .AND. infiles%TFILES(1)%TFILE%NSUBFILES_IOZ>0) THEN
+              !Variable not found with no error (iresp2==0 .AND. ileng == 0 .AND. ipos==0)
+              !If we are merging, maybe it is one of the split variable
+              !In that case, the 1st part of the variable is in the 1st splitted file with a 0001 suffix
+              CALL LFINFO(iresp2,infiles%TFILES(1)%TFILE%TFILES_IOZ(1)%TFILE%NLFIFLU,trim(yrecfm)//'0001',ileng,ipos)
+              IF (iresp2 == 0 .AND. ileng /= 0) THEN
+                tpreclist(ji)%found  = .true.
+                tpreclist(ji)%LSPLIT = .true.
+                IF (tpreclist(ji)%tgt > 0) THEN !If this variable is used for a calculated one
+                  tpreclist(tpreclist(ji)%tgt)%LSPLIT = .true.
+                END IF
+              END IF
+              ileng = ileng * IDIMZ !Real size is slightly overestimated due to comment size
+            END IF
+
             leng = ileng
           ELSE IF (infiles%files(1)%format == NETCDF_FORMAT) THEN
             status = NF90_INQ_VARID(kcdf_id,trim(yrecfm)//trim(suffix),tpreclist(ji)%id_in)
+            IF (status /= NF90_NOERR .AND. infiles%TFILES(1)%TFILE%NSUBFILES_IOZ>0) THEN
+              !Variable probably not found (other error possible...)
+              !If we are merging, maybe it is one of the split variable
+              !In that case, the 1st part of the variable is in the 1st splitted file with a 0001 suffix
+              kcdf_id2 = infiles%TFILES(1)%TFILE%TFILES_IOZ(1)%TFILE%NNCID
+              status = NF90_INQ_VARID(kcdf_id2,trim(yrecfm)//'0001',tpreclist(ji)%id_in)
+              IF (status == NF90_NOERR) THEN
+                tpreclist(ji)%LSPLIT = .true.
+                IF (tpreclist(ji)%tgt > 0) THEN !If this variable is used for a calculated one
+                  tpreclist(tpreclist(ji)%tgt)%LSPLIT = .true.
+                END IF
+              END IF
+            ELSE
+              kcdf_id2 = kcdf_id
+            ENDIF
+            !
             IF (status == NF90_NOERR) THEN
               tpreclist(ji)%found = .true.
-              status = NF90_INQUIRE_VARIABLE(kcdf_id,tpreclist(ji)%id_in,ndims = idims,dimids = idim_id)
+              status = NF90_INQUIRE_VARIABLE(kcdf_id2,tpreclist(ji)%id_in,ndims = idims,dimids = idim_id)
               IF (status /= NF90_NOERR) CALL HANDLE_ERR(status,__LINE__)
 
 !TODO:useful?
@@ -230,10 +261,15 @@ CONTAINS
                  ! infos sur dimensions
                  leng = 1
                  DO jdim=1,idims
-                   status = NF90_INQUIRE_DIMENSION(kcdf_id,idim_id(jdim),len = idimtmp)
+                   status = NF90_INQUIRE_DIMENSION(kcdf_id2,idim_id(jdim),len = idimtmp)
                    IF (status /= NF90_NOERR) CALL HANDLE_ERR(status,__LINE__)
                    leng = leng*idimtmp
                 END DO
+                IF (tpreclist(ji)%LSPLIT) THEN
+                  IF(idims/=2) CALL PRINT_MSG(NVERB_FATAL,'IO','parse_infiles','split variables can only be 3D')
+                  !Split variables are Z-splitted
+                  leng = leng * IDIMZ
+                END IF
               END IF
             END IF
             !Add maximum comment size (necessary when writing LFI files because the comment is stored with the field)
@@ -501,48 +537,7 @@ END DO
     kbuflen = sizemax
 
     WRITE(*,'("Taille maximale du buffer :",f10.3," Mio")') sizemax*8./1048576.
-    ALLOCATE(iwork(sizemax))
-
-    ! Phase 2 : Extract comments and dimensions for valid articles.
-    !           Infos are put in tpreclist.
-    CALL init_dimCDF()
-    DO ji=1,maxvar
-       IF (tpreclist(ji)%calc .OR. .NOT.tpreclist(ji)%found) CYCLE
-
-       IF (infiles%files(1)%format == LFI_FORMAT) THEN
-         yrecfm = trim(tpreclist(ji)%name)//trim(suffix)
-
-         !(temporary) workaround for DATE fields
-         IF (tpreclist(ji)%TFIELD%NTYPE == TYPEDATE) YRECFM = TRIM(YRECFM)//'%TDATE'
-
-         CALL LFINFO(iresp2,ilu,yrecfm,ileng,ipos)
-         CALL LFILEC(iresp2,ilu,yrecfm,iwork,ileng)
-         comment_size = iwork(2)
-         fsize = ileng-(2+comment_size)
-
-       ELSE IF (infiles%files(1)%format == NETCDF_FORMAT) THEN
-!DUPLICATED
-         IF (idims == 0) THEN
-           ! variable scalaire
-           leng = 1
-         ELSE
-           ! infos sur dimensions
-           leng = 1
-           DO jdim=1,idims
-             status = NF90_INQUIRE_DIMENSION(kcdf_id,idim_id(jdim),len = idimtmp)
-             IF (status /= NF90_NOERR) CALL HANDLE_ERR(status,__LINE__)
-             leng = leng*idimtmp
-           END DO
-         END IF
-
-         fsize = leng
-       END IF
 
-       tpreclist(ji)%dim=>get_dimCDF(fsize)
-    END DO
-
-    PRINT *,'Nombre de dimensions = ', size_dimCDF()
-    DEALLOCATE(iwork)
   END SUBROUTINE parse_infiles
   
   SUBROUTINE HANDLE_ERR(status,line)
@@ -714,7 +709,7 @@ INTEGER(KIND=IDCDF_KIND),DIMENSION(NF90_MAX_VAR_DIMS) :: IDIMLEN
          CASE (3)
            CALL IO_WRITE_FIELD(outfiles%tfiles(idx)%TFILE,tpreclist(ji)%TFIELD,reshape(itab,tpreclist(ji)%TDIMS(1:3)%LEN))
          CASE DEFAULT
-           print *,'Error: arrays with ',tpreclist(ji)%dim%ndims,' dimensions are not supported'
+           print *,'Error: arrays with ',ndims,' dimensions are not supported'
          END SELECT
 
         ELSE IF (infiles%files(1)%format == NETCDF_FORMAT) THEN
@@ -743,7 +738,7 @@ print *,'PW:TODO'
          CASE (3)
 print *,'PW:TODO'
          CASE DEFAULT
-           print *,'Error: arrays with ',tpreclist(ji)%dim%ndims,' dimensions are not supported'
+           print *,'Error: arrays with ',ndims,' dimensions are not supported'
          END SELECT
 
 #if 0
@@ -836,7 +831,7 @@ print *,'PW:TODO'
          CASE (1)
            status = NF90_PUT_VAR(kcdf_id,tpreclist(ji)%id_out,itab(1:extent),count=(/extent/))
          CASE DEFAULT
-           print *,'Error: arrays with ',tpreclist(ji)%dim%ndims,' dimensions are not supported'
+           print *,'Error: arrays with ',ndims,' dimensions are not supported'
          END SELECT
 
         ELSE IF (infiles%files(1)%format == NETCDF_FORMAT) THEN
@@ -865,7 +860,7 @@ print *,'PW:TODO'
          CASE (3)
 print *,'PW:TODO'
          CASE DEFAULT
-           print *,'Error: arrays with ',tpreclist(ji)%dim%ndims,' dimensions are not supported'
+           print *,'Error: arrays with ',ndims,' dimensions are not supported'
          END SELECT
 #if 0
          ALLOCATE( itab3d(idims(1),idims(2),idims(3)) )
@@ -900,42 +895,85 @@ print *,'PW:TODO'
        CASE (TYPEREAL)
         IF (infiles%files(1)%format == LFI_FORMAT) THEN
          IF (.NOT.tpreclist(ji)%calc) THEN
-           CALL LFINFO(iresp,ilu,trim(tpreclist(ji)%name)//trim(suffix),ileng,ipos)
-           CALL LFILEC(iresp,ilu,trim(tpreclist(ji)%name)//trim(suffix),iwork,ileng)
-           extent = ileng - 2 - iwork(2) !iwork(2) = comment length
-           ! Determine TDIMS
-           CALL IO_GUESS_DIMIDS_NC4(outfiles%tfiles(idx)%TFILE,tpreclist(ji)%TFIELD,extent,tpreclist(ji)%TDIMS,IRESP2)
-           IF (IRESP2/=0) THEN
-             CALL PRINT_MSG(NVERB_WARNING,'IO','fill_ncdf','can not guess dimensions for '//tpreclist(ji)%TFIELD%CMNHNAME// &
-                            ' => ignored')
-             CYCLE
+           IF (.NOT.tpreclist(ji)%LSPLIT) THEN
+             CALL LFINFO(iresp,ilu,trim(tpreclist(ji)%name)//trim(suffix),ileng,ipos)
+             CALL LFILEC(iresp,ilu,trim(tpreclist(ji)%name)//trim(suffix),iwork,ileng)
+             extent = ileng - 2 - iwork(2) !iwork(2) = comment length
+             ! Determine TDIMS
+             CALL IO_GUESS_DIMIDS_NC4(outfiles%tfiles(idx)%TFILE,tpreclist(ji)%TFIELD,extent,tpreclist(ji)%TDIMS,IRESP2)
+             IF (IRESP2/=0) THEN
+               CALL PRINT_MSG(NVERB_WARNING,'IO','fill_ncdf','can not guess dimensions for '//tpreclist(ji)%TFIELD%CMNHNAME// &
+                              ' => ignored')
+               CYCLE
+             END IF
+             xtab(1:extent) = TRANSFER(iwork(3+iwork(2):),(/ 0.0_8 /))
+           ELSE
+             !We assume that splitted variables are always of size(IDIMX,IDMIY,IDIMZ)
+             ALLOCATE(xtab3d(IDIMX,IDIMY,IDIMZ))
+             CALL IO_READ_FIELD(infiles%tfiles(1)%TFILE,tpreclist(ji)%TFIELD,XTAB3D)
+             extent = IDIMX*IDIMY*IDIMZ
+             ! Determine TDIMS
+             CALL IO_GUESS_DIMIDS_NC4(outfiles%tfiles(idx)%TFILE,tpreclist(ji)%TFIELD,extent,tpreclist(ji)%TDIMS,IRESP2)
+             IF (IRESP2/=0) THEN
+               CALL PRINT_MSG(NVERB_WARNING,'IO','fill_ncdf','can not guess dimensions for '//tpreclist(ji)%TFIELD%CMNHNAME// &
+                              ' => ignored')
+               CYCLE
+             END IF
+             xtab(1:extent) = RESHAPE( xtab3d, (/extent/) )
+             DEALLOCATE(xtab3d)
            END IF
-           xtab(1:extent) = TRANSFER(iwork(3+iwork(2):),(/ 0.0_8 /))
          ELSE
            src=tpreclist(ji)%src(1)
-           CALL LFINFO(iresp,ilu,trim(tpreclist(src)%name)//trim(suffix),ileng,ipos)
-           CALL LFILEC(iresp,ilu,trim(tpreclist(src)%name)//trim(suffix),iwork,ileng)
-           extent = ileng - 2 - iwork(2) !iwork(2) = comment length
-           ! Determine TDIMS
-           CALL IO_GUESS_DIMIDS_NC4(outfiles%tfiles(idx)%TFILE,tpreclist(src)%TFIELD,extent,tpreclist(src)%TDIMS,IRESP2)
-           IF (IRESP2/=0) THEN
-             CALL PRINT_MSG(NVERB_WARNING,'IO','fill_ncdf','can not guess dimensions for '//tpreclist(src)%TFIELD%CMNHNAME// &
-                            ' => ignored')
-             CALL PRINT_MSG(NVERB_WARNING,'IO','fill_ncdf','can not guess dimensions for '//tpreclist(ji)%TFIELD%CMNHNAME// &
-                            ' => ignored')
-             CYCLE
-           ELSE
-             tpreclist(ji)%TDIMS = tpreclist(src)%TDIMS
-           END IF
-           xtab(1:extent) = TRANSFER(iwork(3+iwork(2):),(/ 0.0_8 /))
-           jj = 2
-           DO WHILE (tpreclist(ji)%src(jj)>0 .AND. jj.LE.MAXRAW)
-             src=tpreclist(ji)%src(jj)
+           IF (.NOT.tpreclist(ji)%LSPLIT) THEN
+             CALL LFINFO(iresp,ilu,trim(tpreclist(src)%name)//trim(suffix),ileng,ipos)
              CALL LFILEC(iresp,ilu,trim(tpreclist(src)%name)//trim(suffix),iwork,ileng)
+             extent = ileng - 2 - iwork(2) !iwork(2) = comment length
+             ! Determine TDIMS
+             CALL IO_GUESS_DIMIDS_NC4(outfiles%tfiles(idx)%TFILE,tpreclist(src)%TFIELD,extent,tpreclist(src)%TDIMS,IRESP2)
+             IF (IRESP2/=0) THEN
+               CALL PRINT_MSG(NVERB_WARNING,'IO','fill_ncdf','can not guess dimensions for '//tpreclist(src)%TFIELD%CMNHNAME// &
+                              ' => ignored')
+               CALL PRINT_MSG(NVERB_WARNING,'IO','fill_ncdf','can not guess dimensions for '//tpreclist(ji)%TFIELD%CMNHNAME// &
+                              ' => ignored')
+               CYCLE
+             ELSE
+               tpreclist(ji)%TDIMS = tpreclist(src)%TDIMS
+             END IF
+             xtab(1:extent) = TRANSFER(iwork(3+iwork(2):),(/ 0.0_8 /))
+             jj = 2
+             DO WHILE (tpreclist(ji)%src(jj)>0 .AND. jj.LE.MAXRAW)
+               src=tpreclist(ji)%src(jj)
+               CALL LFILEC(iresp,ilu,trim(tpreclist(src)%name)//trim(suffix),iwork,ileng)
 !PW: TODO: check same dimensions
-             xtab(1:extent) = xtab(1:extent) + TRANSFER(iwork(3+iwork(2):),(/ 0.0_8 /))
-             jj=jj+1
-           END DO
+               xtab(1:extent) = xtab(1:extent) + TRANSFER(iwork(3+iwork(2):),(/ 0.0_8 /))
+               jj=jj+1
+             END DO
+           ELSE !Split variable
+             !We assume that splitted variables are always of size(IDIMX,IDMIY,IDIMZ)
+             ALLOCATE(xtab3d(IDIMX,IDIMY,IDIMZ))
+             ALLOCATE(xtab3d2(IDIMX,IDIMY,IDIMZ))
+             CALL IO_READ_FIELD(infiles%tfiles(1)%TFILE,tpreclist(tpreclist(ji)%src(1))%TFIELD,XTAB3D)
+             extent = IDIMX*IDIMY*IDIMZ
+             ! Determine TDIMS
+             CALL IO_GUESS_DIMIDS_NC4(outfiles%tfiles(idx)%TFILE,tpreclist(ji)%TFIELD,extent,tpreclist(src)%TDIMS,IRESP2)
+             IF (IRESP2/=0) THEN
+               CALL PRINT_MSG(NVERB_WARNING,'IO','fill_ncdf','can not guess dimensions for '//tpreclist(src)%TFIELD%CMNHNAME// &
+                              ' => ignored')
+               CALL PRINT_MSG(NVERB_WARNING,'IO','fill_ncdf','can not guess dimensions for '//tpreclist(ji)%TFIELD%CMNHNAME// &
+                              ' => ignored')
+               CYCLE
+             ELSE
+               tpreclist(ji)%TDIMS = tpreclist(src)%TDIMS
+             END IF
+             jj = 2
+             DO WHILE (tpreclist(ji)%src(jj)>0 .AND. jj.LE.MAXRAW)
+               CALL IO_READ_FIELD(infiles%tfiles(1)%TFILE,tpreclist(tpreclist(ji)%src(jj))%TFIELD,XTAB3D2)
+               XTAB3D(:,:,:) = XTAB3D(:,:,:) + XTAB3D2(:,:,:)
+               jj=jj+1
+             END DO
+             xtab(1:extent) = RESHAPE( xtab3d, (/extent/) )
+             DEALLOCATE(xtab3d,xtab3d2)
+           END IF
          ENDIF
 !TODO: works in all cases??? (X, Y, Z dimensions assumed to be ptdimx,y or z)
          SELECT CASE(ndims)
@@ -950,23 +988,30 @@ print *,'PW:TODO'
          CASE (4)
            CALL IO_WRITE_FIELD(outfiles%tfiles(idx)%TFILE,tpreclist(ji)%TFIELD,reshape(xtab,tpreclist(ji)%TDIMS(1:4)%LEN))
          CASE DEFAULT
-           print *,'Error: arrays with ',tpreclist(ji)%dim%ndims,' dimensions are not supported'
+           print *,'Error: arrays with ',ndims,' dimensions are not supported'
          END SELECT
 
         ELSE IF (infiles%files(1)%format == NETCDF_FORMAT) THEN
-INCID = infiles%TFILES(1)%TFILE%NNCID
-STATUS = NF90_INQ_VARID(INCID,tpreclist(ji)%TFIELD%CMNHNAME,IVARID)
-IF (status /= NF90_NOERR) CALL HANDLE_ERR(status,__LINE__)
-STATUS = NF90_INQUIRE_VARIABLE(INCID, IVARID, NDIMS=IDIMS, DIMIDS=IVDIMS)
-IF (status /= NF90_NOERR) CALL HANDLE_ERR(status,__LINE__)
-if (ndims/=idims) then
-print *,'aieeeeeee'
-stop
-end if
-DO JJ=1,IDIMS
-  STATUS = NF90_INQUIRE_DIMENSION(infiles%TFILES(1)%TFILE%NNCID, IVDIMS(JJ), LEN=IDIMLEN(JJ))
+IF (.NOT.tpreclist(ji)%LSPLIT) THEN
+  INCID = infiles%TFILES(1)%TFILE%NNCID
+  STATUS = NF90_INQ_VARID(INCID,tpreclist(ji)%TFIELD%CMNHNAME,IVARID)
   IF (status /= NF90_NOERR) CALL HANDLE_ERR(status,__LINE__)
-END DO
+  STATUS = NF90_INQUIRE_VARIABLE(INCID, IVARID, NDIMS=IDIMS, DIMIDS=IVDIMS)
+  IF (status /= NF90_NOERR) CALL HANDLE_ERR(status,__LINE__)
+  if (ndims/=idims) then
+  print *,'aieeeeeee'
+  stop
+  end if
+  DO JJ=1,IDIMS
+    STATUS = NF90_INQUIRE_DIMENSION(infiles%TFILES(1)%TFILE%NNCID, IVDIMS(JJ), LEN=IDIMLEN(JJ))
+    IF (status /= NF90_NOERR) CALL HANDLE_ERR(status,__LINE__)
+  END DO
+ELSE
+  !Split variables are always 3D variables
+  IDIMLEN(1) = IDIMX
+  IDIMLEN(2) = IDIMY
+  IDIMLEN(3) = IDIMZ
+END IF
          SELECT CASE(ndims)
          CASE (0)
            CALL IO_READ_FIELD (infiles%tfiles(1)%TFILE,   tpreclist(ji)%TFIELD,xtab(1))
@@ -990,7 +1035,7 @@ END DO
            CALL IO_WRITE_FIELD(outfiles%tfiles(idx)%TFILE,tpreclist(ji)%TFIELD,XTAB4D)
            DEALLOCATE(XTAB4D)
          CASE DEFAULT
-           print *,'Error: arrays with ',tpreclist(ji)%dim%ndims,' dimensions are not supported'
+           print *,'Error: arrays with ',ndims,' dimensions are not supported'
          END SELECT
 
 #if 0
@@ -1130,6 +1175,7 @@ END DO
 
 stop
 
+iartlen=2+icomlen+1
 #if 0
        IF (ASSOCIATED(tpreclist(ivar)%dim)) THEN
           idlen = tpreclist(ivar)%dim%len
@@ -1245,7 +1291,8 @@ stop
     USE MODD_GRID,          ONLY: XBETA, XRPK, XLAT0, XLON0, XLATORI, XLONORI
     USE MODD_GRID_n,        ONLY: LSLEVE, XXHAT, XYHAT, XZHAT
     USE MODD_IO_ll,         ONLY: LIOCDF4
-    USE MODD_PARAMETERS_ll, ONLY: JPHEXT, JPVEXT
+    USE MODD_PARAMETERS,    ONLY: JPHEXT
+    USE MODD_PARAMETERS_ll, ONLY: JPHEXT_ll=>JPHEXT, JPVEXT_ll=>JPVEXT
 
     USE MODE_FM,               ONLY: IO_FILE_OPEN_ll, IO_FILE_CLOSE_ll
     USE MODE_IO_MANAGE_STRUCT, ONLY: IO_FILE_ADD2LIST
@@ -1311,9 +1358,10 @@ stop
    !
    !Read problem dimensions and some grid variables (needed by IO_FILE_OPEN_ll to create netCDF files but also to determine IDIMX/Y/Z)
    CALL IO_READ_FIELD(INFILES%TFILES(idx)%TFILE,'JPHEXT',JPHEXT)
+   JPHEXT_ll = JPHEXT
    !CALL IO_READ_FIELD(INFILES%TFILES(idx)%TFILE,'JPVEXT',JPVEXT,IRESP)
    !IF(IRESP/=0) JPVEXT=1
-   JPVEXT = 1
+   JPVEXT_ll = JPVEXT
    !
    ALLOCATE(NIMAX_ll,NJMAX_ll,NKMAX)
    CALL IO_READ_FIELD(INFILES%TFILES(idx)%TFILE,'IMAX',NIMAX_ll)
@@ -1499,6 +1547,8 @@ stop
   END SUBROUTINE OPEN_SPLIT_NCFILES_OUT
   
   SUBROUTINE CLOSE_FILES(filelist)
+    USE MODE_FM,    ONLY: IO_FILE_CLOSE_ll
+
     TYPE(filelist_struct),INTENT(INOUT) :: filelist
     
     INTEGER(KIND=LFI_INT) :: ilu,iresp
@@ -1507,13 +1557,7 @@ stop
     DO ji=1,filelist%nbfiles
       IF ( .NOT.filelist%files(ji)%opened ) CYCLE
 
-      IF ( filelist%files(ji)%format == LFI_FORMAT ) THEN
-        ilu = filelist%files(ji)%lun_id
-        CALL LFIFER(iresp,ilu,'KEEP')
-      ELSE IF ( filelist%files(ji)%format == NETCDF_FORMAT ) THEN
-        status = NF90_CLOSE(filelist%files(ji)%lun_id)
-        IF (status /= NF90_NOERR) CALL HANDLE_ERR(status,__LINE__)
-      END IF
+      CALL IO_FILE_CLOSE_ll(filelist%TFILES(ji)%TFILE)
       filelist%files(ji)%opened=.false.
     END DO