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 [2014-10-21 08:44:10] 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> | ||
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(1: | ELSE IF (obstype(1: | ||
CALL print_sounding_values(ksub, | CALL print_sounding_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, | ||
Line 311: | Line 323: | ||
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(1: | ELSE IF (obstype(1: | ||
CALL print_sounding_values(ksub, | CALL print_sounding_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, | ||
Line 348: | Line 363: | ||
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 378: | Line 396: | ||
CHARACTER(LEN=200) argument ! Buffer for next argument | CHARACTER(LEN=200) argument ! Buffer for next argument | ||
CHARACTER(LEN=1350) Usage | CHARACTER(LEN=1350) Usage | ||
- | CHARACTER(LEN=900) Help | + | CHARACTER(LEN=950) Help |
INTEGER iargc,iarg | INTEGER iargc,iarg | ||
Line 441: | Line 459: | ||
| | ||
| | ||
+ | | ||
+ | | ||
| | ||
| | ||
Line 658: | Line 678: | ||
CLOSE(11) | CLOSE(11) | ||
+ | IF (verbose.GT.2) WRITE(*,*) ' | ||
IF (nfivlines.EQ.0) filter = .FALSE. | IF (nfivlines.EQ.0) filter = .FALSE. | ||
Line 733: | 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 768: | 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 789: | 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, | ||
| | ||
Line 811: | 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=4000) | + | PARAMETER(maxlevel=100000) |
REAL*8 P(maxlevel), | REAL*8 P(maxlevel), | ||
Line 843: | Line 869: | ||
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 = ' | 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 890: | 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 915: | 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.AND.n<maxlevel) 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.AND.n<maxlevel) 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 970: | 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 1054: | 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 1069: | 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 1074: | 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, | ||
Line 1086: | Line 1384: | ||
| | ||
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 1105: | 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, | ||
Line 1120: | 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 1135: | Line 1437: | ||
num_cloud_layers = -1 | num_cloud_layers = -1 | ||
surface_data = .TRUE. | surface_data = .TRUE. | ||
+ | time_of_last_position = .FALSE. | ||
C | C | ||
Line 1141: | 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 1232: | 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 1241: | 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 1298: | 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 1323: | 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 1382: | 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 1458: | 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 1518: | 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 1566: | 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 1593: | Line 1881: | ||
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 1612: | Line 1907: | ||
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 | + | |
+ | cloud_layer = cloud_type_count - 3 | ||
+ | IF (num_cloud_layers .GT.-1) THEN | ||
+ | | ||
+ | | ||
+ | CC(cloud_layer) = value | ||
+ | END IF | ||
+ | ELSE IF (cloud_layer.LT.5) THEN ! rdb-files always have 0 or 4 cloud layers | ||
| | ||
END IF | END IF | ||
- | | + | |
- | | + | IF (cloud_type_count.EQ.1) THEN |
- | END IF | + | |
- | ELSE | + | CL = value |
- | IF (cloud_type_count.EQ.1) THEN | + | |
- | IF (CL.EQ.rvind) THEN | + | ELSE IF (cloud_type_count.EQ.2) THEN |
- | | + | |
- | END IF | + | CM = value |
- | | + | |
- | IF (CM.EQ.rvind) THEN | + | ELSE IF (cloud_type_count.EQ.3) THEN |
- | | + | |
- | END IF | + | CH = value |
- | | + | END IF |
- | IF (CH.EQ.rvind) THEN | + | |
- | | + | |
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 1796: | Line 2098: | ||
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 (cvals(cidx).NE.spc9) THEN | + | IF (cidx.GT.0) THEN |
| | ||
| | ||
Line 1817: | Line 2119: | ||
| | ||
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/water temperature (12 bits) | + | ELSE IF (desc.EQ.12102.OR. ! Wet-bulb temperature (16 bits) |
- | IF (TW.EQ.rvind | + | + desc.EQ.12005) THEN ! Wet-bulb temperature (12 bits) |
- | | + | |
- | TW = value | + | |
- | END IF | + | |
- | ELSE IF (desc.EQ.12102) THEN ! Wet-bulb temperature (16 bits) | + | |
- | IF (TbTbTb.EQ.rvind) THEN | + | |
- | | + | |
- | END IF | + | |
- | ELSE IF (desc.EQ.12005) THEN ! Wet-bulb temperature (12 bits) | + | |
IF (TbTbTb.EQ.rvind) THEN | IF (TbTbTb.EQ.rvind) THEN | ||
| | ||
Line 1905: | 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 1915: | 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 |
- | icao_id = cvals(cidx) ! CCITTIA5 data | + | icao_id = ctrim(icao_id, |
- | | + | |
- | 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 1936: | 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 1950: | 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 2008: | 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 2337: | Line 2686: | ||
REAL*8 value | REAL*8 value | ||
REAL*8 d(maxlevel), | REAL*8 d(maxlevel), | ||
+ | REAL*8 w(maxlevel) | ||
C | C | ||
Line 2368: | 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 2406: | 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 2433: | 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 .AND. n.LE.maxlevel) THEN | + | n = n + 1 ! new level |
- | t(n) = value | + | IF (n.GT.maxlevel) THEN |
- | ELSE IF (n.EQ.0 .AND. 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 |
+ | ELSE IF (desc.EQ.22045.OR. | ||
+ | | ||
+ | | ||
IF (n.GT.0 .AND. n.LE.maxlevel) THEN | IF (n.GT.0 .AND. n.LE.maxlevel) THEN | ||
t(n) = value | t(n) = value | ||
Line 2449: | Line 2799: | ||
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 .AND. n.LE.maxlevel) THEN | IF (n.GT.0 .AND. n.LE.maxlevel) THEN | ||
s(n) = value | s(n) = value | ||
Line 2500: | 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 2515: | 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 2532: | 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 2577: | 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 2583: | 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 2619: | 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 2645: | Line 3021: | ||
WRITE(missing8,' | WRITE(missing8,' | ||
| | ||
- | spc8 = ' | ||
C | C | ||
Line 2666: | 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 2680: | 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 2716: | 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. ! Height or altitude |
- | | + | + desc.EQ.10070) THEN ! Indicated aircraft altitude |
- | END IF | + | |
- | ELSE IF (desc.EQ.7010) THEN ! Flight level | + | |
- | IF (flight_level.EQ.rvind) THEN | + | |
- | | + | |
- | END IF | + | |
- | ELSE IF (desc.EQ.7002) THEN ! Height or altitude | + | |
- | IF (flight_level.EQ.rvind) THEN | + | |
- | | + | |
- | END IF | + | |
- | ELSE IF (desc.EQ.10070) THEN ! Indicated aircraft altitude | + | |
IF (flight_level.EQ.rvind) THEN | IF (flight_level.EQ.rvind) THEN | ||
| | ||
END IF | END IF | ||
- | ELSE IF (desc.EQ.8009) THEN ! Detailed phase of aircraft flight | + | ELSE IF (desc.EQ.8009.OR. |
+ | | ||
IF (phase.EQ.rvind) THEN | IF (phase.EQ.rvind) THEN | ||
phase = value | phase = value | ||
Line 2754: | 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 2789: | 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 2799: | 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 2853: | 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 2924: | Line 3279: | ||
| | ||
ELSE | ELSE | ||
- | | + | |
END IF | END IF | ||
Line 3139: | 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 |