1 | MODULE off_netcdf |
---|
2 | USE obs_utils, ONLY: chkerr |
---|
3 | USE obs_const, ONLY: obfillflt |
---|
4 | USE par_oce |
---|
5 | USE obs_types, ONLY: cwmonam1770 |
---|
6 | USE obs_sla, ONLY: nslasets |
---|
7 | |
---|
8 | ! Define double precision obfillflt |
---|
9 | REAL(kind=dp), PARAMETER :: obfilldbl=99999. |
---|
10 | |
---|
11 | CONTAINS |
---|
12 | |
---|
13 | SUBROUTINE yyyymmdd_to_ref_date(indate, intime, outstring) |
---|
14 | IMPLICIT NONE |
---|
15 | !---------------------------------------- |
---|
16 | ! Routine to create reference date string |
---|
17 | !---------------------------------------- |
---|
18 | ! Routine arguments |
---|
19 | CHARACTER(len=8), INTENT(IN) :: indate ! yyyymmdd |
---|
20 | CHARACTER(len=6), INTENT(IN) :: intime ! hhmmss |
---|
21 | CHARACTER(len=23), INTENT(OUT) :: outstring ! yyyy-mm-dd hh:mm:ss utc |
---|
22 | ! Local variables |
---|
23 | CHARACTER(len=4) :: year ! yyyy |
---|
24 | CHARACTER(len=2) :: month ! mm |
---|
25 | CHARACTER(len=2) :: day ! dd |
---|
26 | CHARACTER(len=2) :: hour ! hh |
---|
27 | CHARACTER(len=2) :: minute ! mm |
---|
28 | CHARACTER(len=2) :: second ! ss |
---|
29 | |
---|
30 | year = indate(1:4) |
---|
31 | month = indate(5:6) |
---|
32 | day = indate(7:8) |
---|
33 | hour = intime(1:2) |
---|
34 | minute = intime(3:4) |
---|
35 | second = intime(5:6) |
---|
36 | |
---|
37 | outstring = year//"-"//month//"-"//day//" "//hour//":"//minute//":"//second//" utc" |
---|
38 | |
---|
39 | END SUBROUTINE yyyymmdd_to_ref_date |
---|
40 | |
---|
41 | SUBROUTINE date_format(date_str) |
---|
42 | IMPLICIT NONE |
---|
43 | !--------------------------------------- |
---|
44 | ! Routine to create creation date string |
---|
45 | !--------------------------------------- |
---|
46 | |
---|
47 | ! Routine arguments |
---|
48 | CHARACTER(len=*), INTENT(OUT) :: date_str |
---|
49 | ! Local variables |
---|
50 | CHARACTER(8) :: date |
---|
51 | CHARACTER(10) :: time |
---|
52 | |
---|
53 | CHARACTER(10) :: date_part |
---|
54 | CHARACTER(8) :: time_part |
---|
55 | |
---|
56 | CALL date_and_time(DATE=date) |
---|
57 | CALL date_and_time(TIME=time) |
---|
58 | date_part = date(1:4)//'/'//date(5:6)//'/'//date(7:8) |
---|
59 | time_part = time(1:2)//':'//time(3:4)//':'//time(5:6) |
---|
60 | |
---|
61 | date_str = date_part//' '//time_part |
---|
62 | |
---|
63 | END SUBROUTINE date_format |
---|
64 | |
---|
65 | SUBROUTINE inst_converter(wmo_inst_list, nprofs, obs_names) |
---|
66 | IMPLICIT NONE |
---|
67 | !--------------------------------------- |
---|
68 | ! Routine to convert WMO_INST_TYPE to |
---|
69 | ! 'ARGO', 'TESAC', 'XBT', 'BUOYS' |
---|
70 | !--------------------------------------- |
---|
71 | |
---|
72 | !! Routine arguments |
---|
73 | INTEGER, INTENT(IN) :: nprofs |
---|
74 | CHARACTER(len=*),DIMENSION(nprofs), INTENT(IN) :: wmo_inst_list |
---|
75 | CHARACTER(len=128),DIMENSION(nprofs),INTENT(OUT):: obs_names |
---|
76 | |
---|
77 | !! Local variables |
---|
78 | INTEGER :: inam !: loop over name |
---|
79 | |
---|
80 | !! Initialise obs_names |
---|
81 | obs_names(:) = '' |
---|
82 | |
---|
83 | !! Convert number to text |
---|
84 | DO inam = 1,nprofs |
---|
85 | IF (trim(adjustl(wmo_inst_list(inam))) .EQ. '820') THEN |
---|
86 | obs_names(inam) = 'BUOYS' |
---|
87 | ELSEIF (trim(adjustl(wmo_inst_list(inam))) .EQ. '401') THEN |
---|
88 | obs_names(inam) = 'XBT' |
---|
89 | ELSEIF (trim(adjustl(wmo_inst_list(inam))) .EQ. '741') THEN |
---|
90 | obs_names(inam) = 'TESAC' |
---|
91 | ELSEIF (trim(adjustl(wmo_inst_list(inam))) .EQ. '831') THEN |
---|
92 | obs_names(inam) = 'ARGO' |
---|
93 | ELSEIF (trim(adjustl(wmo_inst_list(inam))) .EQ. '22') THEN ! Special case for AATSR |
---|
94 | obs_names(inam) = '22' |
---|
95 | ELSEIF (trim(adjustl(wmo_inst_list(inam))) .EQ. '') THEN |
---|
96 | obs_names(inam) = 'UNKNOWN' |
---|
97 | ELSE |
---|
98 | obs_names(inam) = adjustl(wmo_inst_list(inam)) ! For all other cases |
---|
99 | ENDIF |
---|
100 | ENDDO |
---|
101 | |
---|
102 | END SUBROUTINE inst_converter |
---|
103 | |
---|
104 | END MODULE off_netcdf |
---|