1 | PROGRAM enact2fb |
---|
2 | !!--------------------------------------------------------------------- |
---|
3 | !! |
---|
4 | !! ** PROGRAM corio2fb ** |
---|
5 | !! |
---|
6 | !! ** Purpose : Convert ENACT format profiles to feedback format |
---|
7 | !! |
---|
8 | !! ** Method : Use of utilities from obs_fbm. |
---|
9 | !! |
---|
10 | !! ** Action : |
---|
11 | !! |
---|
12 | !! Usage: |
---|
13 | !! enact2fb.exe outputfile inputfile1 inputfile2 ... |
---|
14 | !! |
---|
15 | !! History : |
---|
16 | !! ! 2010 (K. Mogensen) Initial version |
---|
17 | !!---------------------------------------------------------------------- |
---|
18 | USE obs_fbm |
---|
19 | USE obs_prof_io |
---|
20 | USE convmerge |
---|
21 | IMPLICIT NONE |
---|
22 | ! |
---|
23 | ! Command line arguments for output file and input files |
---|
24 | ! |
---|
25 | #ifndef NOIARGCPROTO |
---|
26 | INTEGER,EXTERNAL :: iargc |
---|
27 | #endif |
---|
28 | INTEGER :: nargs |
---|
29 | CHARACTER(len=256) :: cdoutfile |
---|
30 | CHARACTER(len=256),ALLOCATABLE :: cdinfile(:) |
---|
31 | ! |
---|
32 | ! Input data |
---|
33 | ! |
---|
34 | TYPE(obfbdata), POINTER :: enactf(:) |
---|
35 | INTEGER :: ninfiles,ntotenact,nmaxlev |
---|
36 | INTEGER,ALLOCATABLE :: iset(:),inum(:),iindex(:) |
---|
37 | ! |
---|
38 | ! Output data |
---|
39 | ! |
---|
40 | TYPE(obfbdata) :: fbdata |
---|
41 | ! |
---|
42 | ! Loop variables |
---|
43 | ! |
---|
44 | INTEGER :: ia,ii,ij |
---|
45 | ! |
---|
46 | ! Get number of command line arguments |
---|
47 | ! |
---|
48 | nargs=IARGC() |
---|
49 | IF (nargs < 1) THEN |
---|
50 | WRITE(*,'(A)')'Usage:' |
---|
51 | WRITE(*,'(A)')'enact2fb outputfile inputfile1 inputfile2 ...' |
---|
52 | CALL abort() |
---|
53 | ENDIF |
---|
54 | CALL getarg(1,cdoutfile) |
---|
55 | ! |
---|
56 | ! Get input data |
---|
57 | ! |
---|
58 | ALLOCATE( enactf(MAX(nargs-1,1)) ) |
---|
59 | ALLOCATE( cdinfile(nargs-1) ) |
---|
60 | ntotenact = 0 |
---|
61 | ninfiles = nargs - 1 |
---|
62 | DO ia = 1,ninfiles |
---|
63 | CALL getarg( ia + 1, cdinfile(ia) ) |
---|
64 | CALL read_enactfile( TRIM(cdinfile(ia)), enactf(ia), 6, .TRUE., .FALSE. ) |
---|
65 | WRITE(*,'(2A)')'File = ',TRIM(cdinfile(ia)) |
---|
66 | WRITE(*,'(A,I9,A)')'has',enactf(ia)%nobs,' profiles' |
---|
67 | ntotenact = ntotenact + enactf(ia)%nobs |
---|
68 | nmaxlev = MAX( nmaxlev, enactf(ia)%nlev ) |
---|
69 | ENDDO |
---|
70 | IF (ninfiles==0) THEN |
---|
71 | CALL init_obfbdata( enactf(1) ) |
---|
72 | CALL alloc_obfbdata( enactf(1), 2, 0, 1, 0, 1, .FALSE. ) |
---|
73 | enactf(1)%cname(1) = 'POTM' |
---|
74 | enactf(1)%cname(2) = 'PSAL' |
---|
75 | enactf(1)%coblong(1) = 'Potential temperature' |
---|
76 | enactf(1)%coblong(2) = 'Practical salinity' |
---|
77 | enactf(1)%cobunit(1) = 'Degrees Celsius' |
---|
78 | enactf(1)%cobunit(2) = 'PSU' |
---|
79 | enactf(1)%cextname(1) = 'TEMP' |
---|
80 | enactf(1)%cextlong(1) = 'Insitu temperature' |
---|
81 | enactf(1)%cextunit(1) = 'Degrees Celsius' |
---|
82 | enactf(1)%cdjuldref = '19500101000000' |
---|
83 | ENDIF |
---|
84 | WRITE(*,'(A,I8)') 'Total profiles : ',ntotenact |
---|
85 | ! |
---|
86 | ! Merge and output the data. |
---|
87 | ! |
---|
88 | CALL conv_fbmerge( TRIM(cdoutfile), ninfiles, enactf ) |
---|
89 | |
---|
90 | END PROGRAM enact2fb |
---|