diff --git a/LIBTOOLS/tools/lfi2cdf/src/mode_options.f90 b/LIBTOOLS/tools/lfi2cdf/src/mode_options.f90 index af1a84ad8e035b6cedae35f8f0db771ddb3ad84f..4a03b4442a1403d94eb6583243a6c2648079ad8a 100644 --- a/LIBTOOLS/tools/lfi2cdf/src/mode_options.f90 +++ b/LIBTOOLS/tools/lfi2cdf/src/mode_options.f90 @@ -31,7 +31,7 @@ subroutine read_commandline(options,hinfile,houtfile,runmode) character(len=:),allocatable,intent(out) :: houtfile integer,intent(out) :: runmode - integer :: idx, ji, nbargs, status, sz + integer :: idx, nbargs, status, sz logical :: finished character(len=:),allocatable :: command, fullcommand @@ -80,30 +80,13 @@ subroutine read_commandline(options,hinfile,houtfile,runmode) call check_options(options,hinfile,runmode) + houtfile = options(OPTOUTPUT)%cvalue - !Remove level in the filename if merging LFI splitted files + !Remove level in the filename if merging LFI splitted files and output name not set by option if (.NOT.options(OPTOUTPUT)%set) then - if (options(OPTMERGE)%set .AND. .NOT.options(OPTSPLIT)%set) then - houtfile=houtfile(1:len(houtfile)-9)//houtfile(len(houtfile)-3:) + if (options(OPTMERGE)%set) then + houtfile=hinfile(1:len(hinfile)-9) end if - if (.NOT.options(OPTMERGE)%set .AND. options(OPTSPLIT)%set) then - if (options(OPTCDF4)%set) then - ji=4 - else - ji=3 - end if - houtfile=houtfile(1:len(houtfile)-ji) - end if - if (options(OPTMERGE)%set .AND. options(OPTSPLIT)%set) then - if (options(OPTCDF4)%set) then - ji=9 - else - ji=8 - end if - houtfile=houtfile(1:len(houtfile)-ji) - end if - else - houtfile = options(OPTOUTPUT)%cvalue end if end subroutine read_commandline diff --git a/LIBTOOLS/tools/lfi2cdf/src/mode_util.f90 b/LIBTOOLS/tools/lfi2cdf/src/mode_util.f90 index 63c87d058a0d3aaa9be705b922c973b03d861b30..af0423a5ab73377aad4e699bc1ed6144e36c9593 100644 --- a/LIBTOOLS/tools/lfi2cdf/src/mode_util.f90 +++ b/LIBTOOLS/tools/lfi2cdf/src/mode_util.f90 @@ -1268,7 +1268,7 @@ END DO outfiles%files(idx)%format = LFI_FORMAT outfiles%files(idx)%status = WRITING ilu = outfiles%files(idx)%lun_id - CALL LFIOUV(iresp,ilu,ltrue,houtfile,'NEW' ,lfalse,lfalse,iverb,inap,inaf) + CALL LFIOUV(iresp,ilu,ltrue,TRIM(houtfile)//'.lfi','NEW' ,lfalse,lfalse,iverb,inap,inaf) outfiles%files(idx)%opened = .TRUE. END IF