ooo_utils.F90 3.5 KB

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