[2945] | 1 | PROGRAM corio2fb |
---|
[3000] | 2 | !!--------------------------------------------------------------------- |
---|
| 3 | !! |
---|
| 4 | !! ** PROGRAM corio2fb ** |
---|
| 5 | !! |
---|
| 6 | !! ** Purpose : Convert Coriolis format profiles to feedback format |
---|
| 7 | !! |
---|
| 8 | !! ** Method : Use of utilities from obs_fbm. |
---|
| 9 | !! |
---|
| 10 | !! ** Action : |
---|
| 11 | !! |
---|
| 12 | !! Usage: |
---|
| 13 | !! corio2fb.exe outputfile inputfile1 inputfile2 ... |
---|
| 14 | !! |
---|
| 15 | !! History : |
---|
| 16 | !! ! 2010 (K. Mogensen) Initial version |
---|
| 17 | !!---------------------------------------------------------------------- |
---|
[2945] | 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 :: coriof(:) |
---|
| 35 | INTEGER :: ninfiles,ntotcorio,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)')'corio2fb outputfile inputfile1 inputfile2 ...' |
---|
| 52 | CALL abort() |
---|
| 53 | ENDIF |
---|
| 54 | CALL getarg(1,cdoutfile) |
---|
| 55 | ! |
---|
| 56 | ! Get input data |
---|
| 57 | ! |
---|
| 58 | ALLOCATE( coriof(MAX(nargs-1,1)) ) |
---|
| 59 | ALLOCATE( cdinfile(nargs-1) ) |
---|
| 60 | ntotcorio = 0 |
---|
| 61 | ninfiles = nargs - 1 |
---|
| 62 | DO ia=1,ninfiles |
---|
| 63 | CALL getarg( ia + 1, cdinfile(ia) ) |
---|
| 64 | CALL read_coriofile( TRIM(cdinfile(ia)), coriof(ia), 6, .TRUE., .FALSE. ) |
---|
| 65 | WRITE(*,'(2A)')'File = ',TRIM(cdinfile(ia)) |
---|
| 66 | WRITE(*,'(A,I9,A)')'has',coriof(ia)%nobs,' profiles' |
---|
| 67 | ntotcorio = ntotcorio + coriof(ia)%nobs |
---|
| 68 | nmaxlev = MAX( nmaxlev, coriof(ia)%nlev ) |
---|
| 69 | ENDDO |
---|
| 70 | IF (ninfiles==0) THEN |
---|
| 71 | CALL init_obfbdata( coriof(1) ) |
---|
| 72 | CALL alloc_obfbdata( coriof(1), 2, 0, 1, 0, 1, .FALSE. ) |
---|
| 73 | coriof(1)%cname(1) = 'POTM' |
---|
| 74 | coriof(1)%cname(2) = 'PSAL' |
---|
| 75 | coriof(1)%coblong(1) = 'Potential temperature' |
---|
| 76 | coriof(1)%coblong(2) = 'Practical salinity' |
---|
| 77 | coriof(1)%cobunit(1) = 'Degrees Celsius' |
---|
| 78 | coriof(1)%cobunit(2) = 'PSU' |
---|
| 79 | coriof(1)%cextname(1) = 'TEMP' |
---|
| 80 | coriof(1)%cextlong(1) = 'Insitu temperature' |
---|
| 81 | coriof(1)%cextunit(1) = 'Degrees Celsius' |
---|
| 82 | coriof(1)%cdjuldref = '19500101000000' |
---|
| 83 | ENDIF |
---|
| 84 | WRITE(*,'(A,I8)') 'Total profiles : ',ntotcorio |
---|
| 85 | ! |
---|
| 86 | ! Merge and output the data. |
---|
| 87 | ! |
---|
| 88 | CALL conv_fbmerge( TRIM(cdoutfile), ninfiles, coriof ) |
---|
| 89 | |
---|
| 90 | END PROGRAM corio2fb |
---|