parse-remark ( str -- str' )


Vocabulary
metar.private

Inputs
stran object


Outputs
str'an object


Definition


: parse-remark ( str -- str' )
{
{ [ dup glossary key? ] [ glossary at ] }
{
[ dup R/ RH\/\d{1,3}/ matches? ]
[ parse-relative-humidity ]
}
{
[ dup R/ (\d+(\/\d+)?)V(\d+(\/\d+)?)/ matches? ]
[ parse-variable-visibility ]
}
{ [ dup R/ 1\d{4}/ matches? ] [ parse-6hr-max-temp ] }
{ [ dup R/ 2\d{4}/ matches? ] [ parse-6hr-min-temp ] }
{ [ dup R/ 4\d{8}/ matches? ] [ parse-24hr-temp ] }
{ [ dup R/ 4\/\d{3}/ matches? ] [ parse-snow-depth ] }
{ [ dup R/ 5\d{4}/ matches? ] [ parse-1hr-pressure ] }
{
[ dup R/ 6[\d\/]{4}/ matches? ]
[ parse-6hr-precipitation ]
}
{
[ dup R/ 7[\d\/]{4}/ matches? ]
[ parse-24hr-precipitation ]
}
{
[ dup R/ 8\/[\d\/]{3}/ matches? ]
[ parse-cloud-cover ]
}
{ [ dup R/ 931\d{3}/ matches? ] [ parse-6hr-snowfall ] }
{
[ dup R/ 933\d{3}/ matches? ]
[ parse-water-equivalent-snow ]
}
{
[ dup R/ 98\d{3}/ matches? ]
[ parse-duration-of-sunshine ]
}
{
[ dup R/ T[01]\d{3}([01]\d{3})?/ matches? ]
[ parse-1hr-temp ]
}
{
[ dup R/ \d{3}\d{2,3}\/\d{2,4}/ matches? ]
[ parse-peak-wind ]
}
{
[ dup R/ P[\d\/]{4}/ matches? ]
[ parse-1hr-precipitation ]
}
{
[ dup R/ SLP\d{3}/ matches? ]
[ parse-sea-level-pressure ]
}
{ [ dup R/ LTG\w+/ matches? ] [ parse-lightning ] }
{ [ dup R/ PROB\d+/ matches? ] [ parse-probability ] }
{ [ dup R/ \d{3}V\d{3}/ matches? ] [ parse-varying ] }
{
[ dup R/ [^-]+(-[^-]+)+/ matches? ]
[ parse-from-to ]
}
{ [ dup R/ [^\/]+(\/[^\/]+)+/ matches? ] [ ] }
{ [ dup R/ \d+.\d+/ matches? ] [ ] }
{
[ dup re-recent-weather matches? ]
[ parse-recent-weather ]
}
{ [ dup weather-group? ] [ parse-weather ] }
{
[ dup re-sky-condition matches? ]
[ parse-sky-condition ]
}
[ parse-glossary ]
} cond ;