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 [2016-09-16 13:43:40] 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 161: | 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 208: | 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 226: | 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 238: | 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 259: | Line 263: | ||
| IF (ksec1(6).GT.2 .AND. ksec1(6).NE.4 .AND. ksec1(6).NE.6 | IF (ksec1(6).GT.2 .AND. ksec1(6).NE.4 .AND. ksec1(6).NE.6 | ||
| | | ||
| + | |||
| + | 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 294: | 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 306: | 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 334: | 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 346: | 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 823: | 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=10000) | + | PARAMETER(maxlevel=100000) |
| REAL*8 P(maxlevel), | REAL*8 P(maxlevel), | ||
| Line 855: | 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 907: | Line 930: | ||
| | | ||
| | | ||
| + | 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 989: | 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 1218: | Line 1282: | ||
| 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 (call_sign.NE.missing9) THEN | ELSE IF (call_sign.NE.missing9) THEN | ||
| + | | ||
| | | ||
| ELSE | ELSE | ||
| IF (verbose .GT. 1) THEN | IF (verbose .GT. 1) THEN | ||
| + | WRITE(*,*) | ||
| WRITE(*,*) 'Both wmonr and call sign are missing!!!' | WRITE(*,*) 'Both wmonr and call sign are missing!!!' | ||
| END IF | END IF | ||
| Line 1287: | Line 1353: | ||
| SUBROUTINE print_surface_values(ksub, | SUBROUTINE print_surface_values(ksub, | ||
| - | | + | |
| C | C | ||
| IMPLICIT NONE | IMPLICIT NONE | ||
| Line 1298: | 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 1303: | 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 1315: | 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 1334: | 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 1349: | 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 1364: | Line 1437: | ||
| num_cloud_layers = -1 | num_cloud_layers = -1 | ||
| surface_data = .TRUE. | surface_data = .TRUE. | ||
| + | time_of_last_position = .FALSE. | ||
| C | C | ||
| Line 1370: | 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 1471: | 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 1528: | 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 1553: | 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 | ||
| Line 1758: | 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 1785: | 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 1804: | 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 (value < 10.0 ! Accept one digit values only | + | |
| - | | + | 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 1989: | 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 2011: | Line 2120: | ||
| END IF | END IF | ||
| ELSE IF (desc.EQ.22043.OR. | ELSE IF (desc.EQ.22043.OR. | ||
| - | | + | |
| + | | ||
| IF (TW.EQ.rvind .AND. surface_data)THEN | IF (TW.EQ.rvind .AND. surface_data)THEN | ||
| TW = value | TW = value | ||
| Line 2091: | 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 2103: | Line 2213: | ||
| 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 (buoy_id.EQ.rvind) THEN | + | IF (buoy_id7.EQ.rvind) THEN |
| - | buoy_id | + | buoy_id7 |
| 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 2126: | 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 2140: | 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 |
| + | C New templates introduced in 2014 for data category 1 use 001087 | ||
| + | C WMO Marine observing platform extended identifier, 7 digits | ||
| + | | ||
| + | | ||
| + | ELSE IF (buoy_id5.NE.rvind) THEN | ||
| + | | ||
| + | IF (wmo_region_number.EQ.rvind | ||
| + | | ||
| + | C Old drau files (wrongly) includes | ||
| + | C | ||
| + | C | ||
| + | WRITE(*,' | ||
| + | ELSE IF (wmo_region_number.EQ.rvind | ||
| | | ||
| - | | + | C Some BUFR BUOYS on GTS have ' |
| - | WRITE(*,' | + | 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 | ||
| + | WRITE(*,' | ||
| + | ELSE IF (buoy_id5.GT.10000.AND. | ||
| + | | ||
| + | | ||
| + | | ||
| + | C If first 2 digits of 5 digit buoy_id equals wmo_region_number and | ||
| + | C | ||
| + | C | ||
| + | | ||
| + | | ||
| + | | ||
| ELSE | ELSE | ||
| - | 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 | + | |
| - | WRITE(*,' | + | |
| - | ELSE IF (buoy_id.LT.100000) THEN | + | |
| - | | + | |
| - | ELSE IF (buoy_id.LT.1000000) THEN | + | |
| - | WRITE(*,' | + | |
| - | ELSE | + | |
| - | | + | |
| - | END IF | + | |
| - | END IF | + | |
| - | ELSE IF (buoy_id.NE.rvind.AND.buoy_id.GT.1000) THEN | + | |
| - | C Old drau files (wrongly) includes wmo_region_number and | + | |
| - | C wmo_region_subarea | + | |
| - | IF (buoy_id.LT.10000) THEN | + | |
| - | WRITE(*,' | + | |
| - | | + | |
| - | C New templates introduced in 2014 for data category 1 use 001087 | + | |
| - | C WMO Marine observing platform extended identifier, 7 digits | + | |
| - | WRITE(*,' | + | |
| END IF | 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 2730: | 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 | ||
| | | ||
| + | | ||
| IF (buoy_id.LT.1000) THEN | IF (buoy_id.LT.1000) THEN | ||
| WRITE(*,' | WRITE(*,' | ||
| Line 2753: | Line 2888: | ||
| C Old drau files (wrongly) includes wmo_region_number and | C Old drau files (wrongly) includes wmo_region_number and | ||
| C | C | ||
| + | | ||
| IF (buoy_id.LT.10000) THEN ! 001005 | IF (buoy_id.LT.10000) THEN ! 001005 | ||
| WRITE(*,' | WRITE(*,' | ||
| Line 2766: | 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 2857: | 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 2883: | Line 3021: | ||
| WRITE(missing8,' | WRITE(missing8,' | ||
| | | ||
| - | spc8 = ' | ||
| C | C | ||
| Line 2904: | 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 2918: | 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 3001: | 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 3011: | 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 3065: | 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 3351: | 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 | ||