Re: perl metar decoder -- parsing DIRmin/max wrong ?

NOTE: The decoders mailing list is no longer active. The list archives are made available for historical reasons.

David,

Yes, I know about the problem. The problem exists in bulletins that don't
use the = sign to seperate reports. The solution is to assume that bulletins
that don't use = only have one report. I scanned many raw reports and this
seems to be true, so I changed the code to:

<               @reports = split ( /\n/ ) ;
---
              #@reports = split ( /\n/ ) ;
              s#\n# #g ;
              next if( /\d{4,6}Z.*\d{4,6}Z/ ) ;
              $reports[ 0 ] = $_;

The new code is attached.  I'm also working on a newer version of the
decoder, it's in the ftp decoders directory. ie

metar2nc.new and metar.cdl.new

The pqact.conf entry needs to change \2:yy to \2:yyyy because it now uses
the century too.  The cdl is different, merges vars that have different
units into one.  ie wind knots, mph, and m/s are all store using winds
m/s.  Also, store all reports per station into one record.  Take a look, I
would appreciate any comments before it's released.

Robb...


On Tue, 2 Mar 2004, David Larson wrote:

Robb,

I've been chasing down a problem that seems to cause perfectly good
reports to be discarded by the perl metar decoder.  There is a comment
in the 2.4.4 decoder that reads "reports appended together wrongly", the
code in this area takes the first line as the report to process, and
discards the next line.

To walk through this, I'll refer to the following report:

132
SAUS80 KWBC 021800 RRD
METAR
K4BL 021745Z 12005KT 3SM BR OVC008 01/M01 RMK SLP143 NOSPECI 60011
     8/2// T00061006 10011 21017 51007

The decoder attempts to classify the report type ($rep_type on line 257
of metar2nc), in doing so, it classifies this report as a "SPECI" ...
which isn't what you'd expect by visual inspection of the report.
However, perl is doing the right thing given that it is asked to match
on #(METAR|SPECI) \d{4,6}Z?\n# which exists in the remarks of the report.

The solution is probably to bind the text to the start of the line with
a caret.  Seems to work pretty well so far.

I've changed the lines (257-263) in metar2nc-v2.4.4 from:

    if( s#(METAR|SPECI) \d{4,6}Z?\n## ) {
        $rep_type = $1 ;
    } elsif( s#(METAR|SPECI)\s*\n## ) {
        $rep_type = $1 ;
    } else {
        $rep_type = "METAR" ;
    }

To:

    if( s#^(METAR|SPECI) \d{4,6}Z?\n## ) {
        $rep_type = $1 ;
    } elsif( s#^(METAR|SPECI)\s*\n## ) {
        $rep_type = $1 ;
    } else {
        $rep_type = "METAR" ;
    }

I simply added the caret (^) to bind the pattern to the start of the report.

Let me know what you think.
Dave


==============================================================================
Robb Kambic                                Unidata Program Center
Software Engineer III                      Univ. Corp for Atmospheric Research
rkambic@xxxxxxxxxxxxxxxx                   WWW: http://www.unidata.ucar.edu/
==============================================================================
  • 2004 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the decoders archives: