1 | PROGRAM corio2fb |
---|
2 | USE obs_fbm |
---|
3 | USE obs_prof_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 :: coriof(:) |
---|
19 | INTEGER :: ninfiles,ntotcorio,nmaxlev |
---|
20 | INTEGER,ALLOCATABLE :: iset(:),inum(:),iindex(:) |
---|
21 | ! |
---|
22 | ! Output data |
---|
23 | ! |
---|
24 | TYPE(obfbdata) :: fbdata |
---|
25 | ! |
---|
26 | ! Loop variables |
---|
27 | ! |
---|
28 | INTEGER :: ia,ii,ij |
---|
29 | ! |
---|
30 | ! Get number of command line arguments |
---|
31 | ! |
---|
32 | nargs=IARGC() |
---|
33 | IF (nargs < 1) THEN |
---|
34 | WRITE(*,'(A)')'Usage:' |
---|
35 | WRITE(*,'(A)')'corio2fb outputfile inputfile1 inputfile2 ...' |
---|
36 | CALL abort() |
---|
37 | ENDIF |
---|
38 | CALL getarg(1,cdoutfile) |
---|
39 | ! |
---|
40 | ! Get input data |
---|
41 | ! |
---|
42 | ALLOCATE( coriof(MAX(nargs-1,1)) ) |
---|
43 | ALLOCATE( cdinfile(nargs-1) ) |
---|
44 | ntotcorio = 0 |
---|
45 | ninfiles = nargs - 1 |
---|
46 | DO ia=1,ninfiles |
---|
47 | CALL getarg( ia + 1, cdinfile(ia) ) |
---|
48 | CALL read_coriofile( TRIM(cdinfile(ia)), coriof(ia), 6, .TRUE., .FALSE. ) |
---|
49 | WRITE(*,'(2A)')'File = ',TRIM(cdinfile(ia)) |
---|
50 | WRITE(*,'(A,I9,A)')'has',coriof(ia)%nobs,' profiles' |
---|
51 | ntotcorio = ntotcorio + coriof(ia)%nobs |
---|
52 | nmaxlev = MAX( nmaxlev, coriof(ia)%nlev ) |
---|
53 | ENDDO |
---|
54 | IF (ninfiles==0) THEN |
---|
55 | CALL init_obfbdata( coriof(1) ) |
---|
56 | CALL alloc_obfbdata( coriof(1), 2, 0, 1, 0, 1, .FALSE. ) |
---|
57 | coriof(1)%cname(1) = 'POTM' |
---|
58 | coriof(1)%cname(2) = 'PSAL' |
---|
59 | coriof(1)%coblong(1) = 'Potential temperature' |
---|
60 | coriof(1)%coblong(2) = 'Practical salinity' |
---|
61 | coriof(1)%cobunit(1) = 'Degrees Celsius' |
---|
62 | coriof(1)%cobunit(2) = 'PSU' |
---|
63 | coriof(1)%cextname(1) = 'TEMP' |
---|
64 | coriof(1)%cextlong(1) = 'Insitu temperature' |
---|
65 | coriof(1)%cextunit(1) = 'Degrees Celsius' |
---|
66 | coriof(1)%cdjuldref = '19500101000000' |
---|
67 | ENDIF |
---|
68 | WRITE(*,'(A,I8)') 'Total profiles : ',ntotcorio |
---|
69 | ! |
---|
70 | ! Merge and output the data. |
---|
71 | ! |
---|
72 | CALL conv_fbmerge( TRIM(cdoutfile), ninfiles, coriof ) |
---|
73 | |
---|
74 | END PROGRAM corio2fb |
---|