1 | PROGRAM sla2fb |
---|
2 | USE obs_fbm |
---|
3 | USE obs_sla_io |
---|
4 | USE convmerge |
---|
5 | IMPLICIT NONE |
---|
6 | ! |
---|
7 | ! Command line arguments for output file and input files |
---|
8 | ! |
---|
9 | #ifndef NOIARGCPROTO |
---|
10 | INTEGER,EXTERNAL :: iargc |
---|
11 | #endif |
---|
12 | INTEGER :: nargs |
---|
13 | CHARACTER(len=256) :: cdoutfile |
---|
14 | CHARACTER(len=256),ALLOCATABLE :: cdinfile(:) |
---|
15 | ! |
---|
16 | ! Input data |
---|
17 | ! |
---|
18 | TYPE(obfbdata), POINTER :: slaf(:) |
---|
19 | INTEGER :: ninfiles,ntotobs |
---|
20 | ! |
---|
21 | ! Output data |
---|
22 | ! |
---|
23 | TYPE(obfbdata) :: fbdata |
---|
24 | ! |
---|
25 | ! Loop variables |
---|
26 | ! |
---|
27 | INTEGER :: ip,ia,ji,jk |
---|
28 | ! |
---|
29 | ! Get number of command line arguments |
---|
30 | ! |
---|
31 | nargs=IARGC() |
---|
32 | IF (nargs < 1) THEN |
---|
33 | WRITE(*,'(A)')'Usage:' |
---|
34 | WRITE(*,'(A)')'sla2fb outputfile inputfile1 inputfile2 ...' |
---|
35 | CALL abort() |
---|
36 | ENDIF |
---|
37 | CALL getarg(1,cdoutfile) |
---|
38 | ! |
---|
39 | ! Get input data |
---|
40 | ! |
---|
41 | ALLOCATE( slaf(MAX(nargs-1,1)) ) |
---|
42 | ALLOCATE( cdinfile(nargs-1) ) |
---|
43 | ntotobs = 0 |
---|
44 | ninfiles = nargs - 1 |
---|
45 | DO ia=1,ninfiles |
---|
46 | CALL getarg( ia + 1, cdinfile(ia) ) |
---|
47 | WRITE(*,'(2A)')'File = ',TRIM(cdinfile(ia)) |
---|
48 | CALL read_avisofile( TRIM(cdinfile(ia)), slaf(ia), 6, .TRUE., .FALSE. ) |
---|
49 | WRITE(*,'(A,I9,A)')'has',slaf(ia)%nobs,' observations' |
---|
50 | ntotobs = ntotobs + slaf(ia)%nobs |
---|
51 | ENDDO |
---|
52 | IF (ninfiles==0) THEN |
---|
53 | CALL init_obfbdata( slaf(1) ) |
---|
54 | CALL alloc_obfbdata( slaf(1), 1, 0, 1, 0, 0, .FALSE. ) |
---|
55 | slaf(1)%cname(1) = 'SLA' |
---|
56 | slaf(1)%cdjuldref = '19500101000000' |
---|
57 | ENDIF |
---|
58 | WRITE(*,'(A,I8)') 'Total observations : ',ntotobs |
---|
59 | ! |
---|
60 | ! Merge and output the data. |
---|
61 | ! |
---|
62 | CALL conv_fbmerge( TRIM(cdoutfile), ninfiles, slaf ) |
---|
63 | |
---|
64 | END PROGRAM sla2fb |
---|