PROGRAM sla2fb USE obs_fbm USE obs_sla_io USE convmerge IMPLICIT NONE ! ! Command line arguments for output file and input files ! #ifndef NOIARGCPROTO INTEGER,EXTERNAL :: iargc #endif INTEGER :: nargs CHARACTER(len=256) :: cdoutfile CHARACTER(len=256),ALLOCATABLE :: cdinfile(:) ! ! Input data ! TYPE(obfbdata), POINTER :: slaf(:) INTEGER :: ninfiles,ntotobs ! ! Output data ! TYPE(obfbdata) :: fbdata ! ! Loop variables ! INTEGER :: ip,ia,ji,jk ! ! Get number of command line arguments ! nargs=IARGC() IF (nargs < 1) THEN WRITE(*,'(A)')'Usage:' WRITE(*,'(A)')'sla2fb outputfile inputfile1 inputfile2 ...' CALL abort() ENDIF CALL getarg(1,cdoutfile) ! ! Get input data ! ALLOCATE( slaf(MAX(nargs-1,1)) ) ALLOCATE( cdinfile(nargs-1) ) ntotobs = 0 ninfiles = nargs - 1 DO ia=1,ninfiles CALL getarg( ia + 1, cdinfile(ia) ) WRITE(*,'(2A)')'File = ',TRIM(cdinfile(ia)) CALL read_avisofile( TRIM(cdinfile(ia)), slaf(ia), 6, .TRUE., .FALSE. ) WRITE(*,'(A,I9,A)')'has',slaf(ia)%nobs,' observations' ntotobs = ntotobs + slaf(ia)%nobs ENDDO IF (ninfiles==0) THEN CALL init_obfbdata( slaf(1) ) CALL alloc_obfbdata( slaf(1), 1, 0, 1, 0, 0, .FALSE. ) slaf(1)%cname(1) = 'SLA' slaf(1)%cdjuldref = '19500101000000' ENDIF WRITE(*,'(A,I8)') 'Total observations : ',ntotobs ! ! Merge and output the data. ! CALL conv_fbmerge( TRIM(cdoutfile), ninfiles, slaf ) END PROGRAM sla2fb