Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
bufr.pm:bufrdump [2012-01-27 15:41:35] pals |
bufr.pm:bufrdump [2022-05-31 09:29:31] (current) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | Use this in Makefile, with $(FC) set to your Fortran compiler (e.g. gfortran or g77), $(LDIR) set to the directory where libbufr.a is located, and $(FCFLAGS) set to -fbackslash for gfortran | + | Use this in Makefile, with $(FC) set to your Fortran compiler (e.g. gfortran or g77), $(LDIR) set to the directory where libbufr.a is located, and $(FCFLAGS) set to -fbackslash for gfortran. Note that code for comfilter.f is found at the end of this page (below the code for bufrdump.F). |
| < | < | ||
| Line 5: | Line 5: | ||
| $(FC) $(FCFLAGS) -o bufrdump | $(FC) $(FCFLAGS) -o bufrdump | ||
| </ | </ | ||
| + | |||
| <code fortran bufrdump.F> | <code fortran bufrdump.F> | ||
| - | C (C) Copyright 2010, met.no | + | C (C) Copyright 2010-2016 MET Norway |
| C | C | ||
| C This program is free software; you can redistribute it and/or modify | C This program is free software; you can redistribute it and/or modify | ||
| Line 24: | Line 25: | ||
| - | C Extract BUFR messages from bufr file(s) | + | C Extract BUFR messages from bufr file(s) and print the data as |
| - | C bufrdump | + | C ' |
| - | C usage_verbose for explanation of the options allowed. | + | C options allowed. |
| C | C | ||
| C Usage: bufrdump <bufr file> | C Usage: bufrdump <bufr file> | ||
| C [--help] | C [--help] | ||
| C [--filter <filter file>] | C [--filter <filter file>] | ||
| - | C [--obstype] < | + | C [--obstype] < |
| C [--stop_on_error] | C [--stop_on_error] | ||
| C [--rectangle x1 y1 x2 y2] | C [--rectangle x1 y1 x2 y2] | ||
| Line 48: | Line 49: | ||
| C export BUFR_TABLES=/ | C export BUFR_TABLES=/ | ||
| C | C | ||
| - | C Author: P.Sannes | + | C Author: P.Sannes, MET Norway |
| Line 160: | Line 161: | ||
| INTEGER verbose | INTEGER verbose | ||
| + | LOGICAL metar ! Set to TRUE if metar (data subcategory 5) | ||
| + | | ||
| INTEGER kelem, | INTEGER kelem, | ||
| INTEGER kvals ! expected (max) number of data values | INTEGER kvals ! expected (max) number of data values | ||
| Line 207: | Line 209: | ||
| kerr = 0 | kerr = 0 | ||
| + | metar = .FALSE. | ||
| + | | ||
| C Do a partial expansion without quality control | C Do a partial expansion without quality control | ||
| kreq(1) = 1 ! All original elements without quality control | kreq(1) = 1 ! All original elements without quality control | ||
| Line 225: | Line 228: | ||
| C | C | ||
| - | C Using parameter kelem in call to BUFREX might be too big for | + | C Using parameter kelem in call to BUFREX might be too big for some |
| - | C | + | C |
| - | C in libbufr, first calling BUS012 in order to get number of subsets | + | C copied the method used in decode_bufr.F in libbufr, first calling |
| - | C ksup(6) | + | C BUS012 in order to get number of subsets ksup(6) |
| CALL BUS012(ilen, | CALL BUS012(ilen, | ||
| IF (kerr.NE.0) THEN | IF (kerr.NE.0) THEN | ||
| Line 237: | Line 240: | ||
| END IF | END IF | ||
| kxelem = kvals/ | kxelem = kvals/ | ||
| - | | + | C The second IF-condition is not in decode_bufr.F, |
| + | C | ||
| + | | ||
| CALL BUFREX (ilen, | CALL BUFREX (ilen, | ||
| Line 252: | Line 257: | ||
| | | ||
| - | C | + | C |
| C 0 = Surface data - land, 1 = Surface data - sea, 2 = Vertical | C 0 = Surface data - land, 1 = Surface data - sea, 2 = Vertical | ||
| C | C | ||
| - | C | + | C |
| - | IF (ksec1(6).GT.2 .AND. ksec1(6).NE.4 .AND. ksec1(6).NE.31) RETURN | + | IF (ksec1(6).GT.2 .AND. ksec1(6).NE.4 |
| + | | ||
| + | |||
| + | C MET (and perhaps also other ECMWF based software?) uses local | ||
| + | C | ||
| + | IF (KSEC1(2).EQ.3 .AND. KSEC1(6).EQ.0 .AND. KSEC1(7).EQ.5) THEN | ||
| + | metar = .TRUE. | ||
| + | END IF | ||
| IF (filter) THEN | IF (filter) THEN | ||
| Line 292: | Line 304: | ||
| IF (obstype.EQ.' | IF (obstype.EQ.' | ||
| CALL print_surface_values(ksub, | CALL print_surface_values(ksub, | ||
| - | | + | |
| - | ELSE IF (obstype.EQ.' | + | ELSE IF (obstype(1:8).EQ.' |
| CALL print_sounding_values(ksub, | CALL print_sounding_values(ksub, | ||
| - | | + | |
| ELSE IF (obstype.EQ.' | ELSE IF (obstype.EQ.' | ||
| CALL print_amdar_values(ksub, | CALL print_amdar_values(ksub, | ||
| Line 304: | Line 316: | ||
| ELSE IF (ksec1(6).LE.1) THEN | ELSE IF (ksec1(6).LE.1) THEN | ||
| CALL print_surface_values(ksub, | CALL print_surface_values(ksub, | ||
| - | | + | |
| ELSE IF (ksec1(6).EQ.2) THEN | ELSE IF (ksec1(6).EQ.2) THEN | ||
| CALL print_sounding_values(ksub, | CALL print_sounding_values(ksub, | ||
| - | | + | |
| ELSE IF (ksec1(6).EQ.4) THEN | ELSE IF (ksec1(6).EQ.4) THEN | ||
| CALL print_amdar_values(ksub, | CALL print_amdar_values(ksub, | ||
| | | ||
| + | ELSE IF (ksec1(6).EQ.6) THEN | ||
| + | CALL print_radar_profiler_values(ksub, | ||
| + | | ||
| ELSE IF (ksec1(6).EQ.31) THEN | ELSE IF (ksec1(6).EQ.31) THEN | ||
| CALL print_oceanographic_values(ksub, | CALL print_oceanographic_values(ksub, | ||
| Line 329: | Line 344: | ||
| IF (obstype.EQ.' | IF (obstype.EQ.' | ||
| CALL print_surface_values(ksub, | CALL print_surface_values(ksub, | ||
| - | | + | |
| - | ELSE IF (obstype.EQ.' | + | ELSE IF (obstype(1:8).EQ.' |
| CALL print_sounding_values(ksub, | CALL print_sounding_values(ksub, | ||
| - | | + | |
| ELSE IF (obstype.EQ.' | ELSE IF (obstype.EQ.' | ||
| CALL print_amdar_values(ksub, | CALL print_amdar_values(ksub, | ||
| Line 341: | Line 356: | ||
| ELSE IF (ksec1(6).LE.1) THEN | ELSE IF (ksec1(6).LE.1) THEN | ||
| CALL print_surface_values(ksub, | CALL print_surface_values(ksub, | ||
| - | | + | |
| ELSE IF (ksec1(6).EQ.2) THEN | ELSE IF (ksec1(6).EQ.2) THEN | ||
| CALL print_sounding_values(ksub, | CALL print_sounding_values(ksub, | ||
| - | | + | |
| ELSE IF (ksec1(6).EQ.4) THEN | ELSE IF (ksec1(6).EQ.4) THEN | ||
| CALL print_amdar_values(ksub, | CALL print_amdar_values(ksub, | ||
| | | ||
| + | ELSE IF (ksec1(6).EQ.6) THEN | ||
| + | CALL print_radar_profiler_values(ksub, | ||
| + | | ||
| ELSE IF (ksec1(6).EQ.31) THEN | ELSE IF (ksec1(6).EQ.31) THEN | ||
| C For ocea files at met.no data category is 31. But note that IOB | C For ocea files at met.no data category is 31. But note that IOB | ||
| Line 377: | Line 395: | ||
| CHARACTER(LEN=200) argument ! Buffer for next argument | CHARACTER(LEN=200) argument ! Buffer for next argument | ||
| - | CHARACTER(LEN=1150) Usage | + | CHARACTER(LEN=1350) Usage |
| - | CHARACTER(LEN=900) Help | + | CHARACTER(LEN=950) Help |
| INTEGER iargc,iarg | INTEGER iargc,iarg | ||
| Line 398: | Line 416: | ||
| | | ||
| | | ||
| - | | + | |
| | | ||
| | | ||
| | | ||
| - | | + | |
| + | | ||
| + | | ||
| | | ||
| | | ||
| Line 439: | Line 459: | ||
| | | ||
| | | ||
| + | | ||
| + | | ||
| | | ||
| | | ||
| Line 532: | Line 554: | ||
| IF (obstype.NE.'' | IF (obstype.NE.'' | ||
| - | | + | |
| + | | ||
| | | ||
| - | | + | |
| CALL EXIT(1) | CALL EXIT(1) | ||
| END IF | END IF | ||
| Line 544: | Line 567: | ||
| SUBROUTINE err_msg(msg) | SUBROUTINE err_msg(msg) | ||
| IMPLICIT NONE | IMPLICIT NONE | ||
| - | CHARACTER*80 msg | + | CHARACTER(LEN=*) msg |
| WRITE(*,*) msg | WRITE(*,*) msg | ||
| STOP | STOP | ||
| Line 553: | Line 576: | ||
| SUBROUTINE err_msg1(msg, | SUBROUTINE err_msg1(msg, | ||
| IMPLICIT NONE | IMPLICIT NONE | ||
| - | CHARACTER*80 msg | + | CHARACTER(LEN=*) msg |
| INTEGER kerr | INTEGER kerr | ||
| WRITE(*,*) msg,kerr | WRITE(*,*) msg,kerr | ||
| Line 655: | Line 678: | ||
| CLOSE(11) | CLOSE(11) | ||
| + | IF (verbose.GT.2) WRITE(*,*) ' | ||
| IF (nfivlines.EQ.0) filter = .FALSE. | IF (nfivlines.EQ.0) filter = .FALSE. | ||
| Line 730: | Line 754: | ||
| DO nsub = 1, | DO nsub = 1, | ||
| C loop through all different conditions: | C loop through all different conditions: | ||
| + | ifiv = 0 | ||
| DO i1 = 1,nfidlines | DO i1 = 1,nfidlines | ||
| C loop through all filter value lines (for given) condition: | C loop through all filter value lines (for given) condition: | ||
| - | ifiv = 0 | ||
| DO ifvl = 1, | DO ifvl = 1, | ||
| ifiv = ifiv + 1 | ifiv = ifiv + 1 | ||
| Line 765: | Line 789: | ||
| END IF | END IF | ||
| END IF | END IF | ||
| - | END DO ! all data in subset | + | END DO |
| IF (.NOT.match) ! there is one descriptor in condition which | IF (.NOT.match) ! there is one descriptor in condition which | ||
| - | | + | |
| - | END DO | + | |
| + | END DO ! all descriptors in condition | ||
| IF (match) THEN | IF (match) THEN | ||
| | | ||
| | | ||
| GO TO 500 ! next subset | GO TO 500 ! next subset | ||
| - | END IF | + | |
| - | | + | |
| END DO ! all filter value lines (for given) condition | END DO ! all filter value lines (for given) condition | ||
| | | ||
| Line 786: | Line 810: | ||
| C | C | ||
| - | C | + | C |
| - | C 7002 HEIGHT OR ALTITUDE | + | C ALTITUDE |
| - | C 7004 PRESSURE (10004 was used for pressure). Not able to handle | + | C used as vertical coordinate instead of 7004 PRESSURE (10004 was |
| - | C that in present code. | + | C used for pressure |
| + | C | ||
| SUBROUTINE print_sounding_values(ksub, | SUBROUTINE print_sounding_values(ksub, | ||
| - | | + | |
| IMPLICIT NONE | IMPLICIT NONE | ||
| Line 801: | Line 826: | ||
| CHARACTER*80 cvals(*) | CHARACTER*80 cvals(*) | ||
| LOGICAL rectangle | LOGICAL rectangle | ||
| + | CHARACTER(LEN=*) obstype | ||
| INTEGER verbose | INTEGER verbose | ||
| Line 807: | Line 833: | ||
| REAL*8 II, | REAL*8 II, | ||
| - | | + | |
| + | CHARACTER*5 wigos_issuer, | ||
| CHARACTER*9 call_sign, | CHARACTER*9 call_sign, | ||
| + | CHARACTER*8 flight_number, | ||
| + | CHARACTER*16 wigos_localid, | ||
| + | |||
| CHARACTER one_bits | CHARACTER one_bits | ||
| REAL*8 value | REAL*8 value | ||
| - | INTEGER idx, | + | INTEGER idx, |
| - | PARAMETER(maxlevel=1000) | + | PARAMETER(maxlevel=100000) |
| REAL*8 P(maxlevel), | REAL*8 P(maxlevel), | ||
| Line 819: | Line 849: | ||
| | | ||
| CHARACTER*8 vss(maxlevel) ! Vertical sounding significance | CHARACTER*8 vss(maxlevel) ! Vertical sounding significance | ||
| + | CHARACTER*8 vss_missing | ||
| + | LOGICAL reduce ! Set to TRUE if we should skip levels with | ||
| + | ! vertical sounding significance missing or equal | ||
| + | ! to 0 | ||
| C | C | ||
| Line 827: | Line 861: | ||
| INTEGER lenstr | INTEGER lenstr | ||
| CHARACTER*9 ctrim ! length must be >= longest variable ctrim is used for | CHARACTER*9 ctrim ! length must be >= longest variable ctrim is used for | ||
| + | |||
| + | IF (obstype.EQ.' | ||
| + | | ||
| + | ELSE | ||
| + | | ||
| + | END IF | ||
| one_bits = CHAR(255) | one_bits = CHAR(255) | ||
| - | WRITE(missing9,'(9A)') one_bits, | + | WRITE(missing5,'(5A)') one_bits, |
| - | | + | |
| + | WRITE(missing8,' | ||
| + | | ||
| + | missing9 = missing8 // one_bits | ||
| + | missing16 = missing8 // missing8 | ||
| + | vss_missing = ' | ||
| C | C | ||
| call_sign = missing9 | call_sign = missing9 | ||
| + | flight_number = missing8 | ||
| + | wigos_issuer = missing5 | ||
| + | wigos_issueno = missing5 | ||
| + | wigos_localid = missing16 | ||
| + | wigos_series = rvind | ||
| II = rvind | II = rvind | ||
| iii= rvind | iii= rvind | ||
| Line 854: | Line 904: | ||
| lo(n) = rvind | lo(n) = rvind | ||
| tp(n) = rvind | tp(n) = rvind | ||
| - | | + | |
| | | ||
| | | ||
| Line 875: | Line 925: | ||
| ELSE IF (desc.EQ.1002) THEN ! WMO station number | ELSE IF (desc.EQ.1002) THEN ! WMO station number | ||
| iii = value | iii = value | ||
| - | ELSE IF (desc.EQ.1011) THEN | + | ELSE IF (desc.EQ.1011.OR. ! Ship or mobile |
| + | | ||
| cidx = int(value/ | cidx = int(value/ | ||
| | | ||
| | | ||
| + | ELSE IF (desc.EQ.1006) THEN ! Aircraft flight number, used for dropsondes | ||
| + | cidx = int(value/ | ||
| + | flight_number = cvals(cidx) ! CCITTIA5 data | ||
| + | flight_number = ctrim(flight_number, | ||
| + | ELSE IF (desc.EQ.1125) THEN ! WIGOS identifier series | ||
| + | wigos_series = value | ||
| + | ELSE IF (desc.EQ.1126) THEN ! WIGOS issuer of identifier | ||
| + | i = NINT(value) | ||
| + | WRITE(wigos_issuer,' | ||
| + | wigos_issuer = ADJUSTL(wigos_issuer) | ||
| + | ELSE IF (desc.EQ.1127) THEN ! WIGOS issue number | ||
| + | i = NINT(value) | ||
| + | WRITE(wigos_issueno,' | ||
| + | wigos_issueno = ADJUSTL(wigos_issueno) | ||
| + | ELSE IF (desc.EQ.1128) THEN ! WIGOS local identifier | ||
| + | cidx = int(value/ | ||
| + | wigos_localid = cvals(cidx) ! CCITTIA5 data | ||
| + | wigos_localid = ctrim(wigos_localid, | ||
| ELSE IF (desc.EQ.2001) THEN ! Type of station | ELSE IF (desc.EQ.2001) THEN ! Type of station | ||
| ix = value | ix = value | ||
| Line 900: | Line 969: | ||
| ELSE IF (desc.EQ.6002 .AND. longitude.EQ.rvind) THEN ! Longitude (coarse accuracy) | ELSE IF (desc.EQ.6002 .AND. longitude.EQ.rvind) THEN ! Longitude (coarse accuracy) | ||
| longitude = value | longitude = value | ||
| - | ELSE IF (desc.EQ.7001) THEN ! Height of station | + | ELSE IF (desc.EQ.7001.OR. ! Height of station |
| - | height = value | + | |
| - | ELSE IF (desc.EQ.4086) THEN ! Long time period or displacement [second] | + | |
| + | | ||
| + | | ||
| + | height = value | ||
| + | END IF | ||
| + | ELSE IF (desc.EQ.4086.AND.n.LT.maxlevel) THEN ! Long time period or displacement [second] | ||
| C In WMO template (309052) descriptors 004086 and 008042 comes BEFORE 7004 pressure | C In WMO template (309052) descriptors 004086 and 008042 comes BEFORE 7004 pressure | ||
| tp(n+1) = value | tp(n+1) = value | ||
| - | ELSE IF (desc.EQ.8042) THEN ! Extended vertical sounding significance | + | ELSE IF (desc.EQ.8042.AND.n.LT.maxlevel) THEN ! Extended vertical sounding significance |
| CALL vss_8042(NINT(value), | CALL vss_8042(NINT(value), | ||
| ELSE IF (desc.EQ.7004) THEN ! Pressure | ELSE IF (desc.EQ.7004) THEN ! Pressure | ||
| n = n + 1 ! new level | n = n + 1 ! new level | ||
| IF (n.GT.maxlevel) THEN | IF (n.GT.maxlevel) THEN | ||
| + | n = maxlevel | ||
| | | ||
| GOTO 110 | GOTO 110 | ||
| Line 915: | Line 990: | ||
| P(n) = value | P(n) = value | ||
| C All following descriptors come after pressure in 309052 (or Hirlam template) | C All following descriptors come after pressure in 309052 (or Hirlam template) | ||
| - | ELSE IF (n.GT.0) THEN ! This condition secures against underflow | + | ELSE IF (n.GT.0 |
| IF (desc.EQ.11001) THEN ! Wind direction | IF (desc.EQ.11001) THEN ! Wind direction | ||
| D(n) = value | D(n) = value | ||
| Line 955: | Line 1030: | ||
| END IF | END IF | ||
| - | WRITE(*,*) | + | |
| IF (II.NE.rvind .AND. iii.NE.rvind) THEN | IF (II.NE.rvind .AND. iii.NE.rvind) THEN | ||
| + | | ||
| | | ||
| + | ELSE IF (wigos_series.NE.rvind .AND. wigos_issuer.NE.missing5 | ||
| + | | ||
| + | | ||
| + | ind = index(wigos_issuer,' | ||
| + | IF (ind.EQ.-1) ind = 5 | ||
| + | ind2 = index(wigos_issueno,' | ||
| + | IF (ind2.EQ.-1) ind2 = 5 | ||
| + | ind3 = index(wigos_localid,' | ||
| + | IF (ind3.EQ.-1) ind3 = 16 | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| ELSE IF (call_sign.NE.missing9) THEN | ELSE IF (call_sign.NE.missing9) THEN | ||
| + | | ||
| | | ||
| + | ELSE IF (flight_number.NE.missing8) THEN | ||
| + | | ||
| + | | ||
| + | | ||
| ELSE | ELSE | ||
| IF (verbose .GT. 1) THEN | IF (verbose .GT. 1) THEN | ||
| - | WRITE(*,*) 'Both wmonr and call sign are missing!!!' | + | |
| + | | ||
| + | | ||
| END IF | END IF | ||
| | | ||
| Line 978: | Line 1076: | ||
| END IF | END IF | ||
| ENDIF | ENDIF | ||
| - | IF (NINT(ix).EQ.0) THEN | + | |
| - | | + | IF (NINT(ix).EQ.0) THEN |
| - | ELSE IF (NINT(ix).EQ.1) THEN | + | WRITE(*,' |
| - | | + | |
| - | ELSE IF (NINT(ix).EQ.2) THEN | + | WRITE(*,' |
| - | | + | |
| + | WRITE(*,' | ||
| + | END IF | ||
| END IF | END IF | ||
| IF (latitude.NE.rvind) THEN | IF (latitude.NE.rvind) THEN | ||
| Line 996: | Line 1096: | ||
| DO n=1, | DO n=1, | ||
| + | IF (reduce .AND. vss(n).EQ.vss_missing) CYCLE | ||
| | | ||
| C The following 3 parameters are not found in TAC TEMP | C The following 3 parameters are not found in TAC TEMP | ||
| Line 1036: | Line 1137: | ||
| END SUBROUTINE print_sounding_values | END SUBROUTINE print_sounding_values | ||
| + | |||
| + | C | ||
| + | |||
| + | C | ||
| + | C | ||
| + | SUBROUTINE print_radar_profiler_values(ksub, | ||
| + | | ||
| + | IMPLICIT NONE | ||
| + | |||
| + | INTEGER ksub ! Input: number of subset currently processed | ||
| + | INTEGER kxelem | ||
| + | INTEGER ktdexl | ||
| + | INTEGER ktdexp(*) | ||
| + | REAL*8 values(*) | ||
| + | CHARACTER*80 cvals(*) | ||
| + | LOGICAL rectangle | ||
| + | INTEGER verbose | ||
| + | |||
| + | REAL*8 rvind ! missing value for real*8 data | ||
| + | PARAMETER (rvind=1.7E38) | ||
| + | |||
| + | REAL*8 II, | ||
| + | | ||
| + | CHARACTER*9 call_sign, | ||
| + | CHARACTER one_bits | ||
| + | REAL*8 value | ||
| + | INTEGER idx, | ||
| + | PARAMETER(maxlevel=1000) | ||
| + | |||
| + | REAL*8 HH(maxlevel), | ||
| + | | ||
| + | |||
| + | C | ||
| + | REAL*8 x1,y1,x2,y2 | ||
| + | COMMON / | ||
| + | |||
| + | C | ||
| + | INTEGER lenstr | ||
| + | CHARACTER*9 ctrim ! length must be >= longest variable ctrim is used for | ||
| + | |||
| + | one_bits = CHAR(255) | ||
| + | WRITE(missing9,' | ||
| + | | ||
| + | |||
| + | C | ||
| + | call_sign = missing9 | ||
| + | II = rvind | ||
| + | iii= rvind | ||
| + | year = rvind | ||
| + | month = rvind | ||
| + | day = rvind | ||
| + | hour = rvind | ||
| + | minute = rvind | ||
| + | latitude = rvind | ||
| + | longitude = rvind | ||
| + | height = rvind | ||
| + | DO n=1, | ||
| + | HH(n) = rvind | ||
| + | D(n) = rvind | ||
| + | F(n) = rvind | ||
| + | Q1(n) = rvind | ||
| + | WC(n) = rvind | ||
| + | Q2(n) = rvind | ||
| + | END DO | ||
| + | |||
| + | C Loop through all expanded descriptors | ||
| + | n = 0 ! Numbering the pressure levels | ||
| + | DO idx=1, | ||
| + | desc = ktdexp(idx) | ||
| + | value = values(idx + (ksub-1)*kxelem) | ||
| + | |||
| + | C | ||
| + | C | ||
| + | IF (ABS(value - rvind)/ | ||
| + | CYCLE | ||
| + | END IF | ||
| + | |||
| + | IF (desc.EQ.1001) THEN ! WMO block number | ||
| + | II = value | ||
| + | ELSE IF (desc.EQ.1002) THEN ! WMO station number | ||
| + | iii = value | ||
| + | ELSE IF (desc.EQ.1011.OR. | ||
| + | | ||
| + | cidx = int(value/ | ||
| + | | ||
| + | | ||
| + | ELSE IF (desc.EQ.2001) THEN ! Type of station | ||
| + | ix = value | ||
| + | ELSE IF (desc.EQ.4001) THEN ! Year | ||
| + | year = value | ||
| + | ELSE IF (desc.EQ.4002) THEN ! Month | ||
| + | month = value | ||
| + | ELSE IF (desc.EQ.4003) THEN ! Day | ||
| + | day = value | ||
| + | ELSE IF (desc.EQ.4004) THEN ! Hour | ||
| + | hour = value | ||
| + | ELSE IF (desc.EQ.4005) THEN ! Minute | ||
| + | minute = value | ||
| + | C Seen 5002 and 6002 used for each level in high resolution data | ||
| + | ELSE IF (desc.EQ.5001 .AND. latitude.EQ.rvind) THEN ! Latitude (high accuracy) | ||
| + | latitude = value | ||
| + | ELSE IF (desc.EQ.5002 .AND. latitude.EQ.rvind) THEN ! Latitude (coarse accuracy) | ||
| + | latitude = value | ||
| + | ELSE IF (desc.EQ.6001 .AND. longitude.EQ.rvind) THEN ! Longitude (high accuracy) | ||
| + | longitude = value | ||
| + | ELSE IF (desc.EQ.6002 .AND. longitude.EQ.rvind) THEN ! Longitude (coarse accuracy) | ||
| + | longitude = value | ||
| + | ELSE IF (desc.EQ.7001) THEN ! Height of station | ||
| + | IF (height.EQ.rvind) THEN | ||
| + | | ||
| + | END IF | ||
| + | ELSE IF (desc.EQ.7007) THEN ! Height | ||
| + | n = n + 1 ! new level | ||
| + | IF (n.GT.maxlevel) THEN | ||
| + | n = maxlevel | ||
| + | | ||
| + | GOTO 110 | ||
| + | END IF | ||
| + | HH(n) = value | ||
| + | C All following descriptors come after 7007 height | ||
| + | ELSE IF (n.GT.0 .AND. n.LE.maxlevel) THEN | ||
| + | IF (desc.EQ.11001) THEN ! Wind direction | ||
| + | D(n) = value | ||
| + | ELSE IF (desc.EQ.11002) THEN ! Wind speed | ||
| + | F(n) = value | ||
| + | ELSE IF (desc.EQ.11006) THEN ! W-component | ||
| + | WC(n) = value | ||
| + | ELSE IF (desc.EQ.33002) THEN ! Quality information, | ||
| + | IF (ktdexp(idx-1).EQ.11002) THEN | ||
| + | Q1(n) = value | ||
| + | ELSE | ||
| + | Q2(n) = value | ||
| + | END IF | ||
| + | END IF | ||
| + | END IF | ||
| + | END DO | ||
| + | | ||
| + | numlevels = n | ||
| + | |||
| + | IF (rectangle) THEN | ||
| + | IF (longitude.EQ.rvind .OR. latitude.EQ.rvind | ||
| + | | ||
| + | | ||
| + | END IF | ||
| + | |||
| + | IF (II.NE.rvind .AND. iii.NE.rvind) THEN | ||
| + | | ||
| + | | ||
| + | ELSE IF (call_sign.NE.missing9) THEN | ||
| + | | ||
| + | | ||
| + | ELSE | ||
| + | IF (verbose .GT. 1) THEN | ||
| + | WRITE(*,*) | ||
| + | WRITE(*,*) 'Both wmonr and call sign are missing!!!' | ||
| + | END IF | ||
| + | | ||
| + | END IF | ||
| + | |||
| + | IF (year.NE.rvind.AND.month.NE.rvind.AND.day.NE.rvind | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | ELSE | ||
| + | IF (verbose .GT. 1) THEN | ||
| + | WRITE(*,*) ' | ||
| + | RETURN | ||
| + | END IF | ||
| + | ENDIF | ||
| + | IF (ix.NE.rvind) THEN | ||
| + | IF (NINT(ix).EQ.0) THEN | ||
| + | WRITE(*,' | ||
| + | ELSE IF (NINT(ix).EQ.1) THEN | ||
| + | WRITE(*,' | ||
| + | ELSE IF (NINT(ix).EQ.2) THEN | ||
| + | WRITE(*,' | ||
| + | END IF | ||
| + | END IF | ||
| + | IF (latitude.NE.rvind) THEN | ||
| + | | ||
| + | END IF | ||
| + | IF (longitude.NE.rvind) THEN | ||
| + | | ||
| + | END IF | ||
| + | IF (height.NE.rvind) THEN | ||
| + | | ||
| + | END IF | ||
| + | |||
| + | DO n=1, | ||
| + | | ||
| + | IF (HH(n).NE.rvind) THEN | ||
| + | WRITE(*,' | ||
| + | END IF | ||
| + | IF (D(n).NE.rvind) THEN | ||
| + | WRITE(*,' | ||
| + | END IF | ||
| + | IF (F(n).NE.rvind) THEN | ||
| + | WRITE(*,' | ||
| + | END IF | ||
| + | IF (Q1(n).NE.rvind) THEN | ||
| + | WRITE(*,' | ||
| + | END IF | ||
| + | IF (WC(n).NE.rvind) THEN | ||
| + | WRITE(*,' | ||
| + | END IF | ||
| + | IF (Q2(n).NE.rvind) THEN | ||
| + | WRITE(*,' | ||
| + | END IF | ||
| + | END DO | ||
| + | |||
| + | END SUBROUTINE print_radar_profiler_values | ||
| C | C | ||
| SUBROUTINE print_surface_values(ksub, | SUBROUTINE print_surface_values(ksub, | ||
| - | | + | |
| C | C | ||
| IMPLICIT NONE | IMPLICIT NONE | ||
| Line 1051: | Line 1364: | ||
| CHARACTER*80 cvals(*) | CHARACTER*80 cvals(*) | ||
| LOGICAL rectangle | LOGICAL rectangle | ||
| + | LOGICAL metar ! Input: TRUE if metar (data subcategory 5) | ||
| INTEGER verbose | INTEGER verbose | ||
| Line 1056: | Line 1370: | ||
| PARAMETER (rvind=1.7E38) | PARAMETER (rvind=1.7E38) | ||
| - | CHARACTER*8 icao_id, | + | |
| - | CHARACTER*9 call_sign, | + | |
| - | CHARACTER*20 name, | + | CHARACTER*9 call_sign, |
| - | CHARACTER*32 long_name, | + | CHARACTER*16 wigos_localid,missing16 |
| + | CHARACTER*20 name, | ||
| + | CHARACTER*32 long_name, | ||
| C | C | ||
| REAL*8 AA, | REAL*8 AA, | ||
| - | | + | |
| - | | + | |
| | | ||
| - | | + | |
| | | ||
| C Other parameters | C Other parameters | ||
| - | | + | |
| - | | + | |
| | | ||
| - | | + | |
| + | | ||
| REAL*8 vert_sign(4), | REAL*8 vert_sign(4), | ||
| INTEGER idx,cidx | INTEGER idx,cidx | ||
| INTEGER cloud_type_count | INTEGER cloud_type_count | ||
| - | ! (cloud type) encountered (0 initially) | + | ! (cloud type) encountered (0 initially). |
| - | INTEGER num_cloud_layers | + | ! Not used for metar |
| - | ! set to value of 031001 (delayed | + | INTEGER num_cloud_layers |
| - | ! descriptor) if this is met immediately | + | ! to value of 031001 (delayed |
| - | ! after a 020012 descriptor (-1 initially) | + | ! replication factor) if this is met immediately |
| + | ! after a 020012 descriptor (-1 initially). | ||
| + | ! For metar num_cloud_layers is increased | ||
| + | ! by one for each new 020011 | ||
| LOGICAL bad_cloud_data | LOGICAL bad_cloud_data | ||
| ! found in cloud data. No more cloud | ! found in cloud data. No more cloud | ||
| Line 1087: | Line 1407: | ||
| ! surface' | ! surface' | ||
| ! from 0 | ! from 0 | ||
| + | LOGICAL time_of_last_position ! Set to true if 008021 time significance is | ||
| + | ! included with value 26 | ||
| CHARACTER one_bits | CHARACTER one_bits | ||
| REAL*8 value | REAL*8 value | ||
| - | INTEGER desc, | + | INTEGER desc, |
| - | INTEGER degree2dir, | + | INTEGER degree2dir, |
| C | C | ||
| Line 1102: | Line 1424: | ||
| one_bits = CHAR(255) | one_bits = CHAR(255) | ||
| + | WRITE(missing5,' | ||
| + | | ||
| WRITE(missing8,' | WRITE(missing8,' | ||
| | | ||
| missing9 = missing8 // one_bits | missing9 = missing8 // one_bits | ||
| + | missing16 = missing8 // missing8 | ||
| missing20 = missing9 // missing9 // one_bits // one_bits | missing20 = missing9 // missing9 // one_bits // one_bits | ||
| - | missing32 = missing20 | + | missing32 = missing16 |
| - | | + | |
| - | spc8 = ' | + | |
| - | spc9 = ' | + | |
| - | spc20 = ' | + | |
| - | spc32 = ' | + | |
| cloud_type_count = 0 | cloud_type_count = 0 | ||
| Line 1117: | Line 1437: | ||
| num_cloud_layers = -1 | num_cloud_layers = -1 | ||
| surface_data = .TRUE. | surface_data = .TRUE. | ||
| + | time_of_last_position = .FALSE. | ||
| C | C | ||
| Line 1123: | Line 1444: | ||
| icao_id = missing8 | icao_id = missing8 | ||
| call_sign = missing9 | call_sign = missing9 | ||
| + | wigos_issuer = missing5 | ||
| + | wigos_issueno = missing5 | ||
| + | wigos_localid = missing16 | ||
| name = missing20 | name = missing20 | ||
| long_name = missing32 | long_name = missing32 | ||
| Line 1139: | Line 1463: | ||
| DW1 = rvind | DW1 = rvind | ||
| DW2 = rvind | DW2 = rvind | ||
| + | EE = rvind | ||
| ES = rvind | ES = rvind | ||
| - | E = rvind | ||
| - | EM = rvind | ||
| EV_1 = rvind | EV_1 = rvind | ||
| EV_24 = rvind | EV_24 = rvind | ||
| Line 1156: | Line 1479: | ||
| HW1 = rvind | HW1 = rvind | ||
| HW2 = rvind | HW2 = rvind | ||
| + | HWA = rvind | ||
| NH = rvind | NH = rvind | ||
| NN = rvind | NN = rvind | ||
| Line 1168: | Line 1492: | ||
| PW1 = rvind | PW1 = rvind | ||
| PW2 = rvind | PW2 = rvind | ||
| + | PWA = rvind | ||
| QD = rvind | QD = rvind | ||
| QE = rvind | QE = rvind | ||
| Line 1189: | Line 1514: | ||
| SG = rvind | SG = rvind | ||
| SI = rvind | SI = rvind | ||
| + | SS_24 = rvind | ||
| TA = rvind | TA = rvind | ||
| TAN_12 = rvind | TAN_12 = rvind | ||
| Line 1212: | Line 1538: | ||
| longitude = rvind | longitude = rvind | ||
| height = rvind | height = rvind | ||
| + | hp = rvind | ||
| vert_sign_first = rvind | vert_sign_first = rvind | ||
| II = rvind | II = rvind | ||
| Line 1221: | Line 1548: | ||
| vs = rvind | vs = rvind | ||
| TbTbTb = rvind | TbTbTb = rvind | ||
| - | | + | |
| + | buoy_id7 | ||
| wmo_region_number = rvind | wmo_region_number = rvind | ||
| wmo_region_subarea = rvind | wmo_region_subarea = rvind | ||
| state_id = rvind | state_id = rvind | ||
| national_number = rvind | national_number = rvind | ||
| + | wigos_series = rvind | ||
| DO i=1,4 | DO i=1,4 | ||
| Line 1278: | Line 1607: | ||
| ELSE IF (desc.EQ.4025) THEN ! Time period or displacement [minute] | ELSE IF (desc.EQ.4025) THEN ! Time period or displacement [minute] | ||
| minute_p = value | minute_p = value | ||
| + | ELSE IF (desc.EQ.8021) THEN ! Time significance | ||
| + | IF (NINT(value).EQ.26) THEN | ||
| + | | ||
| + | ELSE | ||
| + | | ||
| + | END IF | ||
| ELSE IF (desc.EQ.1001 .AND. II.EQ.rvind) THEN ! WMO block number | ELSE IF (desc.EQ.1001 .AND. II.EQ.rvind) THEN ! WMO block number | ||
| - | II = value | + | |
| ELSE IF (desc.EQ.1002 .AND. iii.EQ.rvind) THEN ! WMO station number | ELSE IF (desc.EQ.1002 .AND. iii.EQ.rvind) THEN ! WMO station number | ||
| - | iii = value | + | |
| ELSE IF (desc.EQ.1101 .AND. state_id.EQ.rvind) THEN ! WMO member state identifier | ELSE IF (desc.EQ.1101 .AND. state_id.EQ.rvind) THEN ! WMO member state identifier | ||
| - | state_id = value | + | |
| ELSE IF (desc.EQ.1102 .AND. national_number.EQ.rvind) THEN ! National station number | ELSE IF (desc.EQ.1102 .AND. national_number.EQ.rvind) THEN ! National station number | ||
| - | national_number = value | + | |
| ELSE IF (desc.EQ.1015) THEN ! Station or site name | ELSE IF (desc.EQ.1015) THEN ! Station or site name | ||
| cidx = int(value/ | cidx = int(value/ | ||
| - | | + | name = cvals(cidx) |
| - | name = cvals(cidx) ! CCITTIA5 data | + | name = ctrim(name, |
| - | | + | |
| - | END IF | + | |
| ELSE IF (desc.EQ.1019) THEN ! Long station or site name | ELSE IF (desc.EQ.1019) THEN ! Long station or site name | ||
| cidx = int(value/ | cidx = int(value/ | ||
| - | | + | |
| - | long_name | + | long_name = ctrim(long_name, |
| - | long_name | + | ELSE IF (desc.EQ.1125) THEN ! WIGOS identifier series |
| - | END IF | + | |
| + | ELSE IF (desc.EQ.1126) THEN ! WIGOS issuer of identifier | ||
| + | i = NINT(value) | ||
| + | WRITE(wigos_issuer,' | ||
| + | wigos_issuer = ADJUSTL(wigos_issuer) | ||
| + | ELSE IF (desc.EQ.1127) THEN ! WIGOS issue number | ||
| + | i = NINT(value) | ||
| + | WRITE(wigos_issueno,' | ||
| + | wigos_issueno = ADJUSTL(wigos_issueno) | ||
| + | ELSE IF (desc.EQ.1128) THEN ! WIGOS local identifier | ||
| + | cidx = int(value/ | ||
| + | wigos_localid | ||
| + | | ||
| ELSE IF (desc.EQ.2001) THEN ! Type of station | ELSE IF (desc.EQ.2001) THEN ! Type of station | ||
| IF (ix.EQ.rvind) THEN | IF (ix.EQ.rvind) THEN | ||
| Line 1303: | Line 1648: | ||
| END IF | END IF | ||
| ELSE IF (desc.EQ.4001) THEN ! Year | ELSE IF (desc.EQ.4001) THEN ! Year | ||
| - | IF (year.EQ.rvind) THEN | + | IF (year.EQ.rvind.AND..NOT.time_of_last_position) THEN |
| year = value | year = value | ||
| END IF | END IF | ||
| ELSE IF (desc.EQ.4002) THEN ! Month | ELSE IF (desc.EQ.4002) THEN ! Month | ||
| - | IF (month.EQ.rvind) THEN | + | IF (month.EQ.rvind.AND..NOT.time_of_last_position) THEN |
| month = value | month = value | ||
| END IF | END IF | ||
| ELSE IF (desc.EQ.4003) THEN ! Day | ELSE IF (desc.EQ.4003) THEN ! Day | ||
| - | IF (day.EQ.rvind) THEN | + | IF (day.EQ.rvind.AND..NOT.time_of_last_position) THEN |
| day = value | day = value | ||
| END IF | END IF | ||
| ELSE IF (desc.EQ.4004) THEN ! Hour | ELSE IF (desc.EQ.4004) THEN ! Hour | ||
| - | IF (hour.EQ.rvind) THEN | + | IF (hour.EQ.rvind.AND..NOT.time_of_last_position) THEN |
| hour = value | hour = value | ||
| END IF | END IF | ||
| ELSE IF (desc.EQ.4005) THEN ! Minute | ELSE IF (desc.EQ.4005) THEN ! Minute | ||
| - | IF (minute.EQ.rvind) THEN | + | IF (minute.EQ.rvind.AND..NOT.time_of_last_position) THEN |
| | | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.5001) THEN ! Latitude (high accuracy) | + | ELSE IF (desc.EQ.5001.OR. ! Latitude (high accuracy) |
| + | | ||
| IF (latitude.EQ.rvind) THEN | IF (latitude.EQ.rvind) THEN | ||
| | | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.5002) THEN ! Latitude | + | ELSE IF (desc.EQ.6001.OR. |
| - | IF (latitude.EQ.rvind) THEN | + | + desc.EQ.6002) THEN ! Longitude (coarse |
| - | | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.6001) THEN ! Longitude (high accuracy) | + | |
| IF (longitude.EQ.rvind) THEN | IF (longitude.EQ.rvind) THEN | ||
| | | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.6002) THEN ! Longitude (coarse accuracy) | + | ELSE IF (desc.EQ.7001.OR. ! Height of station |
| - | IF (longitude.EQ.rvind) THEN | + | + desc.EQ.7030) THEN ! Height of station |
| - | longitude = value | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.7001) THEN ! Height of station | + | |
| IF (height.EQ.rvind) THEN | IF (height.EQ.rvind) THEN | ||
| | | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.7030) THEN ! Height of station ground above mean sea level | + | ELSE IF (desc.EQ.7031) THEN ! Hp |
| - | IF (height.EQ.rvind) THEN | + | IF (hp.EQ.rvind) THEN |
| - | height | + | hp = value |
| END IF | END IF | ||
| ELSE IF (desc.EQ.10004) THEN ! Pressure | ELSE IF (desc.EQ.10004) THEN ! Pressure | ||
| Line 1362: | Line 1702: | ||
| AA = value | AA = value | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.11011) THEN ! Wind direction at 10 m | + | ELSE IF (desc.EQ.11011.OR. |
| + | | ||
| IF (DD.EQ.rvind) THEN | IF (DD.EQ.rvind) THEN | ||
| DD = value | DD = value | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.11001) THEN ! Wind direction | + | ELSE IF (desc.EQ.11012.OR. ! Wind speed at 10 m |
| - | IF (DD.EQ.rvind) THEN | + | + desc.EQ.11002) THEN ! Wind speed |
| - | DD = value | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.11012) THEN ! Wind speed at 10 m | + | |
| - | IF (FF.EQ.rvind) THEN | + | |
| - | FF = value | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.11002) THEN ! Wind speed | + | |
| IF (FF.EQ.rvind) THEN | IF (FF.EQ.rvind) THEN | ||
| FF = value | FF = value | ||
| Line 1380: | Line 1714: | ||
| ELSE IF (desc.EQ.11043) THEN ! Maximum wind gust direction | ELSE IF (desc.EQ.11043) THEN ! Maximum wind gust direction | ||
| C DG is treated same way as FG | C DG is treated same way as FG | ||
| - | IF (value.NE.rvind | + | IF (minute_p.NE.rvind .AND. hour.NE.rvind) THEN |
| - | | + | |
| mm = NINT(minute_p) | mm = NINT(minute_p) | ||
| hh = NINT(hour) | hh = NINT(hour) | ||
| Line 1399: | Line 1732: | ||
| END IF | END IF | ||
| ELSE IF (desc.EQ.11041) THEN ! Maximum wind gust speed | ELSE IF (desc.EQ.11041) THEN ! Maximum wind gust speed | ||
| - | IF (value.NE.rvind | + | IF (minute_p.NE.rvind .AND. hour.NE.rvind) THEN |
| - | | + | |
| mm = NINT(minute_p) | mm = NINT(minute_p) | ||
| hh = NINT(hour) | hh = NINT(hour) | ||
| Line 1423: | Line 1755: | ||
| END IF | END IF | ||
| ELSE IF (desc.EQ.11042) THEN ! Maximum wind speed (10-min mean wind) | ELSE IF (desc.EQ.11042) THEN ! Maximum wind speed (10-min mean wind) | ||
| - | IF (value.NE.rvind | + | IF (minute_p.NE.rvind .AND. hour.NE.rvind) THEN |
| - | | + | |
| C FX is " | C FX is " | ||
| C | C | ||
| Line 1441: | Line 1772: | ||
| END IF | END IF | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.12104) THEN ! Dry bulb temperature at 2m (data width 16 bits) | + | ELSE IF (desc.EQ.12104.OR. ! Dry bulb temperature at 2m (data width 16 bits) |
| + | | ||
| + | | ||
| + | | ||
| IF (TA.EQ.rvind) THEN | IF (TA.EQ.rvind) THEN | ||
| TA = value | TA = value | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.12004) THEN ! Dry bulb temperature at 2m (12 bits) | + | ELSE IF (desc.EQ.12106.OR. |
| - | IF (TA.EQ.rvind) THEN | + | + desc.EQ.12006.OR. |
| - | TA = value | + | + desc.EQ.12103.OR. |
| - | END IF | + | + desc.EQ.12003) THEN ! Dew-point temperature (12 bits) |
| - | ELSE IF (desc.EQ.12101) THEN ! Temperature/ | + | |
| - | IF (TA.EQ.rvind) THEN | + | |
| - | TA = value | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.12001) THEN ! Temperature/ | + | |
| - | IF (TA.EQ.rvind) THEN | + | |
| - | TA = value | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.12106) THEN ! Dew-point temperature | + | |
| IF (TD.EQ.rvind) THEN | IF (TD.EQ.rvind) THEN | ||
| TD = value | TD = value | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.12006) THEN ! Dew-point | + | ELSE IF (desc.EQ.12113.OR. |
| - | IF (TD.EQ.rvind) THEN | + | + desc.EQ.12013) THEN ! Ground minimum temperature at 2m (12 bits) |
| - | TD = value | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.12103) THEN ! Dew-point temperature (16 bits) | + | |
| - | IF (TD.EQ.rvind) THEN | + | |
| - | TD = value | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.12003) THEN ! Dew-point temperature (12 bits) | + | |
| - | IF (TD.EQ.rvind) THEN | + | |
| - | TD = value | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.12113) THEN ! Ground minimum temperature at 2m (data width 16 bits) | + | |
| IF (TGN_12.EQ.rvind) THEN | IF (TGN_12.EQ.rvind) THEN | ||
| | | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.12013) THEN ! Ground minimum temperature at 2m (12 bits) | + | ELSE IF (desc.EQ.12114.OR. ! Maximum temperature at 2m, past 12 hours (16 bits) |
| - | IF (TGN_12.EQ.rvind) THEN | + | + desc.EQ.12014) THEN ! Maximum temperature at 2m, past 12 hours (12 bits) |
| - | | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.12114) THEN ! Maximum temperature at 2m, past 12 hours (16 bits) | + | |
| - | IF (TAX_12.EQ.rvind) THEN | + | |
| - | | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.12014) THEN ! Maximum temperature at 2m, past 12 hours (12 bits) | + | |
| IF (TAX_12.EQ.rvind) THEN | IF (TAX_12.EQ.rvind) THEN | ||
| | | ||
| Line 1501: | Line 1808: | ||
| END IF | END IF | ||
| C Do we also need to consider 12021 ' | C Do we also need to consider 12021 ' | ||
| - | ELSE IF (desc.EQ.12115) THEN ! Minimum temperature at 2m, past 12 hours (16 bits) | + | ELSE IF (desc.EQ.12115.OR. |
| - | IF (TAN_12.EQ.rvind) THEN | + | + desc.EQ.12015) THEN ! Minimum temperature at 2m, past 12 hours (12 bits) |
| - | | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.12015) THEN ! Minimum temperature at 2m, past 12 hours (12 bits) | + | |
| IF (TAN_12.EQ.rvind) THEN | IF (TAN_12.EQ.rvind) THEN | ||
| | | ||
| Line 1549: | Line 1853: | ||
| C | C | ||
| C type, according to all WMO recommended templates | C type, according to all WMO recommended templates | ||
| + | C (but DNMI metar is an exception!) | ||
| IF (ktdexp(idx - 1).EQ.20012) THEN | IF (ktdexp(idx - 1).EQ.20012) THEN | ||
| IF (NINT(value).LE.4) THEN | IF (NINT(value).LE.4) THEN | ||
| Line 1567: | Line 1872: | ||
| | | ||
| IF (cloud_layer.LE.num_cloud_layers) THEN | IF (cloud_layer.LE.num_cloud_layers) THEN | ||
| - | | + | vert_sign(cloud_layer) = value |
| - | vert_sign(cloud_layer) = value | + | |
| - | END IF | + | |
| END IF | END IF | ||
| ELSE ! rdb-files always have 0 or 4 cloud layers | ELSE ! rdb-files always have 0 or 4 cloud layers | ||
| | | ||
| IF (cloud_layer.LT.5) THEN | IF (cloud_layer.LT.5) THEN | ||
| - | | + | vert_sign(cloud_layer) = value |
| - | vert_sign(cloud_layer) = value | + | |
| - | END IF | + | |
| END IF | END IF | ||
| END IF | END IF | ||
| ELSE IF (desc.EQ.20011 .AND. .NOT.bad_cloud_data) THEN ! Cloud amount | ELSE IF (desc.EQ.20011 .AND. .NOT.bad_cloud_data) THEN ! Cloud amount | ||
| - | IF (cloud_type_count.EQ.0) THEN ! First occurrence | + | |
| + | IF (num_cloud_layers.GT.-1) THEN | ||
| + | num_cloud_layers = num_cloud_layers + 1 | ||
| + | | ||
| + | num_cloud_layers = 1 | ||
| + | END IF | ||
| + | | ||
| + | ELSE IF (cloud_type_count.EQ.0) THEN ! First occurrence | ||
| IF (NH.EQ.rvind) THEN | IF (NH.EQ.rvind) THEN | ||
| NH = value | NH = value | ||
| Line 1590: | Line 1898: | ||
| | | ||
| IF (cloud_layer.LE.num_cloud_layers) THEN | IF (cloud_layer.LE.num_cloud_layers) THEN | ||
| - | | + | NS(cloud_layer) = value |
| - | NS(cloud_layer) = value | + | |
| - | END IF | + | |
| END IF | END IF | ||
| ELSE ! rdb-files always have 0 or 4 cloud layers | ELSE ! rdb-files always have 0 or 4 cloud layers | ||
| | | ||
| IF (cloud_layer.LT.5) THEN | IF (cloud_layer.LT.5) THEN | ||
| - | | + | NS(cloud_layer) = value |
| - | NS(cloud_layer) = value | + | |
| - | END IF | + | |
| END IF | END IF | ||
| END IF | END IF | ||
| ELSE IF (desc.EQ.20012 .AND. .NOT.bad_cloud_data) THEN ! Cloud type | ELSE IF (desc.EQ.20012 .AND. .NOT.bad_cloud_data) THEN ! Cloud type | ||
| - | cloud_type_count = cloud_type_count + 1 | + | |
| - | IF (cloud_type_count.GT.3) THEN | + | |
| - | | + | ELSE |
| - | | + | cloud_type_count = cloud_type_count + 1 |
| - | IF (cloud_layer.LE.num_cloud_layers) THEN | + | |
| - | IF (value.NE.rvind) THEN | + | cloud_layer = cloud_type_count - 3 |
| + | IF (num_cloud_layers .GT.-1) THEN | ||
| + | | ||
| + | | ||
| CC(cloud_layer) = value | CC(cloud_layer) = value | ||
| END IF | END IF | ||
| - | | + | ELSE IF (cloud_layer.LT.5) THEN ! rdb-files always have 0 or 4 cloud layers |
| - | ELSE IF (cloud_layer.LT.5) THEN ! rdb-files always have 0 or 4 cloud layers | + | |
| - | IF (value.NE.rvind) THEN | + | |
| | | ||
| END IF | END IF | ||
| - | END IF | + | |
| - | | + | IF (cloud_type_count.EQ.1) THEN |
| - | | + | |
| - | IF (CL.EQ.rvind) THEN | + | CL = value |
| - | | + | |
| - | END IF | + | ELSE IF (cloud_type_count.EQ.2) THEN |
| - | | + | |
| - | IF (CM.EQ.rvind) THEN | + | CM = value |
| - | | + | |
| - | END IF | + | ELSE IF (cloud_type_count.EQ.3) THEN |
| - | | + | |
| - | IF (CH.EQ.rvind) THEN | + | CH = value |
| - | | + | END IF |
| END IF | END IF | ||
| END IF | END IF | ||
| END IF | END IF | ||
| ELSE IF (desc.EQ.20013 .AND. .NOT.bad_cloud_data) THEN ! Height of base of cloud | ELSE IF (desc.EQ.20013 .AND. .NOT.bad_cloud_data) THEN ! Height of base of cloud | ||
| - | IF (cloud_type_count.EQ.0) THEN ! First occurrence | + | |
| + | | ||
| + | ELSE IF (cloud_type_count.EQ.0) THEN ! First occurrence | ||
| IF (HL.EQ.rvind) THEN | IF (HL.EQ.rvind) THEN | ||
| HL = value | HL = value | ||
| Line 1646: | Line 1953: | ||
| | | ||
| IF (cloud_layer.LE.num_cloud_layers) THEN | IF (cloud_layer.LE.num_cloud_layers) THEN | ||
| - | | + | HS(cloud_layer) = value |
| - | HS(cloud_layer) = value | + | |
| - | END IF | + | |
| END IF | END IF | ||
| ELSE ! rdb-files always have 0 or 4 cloud layers | ELSE ! rdb-files always have 0 or 4 cloud layers | ||
| - | IF (value.NE.rvind) THEN | + | |
| - | | + | |
| - | IF (cloud_layer.LT.5) THEN | + | HS(cloud_layer) = value |
| - | IF (value.NE.rvind) THEN | + | |
| - | | + | |
| - | END IF | + | |
| - | END IF | + | |
| END IF | END IF | ||
| END IF | END IF | ||
| Line 1696: | Line 1997: | ||
| END IF | END IF | ||
| ELSE IF (desc.EQ.13013) THEN ! Total snow depth | ELSE IF (desc.EQ.13013) THEN ! Total snow depth | ||
| - | IF (value.NE.rvind) THEN | ||
| C | C | ||
| - | C E < 10, which probably means that 20062 has been wrongly encoded, not 13013 | + | C EE < 10, which probably means that 20062 has been wrongly encoded, not 13013 |
| - | | + | SA = value |
| + | ELSE IF (desc.EQ.20062) THEN ! State of the ground (with or without snow) | ||
| + | IF (EE.EQ.rvind) THEN | ||
| + | | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.20062) THEN ! State of the ground (with or without snow) | + | |
| - | IF (value.NE.rvind) THEN | + | |
| - | IF (NINT(value).LE.10) THEN ! E in TAC (3Ejjj) | + | END IF |
| - | E = value | + | C |
| - | IF (SA.EQ.rvind) THEN | + | C SS_24 is encoded in kvalobs for Norwegian avalanche stations (and |
| - | | + | C we have no better kvalobs parameter for depth of fresh snow anyway) |
| - | END IF | + | ELSE IF (desc.EQ.13012) THEN ! Depth of fresh snow |
| - | | + | IF (SS_24.EQ.rvind) THEN |
| - | | + | SS_24 = value |
| - | END IF | + | |
| END IF | END IF | ||
| ELSE IF (desc.EQ.14031) THEN ! Total sunshine | ELSE IF (desc.EQ.14031) THEN ! Total sunshine | ||
| Line 1792: | Line 2094: | ||
| IF (hhh.EQ.rvind) THEN | IF (hhh.EQ.rvind) THEN | ||
| hhh = value | hhh = value | ||
| - | END IF | ||
| - | ELSE IF (desc.EQ.10008) THEN ! Geopotential (20 bits) | ||
| - | IF (hhh.EQ.rvind) THEN | ||
| - | hhh = value * 9.8 | ||
| - | END IF | ||
| - | ELSE IF (desc.EQ.10003) THEN ! Geopotential (17 bits) | ||
| - | IF (hhh.EQ.rvind) THEN | ||
| - | hhh = value * 9.8 | ||
| END IF | END IF | ||
| C | C | ||
| ELSE IF (desc.EQ.1011) THEN ! Ship or mobile land station identifier | ELSE IF (desc.EQ.1011) THEN ! Ship or mobile land station identifier | ||
| - | | + | cidx = int(value/ |
| - | cidx = int(value/ | + | IF (cidx.GT.0) THEN |
| - | | + | |
| - | call_sign = cvals(cidx) ! CCITTIA5 data | + | |
| - | call_sign = ctrim(call_sign, | + | |
| - | END IF | + | |
| END IF | END IF | ||
| ELSE IF (desc.EQ.1012) THEN ! Direction of motion of moving observing platform | ELSE IF (desc.EQ.1012) THEN ! Direction of motion of moving observing platform | ||
| Line 1819: | Line 2111: | ||
| END IF | END IF | ||
| ELSE IF (desc.EQ.7062) THEN ! Depth below sea/water surface | ELSE IF (desc.EQ.7062) THEN ! Depth below sea/water surface | ||
| - | IF (value.NE.rvind) THEN | ||
| C Some buoy reports starts with depth 1.5 m, others starts with 0 m | C Some buoy reports starts with depth 1.5 m, others starts with 0 m | ||
| C then 1.5 m and always have same sea/water temperature for these 2 | C then 1.5 m and always have same sea/water temperature for these 2 | ||
| C | C | ||
| - | IF (value.LT.1.6) THEN | + | |
| - | surface_data = .TRUE. | + | |
| - | | + | ELSE |
| - | surface_data = .FALSE. | + | |
| - | END IF | + | |
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.22043) | + | ELSE IF (desc.EQ.22043.OR. ! Sea/water temperature (15 bits) |
| + | | ||
| + | | ||
| IF (TW.EQ.rvind .AND. surface_data)THEN | IF (TW.EQ.rvind .AND. surface_data)THEN | ||
| TW = value | TW = value | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.22042) THEN ! Sea/ | + | ELSE IF (desc.EQ.12102.OR. |
| - | IF (TW.EQ.rvind | + | |
| - | | + | |
| - | TW = value | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.12102) THEN ! Wet-bulb temperature (16 bits) | + | |
| IF (TbTbTb.EQ.rvind) THEN | IF (TbTbTb.EQ.rvind) THEN | ||
| | | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.12005) THEN ! Wet-bulb temperature | + | ELSE IF (desc.EQ.22011) THEN ! |
| - | IF (TbTbTb.EQ.rvind) THEN | + | IF (PWA.EQ.rvind) THEN |
| - | TbTbTb | + | PWA = value |
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.22011) THEN ! Period of waves (BUFR doesn' | + | ELSE IF (desc.EQ.22012) THEN ! Period of wind waves (visually measured) |
| IF (PW.EQ.rvind) THEN | IF (PW.EQ.rvind) THEN | ||
| PW = value | PW = value | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.22021) THEN ! Heigth of waves (BUFR doesn' | + | ELSE IF (desc.EQ.22021) THEN ! Heigth of waves |
| + | IF (HWA.EQ.rvind) THEN | ||
| + | HWA = value | ||
| + | END IF | ||
| + | ELSE IF (desc.EQ.22022) THEN ! Heigth of wind waves | ||
| IF (HW.EQ.rvind) THEN | IF (HW.EQ.rvind) THEN | ||
| HW = value | HW = value | ||
| END IF | END IF | ||
| ELSE IF (desc.EQ.22003) THEN ! Direction of swell waves | ELSE IF (desc.EQ.22003) THEN ! Direction of swell waves | ||
| - | | + | IF (DW1.EQ.rvind) THEN |
| - | IF (DW1.EQ.rvind) THEN | + | |
| - | DW1 = value | + | ELSE |
| - | | + | |
| - | DW2 = value | + | |
| - | END IF | + | |
| END IF | END IF | ||
| ELSE IF (desc.EQ.22013) THEN ! Period of swell waves | ELSE IF (desc.EQ.22013) THEN ! Period of swell waves | ||
| - | | + | IF (PW1.EQ.rvind) THEN |
| - | IF (PW1.EQ.rvind) THEN | + | |
| - | PW1 = value | + | ELSE |
| - | | + | |
| - | PW2 = value | + | |
| - | END IF | + | |
| END IF | END IF | ||
| ELSE IF (desc.EQ.22023) THEN ! Height of swell waves | ELSE IF (desc.EQ.22023) THEN ! Height of swell waves | ||
| - | | + | IF (HW1.EQ.rvind) THEN |
| - | IF (HW1.EQ.rvind) THEN | + | |
| - | HW1 = value | + | ELSE |
| - | | + | |
| - | HW2 = value | + | |
| - | END IF | + | |
| END IF | END IF | ||
| ELSE IF (desc.EQ.22061) THEN ! State of the sea | ELSE IF (desc.EQ.22061) THEN ! State of the sea | ||
| Line 1915: | Line 2201: | ||
| END IF | END IF | ||
| ELSE IF (desc.EQ.1005) THEN ! Buoy/ | ELSE IF (desc.EQ.1005) THEN ! Buoy/ | ||
| - | IF (buoy_id.EQ.rvind) THEN | + | IF (buoy_id5.EQ.rvind) THEN |
| - | buoy_id | + | buoy_id5 |
| END IF | END IF | ||
| ELSE IF (desc.EQ.1003) THEN ! WMO region number/ | ELSE IF (desc.EQ.1003) THEN ! WMO region number/ | ||
| Line 1925: | Line 2211: | ||
| IF (wmo_region_subarea.EQ.rvind) THEN | IF (wmo_region_subarea.EQ.rvind) THEN | ||
| | | ||
| + | END IF | ||
| + | ELSE IF (desc.EQ.1087) THEN ! WMO Marine observing platform extended identifier | ||
| + | IF (buoy_id7.EQ.rvind) THEN | ||
| + | | ||
| END IF | END IF | ||
| C | C | ||
| ELSE IF (desc.EQ.1063) THEN ! ICAO location indicator | ELSE IF (desc.EQ.1063) THEN ! ICAO location indicator | ||
| - | | + | cidx = int(value/ |
| - | cidx = int(value/ | + | icao_id = cvals(cidx) ! CCITTIA5 data |
| - | IF (cvals(cidx).NE.spc8) THEN | + | icao_id = ctrim(icao_id, |
| - | | + | |
| - | icao_id = ctrim(icao_id, | + | |
| - | END IF | + | |
| - | END IF | + | |
| ELSE IF (desc.EQ.10052) THEN ! Altimeter setting (QNH) | ELSE IF (desc.EQ.10052) THEN ! Altimeter setting (QNH) | ||
| IF (PH.EQ.rvind) THEN | IF (PH.EQ.rvind) THEN | ||
| Line 1948: | Line 2234: | ||
| END IF | END IF | ||
| - | WRITE(*,*) | ||
| IF (II.NE.rvind .AND. iii.NE.rvind) THEN | IF (II.NE.rvind .AND. iii.NE.rvind) THEN | ||
| + | | ||
| | | ||
| + | ELSE IF (wigos_series.NE.rvind .AND. wigos_issuer.NE.missing5 | ||
| + | | ||
| + | | ||
| + | ind = index(wigos_issuer,' | ||
| + | IF (ind.EQ.-1) ind = 5 | ||
| + | ind2 = index(wigos_issueno,' | ||
| + | IF (ind2.EQ.-1) ind2 = 5 | ||
| + | ind3 = index(wigos_localid,' | ||
| + | IF (ind3.EQ.-1) ind3 = 16 | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| ELSE IF (state_id.NE.rvind .AND. national_number.NE.rvind) THEN | ELSE IF (state_id.NE.rvind .AND. national_number.NE.rvind) THEN | ||
| + | | ||
| | | ||
| | | ||
| Line 1962: | Line 2264: | ||
| ind = ind - 1 | ind = ind - 1 | ||
| END DO | END DO | ||
| + | | ||
| | | ||
| | | ||
| - | ELSE IF (buoy_id.NE.rvind.AND.wmo_region_number.NE.rvind | + | ELSE IF (buoy_id7.NE.rvind) THEN |
| - | + .AND.wmo_region_subarea.NE.rvind) THEN | + | C New templates introduced in 2014 for data category 1 use 001087 |
| - | | + | C |
| - | + + NINT(wmo_region_subarea)*1000 + NINT(buoy_id) | + | |
| - | | + | |
| + | ELSE IF (buoy_id5.NE.rvind) THEN | ||
| + | WRITE(*,*) | ||
| + | | ||
| + | | ||
| C Old drau files (wrongly) includes wmo_region_number and | C Old drau files (wrongly) includes wmo_region_number and | ||
| - | C | + | C |
| - | | + | C |
| + | WRITE(*,' | ||
| + | ELSE IF (wmo_region_number.EQ.rvind | ||
| + | | ||
| + | C Some BUFR BUOYS on GTS have ' | ||
| + | C but not for wmo_region_subarea | ||
| + | WRITE(*,' | ||
| + | | ||
| + | ELSE IF (wmo_region_number.NE.rvind | ||
| + | | ||
| + | C Not easy to know how to display this case, but then I have never | ||
| + | C seen this in practice | ||
| + | | ||
| + | ELSE IF (buoy_id5.GT.10000.AND. | ||
| + | | ||
| + | | ||
| + | | ||
| + | C If first 2 digits of 5 digit buoy_id | ||
| + | C | ||
| + | C | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | END IF | ||
| ELSE | ELSE | ||
| IF (verbose .GT. 1) THEN | IF (verbose .GT. 1) THEN | ||
| - | WRITE(*,*) 'Both wmonr, nationalnr, call_sign | + | |
| - | | + | |
| + | | ||
| C | C | ||
| C | C | ||
| Line 2002: | Line 2336: | ||
| | | ||
| END IF | END IF | ||
| - | IF (NINT(ix).EQ.0) THEN | + | |
| - | | + | IF (NINT(ix).EQ.0) THEN |
| - | ELSE IF (NINT(ix).EQ.1) THEN | + | WRITE(*,' |
| - | | + | |
| - | ELSE IF (NINT(ix).EQ.2) THEN | + | WRITE(*,' |
| - | | + | |
| + | WRITE(*,' | ||
| + | END IF | ||
| END IF | END IF | ||
| IF (longitude.NE.rvind) THEN | IF (longitude.NE.rvind) THEN | ||
| Line 2018: | Line 2354: | ||
| ! so display as integer | ! so display as integer | ||
| | | ||
| + | END IF | ||
| + | IF (hp.NE.rvind) THEN | ||
| + | | ||
| END IF | END IF | ||
| IF (vs.NE.rvind) THEN | IF (vs.NE.rvind) THEN | ||
| Line 2024: | Line 2363: | ||
| IF (ds.NE.rvind) THEN | IF (ds.NE.rvind) THEN | ||
| | | ||
| + | END IF | ||
| + | IF (a3.NE.rvind) THEN ! Standard isobaric surface for which the | ||
| + | ! geopotential is reported, no Kvalobs code exists | ||
| + | | ||
| END IF | END IF | ||
| IF (hhh.NE.rvind) THEN ! Geopotential height, no Kvalobs code exists | IF (hhh.NE.rvind) THEN ! Geopotential height, no Kvalobs code exists | ||
| Line 2112: | Line 2455: | ||
| | | ||
| END IF | END IF | ||
| - | C Precipitation = -0.1 means "trace" | + | C Use the BUFR some special values for precipitation, |
| - | C represented | + | C |
| + | C showed | ||
| IF (RR_24.NE.rvind) THEN | IF (RR_24.NE.rvind) THEN | ||
| - | IF (NINT(RR_24*10).EQ.-1) THEN | + | |
| - | WRITE(*,' | + | |
| - | | + | |
| - | | + | |
| - | END IF | + | |
| END IF | END IF | ||
| IF (RR_12.NE.rvind) THEN | IF (RR_12.NE.rvind) THEN | ||
| - | IF (NINT(RR_12*10).EQ.-1) THEN | + | |
| - | WRITE(*,' | + | |
| - | | + | |
| - | | + | |
| - | END IF | + | |
| END IF | END IF | ||
| IF (RR_6.NE.rvind) THEN | IF (RR_6.NE.rvind) THEN | ||
| - | IF (NINT(RR_6*10).EQ.-1) THEN | + | |
| - | WRITE(*,' | + | |
| - | | + | |
| - | | + | |
| - | END IF | + | |
| END IF | END IF | ||
| IF (RR_3.NE.rvind) THEN | IF (RR_3.NE.rvind) THEN | ||
| - | IF (NINT(RR_3*10).EQ.-1) THEN | + | |
| - | WRITE(*,' | + | |
| - | | + | |
| - | | + | |
| - | END IF | + | |
| END IF | END IF | ||
| IF (RR_1.NE.rvind) THEN | IF (RR_1.NE.rvind) THEN | ||
| - | IF (NINT(RR_1*10).EQ.-1) THEN | + | |
| - | WRITE(*,' | + | |
| - | | + | |
| - | | + | |
| - | END IF | + | |
| END IF | END IF | ||
| IF (WW.NE.rvind.AND.WW.LT.200) THEN ! 508-511 and w1w1 (in 333 9 group) ignored here | IF (WW.NE.rvind.AND.WW.LT.200) THEN ! 508-511 and w1w1 (in 333 9 group) ignored here | ||
| Line 2170: | Line 2494: | ||
| END IF | END IF | ||
| END IF | END IF | ||
| - | IF (E.NE.rvind) THEN | + | IF (EE.NE.rvind) THEN |
| - | | + | |
| END IF | END IF | ||
| - | IF (EM.NE.rvind) THEN | + | C Use the BUFR some special values |
| - | | + | C So ' |
| - | END IF | + | |
| - | C SA has some special values | + | |
| C Note that conversion from synop to BUFR normally will set SA=0 if E < 10 | C Note that conversion from synop to BUFR normally will set SA=0 if E < 10 | ||
| - | c$$$ IF (E.NE.rvind .AND. NINT(E).LE.10 | ||
| - | c$$$ | ||
| - | c$$$ | ||
| IF (SA.NE.rvind) THEN | IF (SA.NE.rvind) THEN | ||
| - | IF (NINT(SA*100).EQ.-1) THEN ! Trace: less than 0.5 cm snow | + | |
| - | | + | END IF |
| - | ELSE IF (NINT(SA*100).EQ.-2) THEN ! Snow cover not continuos | + | IF (SS_24.NE.rvind) THEN |
| - | | + | |
| - | ELSE IF (NINT(SA*100).EQ.0) THEN ! 0 snow coded as -1 in Kvalobs. Stupid but true | + | |
| - | WRITE(*,' | + | |
| - | ELSE | + | |
| - | | + | |
| - | END IF | + | |
| END IF | END IF | ||
| IF (VV.NE.rvind) THEN | IF (VV.NE.rvind) THEN | ||
| Line 2224: | Line 2538: | ||
| DO i=1, | DO i=1, | ||
| IF (NS(i).NE.rvind) THEN | IF (NS(i).NE.rvind) THEN | ||
| - | WRITE(*,' | + | WRITE(*,' |
| END IF | END IF | ||
| IF (CC(i).NE.rvind) THEN | IF (CC(i).NE.rvind) THEN | ||
| Line 2230: | Line 2544: | ||
| END IF | END IF | ||
| IF (HS(i).NE.rvind) THEN | IF (HS(i).NE.rvind) THEN | ||
| - | WRITE(*,' | + | WRITE(*,' |
| END IF | END IF | ||
| END DO | END DO | ||
| IF (SG.NE.rvind) THEN | IF (SG.NE.rvind) THEN | ||
| | | ||
| + | END IF | ||
| + | IF (PWA.NE.rvind) THEN | ||
| + | | ||
| END IF | END IF | ||
| IF (PW.NE.rvind) THEN | IF (PW.NE.rvind) THEN | ||
| | | ||
| + | END IF | ||
| + | IF (HWA.NE.rvind) THEN | ||
| + | | ||
| END IF | END IF | ||
| IF (HW.NE.rvind) THEN | IF (HW.NE.rvind) THEN | ||
| Line 2366: | Line 2686: | ||
| REAL*8 value | REAL*8 value | ||
| REAL*8 d(maxlevel), | REAL*8 d(maxlevel), | ||
| + | REAL*8 w(maxlevel) | ||
| C | C | ||
| Line 2397: | Line 2718: | ||
| DO n=1, | DO n=1, | ||
| z(n) = rvind | z(n) = rvind | ||
| + | w(n) = rvind | ||
| T(n) = rvind | T(n) = rvind | ||
| s(n) = rvind | s(n) = rvind | ||
| Line 2435: | Line 2757: | ||
| | | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.5001) THEN ! Latitude (high accuracy) | + | ELSE IF (desc.EQ.5001.OR. ! Latitude (high accuracy) |
| + | | ||
| IF (latitude.EQ.rvind) THEN | IF (latitude.EQ.rvind) THEN | ||
| | | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.5002) THEN ! Latitude (coarse accuracy) | + | ELSE IF (desc.EQ.6001.OR. ! Longitude (high accuracy) |
| - | IF (latitude.EQ.rvind) THEN | + | + desc.EQ.6002) THEN ! Longitude (coarse accuracy) |
| - | | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.6001) THEN ! Longitude (high accuracy) | + | |
| - | IF (longitude.EQ.rvind) THEN | + | |
| - | | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.6002) THEN ! Longitude (coarse accuracy) | + | |
| IF (longitude.EQ.rvind) THEN | IF (longitude.EQ.rvind) THEN | ||
| | | ||
| Line 2462: | Line 2778: | ||
| n = n + 1 ! new level | n = n + 1 ! new level | ||
| IF (n.GT.maxlevel) THEN | IF (n.GT.maxlevel) THEN | ||
| + | n = maxlevel | ||
| | | ||
| GOTO 120 | GOTO 120 | ||
| END IF | END IF | ||
| z(n) = value | z(n) = value | ||
| - | ELSE IF (desc.EQ.22043) THEN ! Sea/water temperature (15 bits) | + | ELSE IF (desc.EQ.7065) THEN ! Water pressure |
| - | IF (n.GT.0) THEN | + | n = n + 1 ! new level |
| - | t(n) = value | + | IF (n.GT.maxlevel) THEN |
| - | ELSE IF (TW.EQ.rvind) THEN | + | n = maxlevel |
| - | TW = value | + | WRITE(*,*) 'Too many levels! Skipping rest of message' |
| + | GOTO 120 | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.22042) THEN ! Sea/water temperature (12 bits) | + | w(n) = value |
| - | IF (n.GT.0) THEN | + | ELSE IF (desc.EQ.22045.OR. |
| + | | ||
| + | | ||
| + | IF (n.GT.0 | ||
| t(n) = value | t(n) = value | ||
| - | ELSE IF (TW.EQ.rvind) THEN | + | ELSE IF (n.EQ.0 .AND. TW.EQ.rvind) THEN |
| TW = value | TW = value | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.22062) THEN ! Salinity [part per thousand] | + | ELSE IF (desc.EQ.22064.OR. |
| - | IF (n.GT.0) THEN | + | |
| + | IF (n.GT.0 | ||
| s(n) = value | s(n) = value | ||
| - | ELSE IF (sal.EQ.rvind) THEN | + | ELSE IF (n.EQ.0 .AND. sal.EQ.rvind) THEN |
| sal = value | sal = value | ||
| END IF | END IF | ||
| ELSE IF (desc.EQ.22004) THEN ! Direction of current | ELSE IF (desc.EQ.22004) THEN ! Direction of current | ||
| - | IF (n.GT.0) THEN | + | IF (n.GT.0 |
| d(n) = value | d(n) = value | ||
| - | ELSE IF (verbose.GT.1) THEN | + | ELSE IF (n.EQ.0 .AND. verbose.GT.1) THEN |
| WRITE(*,*) 'Find 22004 (dc) before first 7062 (zz)!' | WRITE(*,*) 'Find 22004 (dc) before first 7062 (zz)!' | ||
| END IF | END IF | ||
| ELSE IF (desc.EQ.22031) THEN ! Speed of current | ELSE IF (desc.EQ.22031) THEN ! Speed of current | ||
| - | IF (n.GT.0) THEN | + | IF (n.GT.0 |
| v(n) = value | v(n) = value | ||
| - | ELSE IF (verbose.GT.1) THEN | + | ELSE IF (n.EQ.0 .AND. verbose.GT.1) THEN |
| WRITE(*,*) 'Find 22031 (vc) before first 7062 (zz)!' | WRITE(*,*) 'Find 22031 (vc) before first 7062 (zz)!' | ||
| END IF | END IF | ||
| ELSE IF (desc.EQ.22062) THEN ! Salinity [part per thousand] | ELSE IF (desc.EQ.22062) THEN ! Salinity [part per thousand] | ||
| - | IF (n.GT.0) THEN | + | IF (n.GT.0 |
| s(n) = value | s(n) = value | ||
| - | ELSE IF (sal.EQ.rvind) THEN | + | ELSE IF (n.EQ.0 .AND. sal.EQ.rvind) THEN |
| sal = value | sal = value | ||
| END IF | END IF | ||
| Line 2529: | Line 2851: | ||
| END IF | END IF | ||
| ELSE IF (desc.EQ.1087) THEN ! WMO marine observing platform extended identifier | ELSE IF (desc.EQ.1087) THEN ! WMO marine observing platform extended identifier | ||
| - | IF (verbose | + | IF (buoy_id.EQ.rvind) THEN |
| - | WRITE(*,*) ' | + | buoy_id = value |
| END IF | END IF | ||
| - | RETURN | ||
| END IF | END IF | ||
| END DO | END DO | ||
| Line 2544: | Line 2865: | ||
| END IF | END IF | ||
| - | WRITE(*,*) | ||
| IF (buoy_id.NE.rvind.AND.wmo_region_number.NE.rvind | IF (buoy_id.NE.rvind.AND.wmo_region_number.NE.rvind | ||
| | | ||
| - | | + | WRITE(*, |
| - | | + | IF (buoy_id.LT.1000) THEN |
| + | | ||
| + | | ||
| + | | ||
| + | C This is an error in encoding. We choose to show buoy_id only (and | ||
| + | C in all cases I have seen of this error, first 2 digits of buoy_id | ||
| + | C is wmo_region_number and wmo_region_subarea respectively). | ||
| + | IF (buoy_id.LT.10000) THEN | ||
| + | | ||
| + | ELSE IF (buoy_id.LT.100000) THEN | ||
| + | | ||
| + | ELSE IF (buoy_id.LT.1000000) THEN | ||
| + | | ||
| + | ELSE | ||
| + | | ||
| + | END IF | ||
| + | END IF | ||
| ELSE IF (buoy_id.NE.rvind.AND.buoy_id.GT.1000) THEN | ELSE IF (buoy_id.NE.rvind.AND.buoy_id.GT.1000) THEN | ||
| C Old drau files (wrongly) includes wmo_region_number and | C Old drau files (wrongly) includes wmo_region_number and | ||
| C | C | ||
| - | | + | WRITE(*, |
| + | IF (buoy_id.LT.10000) THEN ! 001005 | ||
| + | | ||
| + | | ||
| + | WRITE(*,' | ||
| + | END IF | ||
| ELSE IF (call_sign.NE.missing9) THEN | ELSE IF (call_sign.NE.missing9) THEN | ||
| ind = index(call_sign,' | ind = index(call_sign,' | ||
| Line 2561: | Line 2902: | ||
| ind = ind - 1 | ind = ind - 1 | ||
| END DO | END DO | ||
| + | | ||
| | | ||
| | | ||
| ELSE | ELSE | ||
| IF (verbose .GT. 1) THEN | IF (verbose .GT. 1) THEN | ||
| + | WRITE(*,*) | ||
| WRITE(*,*) 'Both buoy_id and call_sign are missing!!!' | WRITE(*,*) 'Both buoy_id and call_sign are missing!!!' | ||
| END IF | END IF | ||
| Line 2606: | Line 2949: | ||
| C not quite uncommon) | C not quite uncommon) | ||
| IF (z(n).EQ.rvind .AND. t(n).EQ.rvind .AND. s(n).EQ.rvind | IF (z(n).EQ.rvind .AND. t(n).EQ.rvind .AND. s(n).EQ.rvind | ||
| - | | + | |
| + | | ||
| CYCLE | CYCLE | ||
| END IF | END IF | ||
| Line 2612: | Line 2956: | ||
| IF (z(n).NE.rvind) THEN | IF (z(n).NE.rvind) THEN | ||
| WRITE(*,' | WRITE(*,' | ||
| + | END IF | ||
| + | IF (w(n).NE.rvind) THEN | ||
| + | WRITE(*,' | ||
| END IF | END IF | ||
| IF (t(n).NE.rvind) THEN | IF (t(n).NE.rvind) THEN | ||
| Line 2648: | Line 2995: | ||
| PARAMETER (rvind=1.7E38) | PARAMETER (rvind=1.7E38) | ||
| - | CHARACTER*8 aircraft, | + | CHARACTER*8 aircraft, |
| C | C | ||
| REAL*8 DD, | REAL*8 DD, | ||
| C Other parameters | C Other parameters | ||
| | | ||
| - | | + | |
| CHARACTER*3 cphase, | CHARACTER*3 cphase, | ||
| INTEGER idx, | INTEGER idx, | ||
| Line 2674: | Line 3021: | ||
| WRITE(missing8,' | WRITE(missing8,' | ||
| | | ||
| - | spc8 = ' | ||
| C | C | ||
| Line 2695: | Line 3041: | ||
| flight_level = rvind | flight_level = rvind | ||
| phase = rvind | phase = rvind | ||
| + | mixing_ratio = rvind | ||
| C Loop through all expanded descriptors | C Loop through all expanded descriptors | ||
| Line 2709: | Line 3056: | ||
| IF (desc.EQ.1008) THEN ! Aircraft registration number or other identification | IF (desc.EQ.1008) THEN ! Aircraft registration number or other identification | ||
| cidx = int(value/ | cidx = int(value/ | ||
| - | | + | aircraft = cvals(cidx) ! CCITTIA5 data |
| - | aircraft = cvals(cidx) ! CCITTIA5 data | + | aircraft = ctrim(aircraft, |
| - | | + | |
| - | END IF | + | |
| ELSE IF (desc.EQ.1006) THEN ! Aircraft flight number | ELSE IF (desc.EQ.1006) THEN ! Aircraft flight number | ||
| cidx = int(value/ | cidx = int(value/ | ||
| - | | + | flight_number = cvals(cidx) ! CCITTIA5 data |
| - | flight_number = cvals(cidx) ! CCITTIA5 data | + | flight_number = ctrim(flight_number, |
| - | | + | |
| - | END IF | + | |
| ELSE IF (desc.EQ.1023) THEN ! Observation sequence number | ELSE IF (desc.EQ.1023) THEN ! Observation sequence number | ||
| IF (osn.EQ.rvind) osn = value | IF (osn.EQ.rvind) osn = value | ||
| Line 2745: | Line 3088: | ||
| | | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.5001) THEN ! Latitude (high accuracy) | + | ELSE IF (desc.EQ.5001.OR. ! Latitude (high accuracy) |
| + | | ||
| IF (latitude.EQ.rvind) THEN | IF (latitude.EQ.rvind) THEN | ||
| | | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.5002) THEN ! Latitude | + | ELSE IF (desc.EQ.6001.OR. |
| - | IF (latitude.EQ.rvind) THEN | + | + desc.EQ.6002) THEN ! Longitude (coarse |
| - | | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.6001) THEN ! Longitude (high accuracy) | + | |
| IF (longitude.EQ.rvind) THEN | IF (longitude.EQ.rvind) THEN | ||
| | | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.6002) THEN ! Longitude (coarse accuracy) | + | ELSE IF (desc.EQ.7010.OR. |
| - | IF (longitude.EQ.rvind) THEN | + | + desc.EQ.7002.OR. |
| - | | + | + desc.EQ.10070) THEN ! Indicated aircraft altitude |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.7010) THEN ! Flight level | + | |
| IF (flight_level.EQ.rvind) THEN | IF (flight_level.EQ.rvind) THEN | ||
| | | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.7002) THEN ! Height or altitude | + | ELSE IF (desc.EQ.8009.OR. ! Detailed phase of aircraft |
| - | IF (flight_level.EQ.rvind) THEN | + | + desc.EQ.8004) THEN ! Phase of aircraft flight |
| - | | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.10070) THEN ! Indicated | + | |
| - | IF (flight_level.EQ.rvind) THEN | + | |
| - | | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.8009) THEN ! Detailed phase of aircraft flight | + | |
| IF (phase.EQ.rvind) THEN | IF (phase.EQ.rvind) THEN | ||
| phase = value | phase = value | ||
| Line 2783: | Line 3115: | ||
| | | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.12104) THEN ! Dry bulb temperature at 2m (data width 16 bits) | + | ELSE IF (desc.EQ.12104.OR. ! Dry bulb temperature at 2m (data width 16 bits) |
| + | | ||
| + | | ||
| + | | ||
| IF (TT.EQ.rvind) THEN | IF (TT.EQ.rvind) THEN | ||
| TT = value | TT = value | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.12004) THEN ! Dry bulb temperature at 2m (12 bits) | + | ELSE IF (desc.EQ.11011.OR. ! Wind direction at 10 m |
| - | IF (TT.EQ.rvind) THEN | + | + desc.EQ.11001) THEN ! Wind direction |
| - | TT = value | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.12101) THEN ! Temperature/ | + | |
| - | IF (TT.EQ.rvind) THEN | + | |
| - | TT = value | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.12001) THEN ! Temperature/ | + | |
| - | IF (TT.EQ.rvind) THEN | + | |
| - | TT = value | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.11011) THEN ! Wind direction | + | |
| IF (DD.EQ.rvind) THEN | IF (DD.EQ.rvind) THEN | ||
| DD = value | DD = value | ||
| END IF | END IF | ||
| - | ELSE IF (desc.EQ.11001) THEN ! Wind direction | + | ELSE IF (desc.EQ.11012.OR. ! Wind speed at 10 m |
| - | IF (DD.EQ.rvind) THEN | + | + desc.EQ.11002) THEN ! Wind speed |
| - | DD = value | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.11012) THEN ! Wind speed at 10 m | + | |
| - | IF (FF.EQ.rvind) THEN | + | |
| - | FF = value | + | |
| - | END IF | + | |
| - | ELSE IF (desc.EQ.11002) THEN ! Wind speed | + | |
| IF (FF.EQ.rvind) THEN | IF (FF.EQ.rvind) THEN | ||
| FF = value | FF = value | ||
| Line 2818: | Line 3135: | ||
| IF (PP.EQ.rvind) THEN | IF (PP.EQ.rvind) THEN | ||
| PP = value | PP = value | ||
| + | END IF | ||
| + | ELSE IF (desc.EQ.13002) THEN ! Mixing ratio | ||
| + | IF (mixing_ratio.EQ.rvind) THEN | ||
| + | | ||
| END IF | END IF | ||
| END IF | END IF | ||
| Line 2828: | Line 3149: | ||
| END IF | END IF | ||
| - | WRITE(*,*) | ||
| IF (aircraft.NE.missing8) THEN | IF (aircraft.NE.missing8) THEN | ||
| + | | ||
| | | ||
| ELSE IF (flight_number.NE.missing8) THEN | ELSE IF (flight_number.NE.missing8) THEN | ||
| + | | ||
| | | ||
| | | ||
| ELSE | ELSE | ||
| IF (verbose .GT. 1) THEN | IF (verbose .GT. 1) THEN | ||
| + | WRITE(*,*) | ||
| WRITE(*,*) ' | WRITE(*,*) ' | ||
| END IF | END IF | ||
| Line 2882: | Line 3205: | ||
| END IF | END IF | ||
| IF (PP.NE.rvind) THEN | IF (PP.NE.rvind) THEN | ||
| - | | + | |
| + | END IF | ||
| + | IF (mixing_ratio.NE.rvind) THEN | ||
| + | | ||
| END IF | END IF | ||
| Line 2953: | Line 3279: | ||
| | | ||
| ELSE | ELSE | ||
| - | | + | |
| END IF | END IF | ||
| RETURN | RETURN | ||
| END FUNCTION phase_8009 | END FUNCTION phase_8009 | ||
| - | |||
| - | C | ||
| - | |||
| - | C | ||
| - | INTEGER FUNCTION HStoWMO_HSHS(HS) | ||
| - | IMPLICIT NONE | ||
| - | REAL*8 HS | ||
| - | INTEGER HSHS | ||
| - | |||
| - | IF (NINT(HS).LT.1800) THEN | ||
| - | | ||
| - | ELSE IF (NINT(HS).LT.10500) THEN | ||
| - | | ||
| - | ELSE IF (NINT(HS).LE.21000) THEN | ||
| - | | ||
| - | ELSE | ||
| - | | ||
| - | END IF | ||
| - | |||
| - | HStoWMO_HSHS = HSHS | ||
| - | RETURN | ||
| - | END FUNCTION HStoWMO_HSHS | ||
| C | C | ||
| Line 3176: | Line 3480: | ||
| c | c | ||
| character*(*) text | character*(*) text | ||
| - | integer | + | integer |
| c | c | ||
| lt=len(text) | lt=len(text) | ||
| Line 3190: | Line 3494: | ||
| return | return | ||
| end | end | ||
| - | </ | + | </ |
| <code fortran comfilter.f> | <code fortran comfilter.f> | ||
| C (C) Copyright 2010, met.no | C (C) Copyright 2010, met.no | ||