sfws wrote:If anyone is interested, I have written in PHP 7 a METAR decoding script that takes into account all the 2017 changes
Since I wrote that quote, I changed my decoder to use "pow(base, value)" instead of "base ** value", and changed all my array declarations to use "x = array (value_list)" instead of "x =[value_list]", I made sure that I do not restrain type of return value in my user defined functions. As a result my scripts are now compatible with PHP versions from 5.4.0 to 7.1.12, but not earlier versions of PHP that do not support PHP constructs like "labels" as these are an essential part of my design. I have probably gone further than is reasonable in covering a wide range of possible METAR element combinations, including some misformed content, but my decoder still fails with some codes that either I don't understand, or fall into the "anything in plain English" specification. I don't intend to make my decoder work with PHP 7.2 because that is not compatible with my Windows Vista PC.
You can see this decoder in continuous use at http://www.komokaweather.com/metar/metar_display.php
and compare its output with the Saratoga version at http://www.komokaweather.ca/wxmetar.php
. I have tested my decoder against METAR issued by around 220 different aerodromes around the world. I developed a number of web pages that call my decoder. None of these are in the attached zip of the suite as they were all created to aid my testing and may not suit you. From perfecting the decoder and writing the different web pages I have learnt a lot about PHP, especially about using it with HTML forms and the advantages of using global variables and breaking a script up into lots of sub-functions. My final suite represents a complex mixture of approaches to the design because I wanted to try all possibilities; and it may be in-efficient because I am self-taught for all the web languages and do not have the expertise to improve that aspect.
I remain open to offers from anyone anywhere in the world to test out my decoder, especially if your nation uses content different to the WMO standard, because I was unable to reproduce all live environments on my own web server However, developing my decoder was a project in summer 2017 when I was too ill to do much else and, with the improvement in my health, I don't plan to do any more work on it (and actually I am rather fed up with it as it proved far more challenging than I expected)
EDIT - Small edits to last year's version, based on failing to decode remark group reports from use in Komoka. EDIT ends.
My decoding script is in 3 files (easier than a single file to maintain), one handles interface with calling web page and main aspects of working through the WMO specification, the second holds the sub-routines (or sub-functions) that do the nitty gritty, and the final one handles decoding the Remarks Group. There are thousands and thousands of lines of code because the traditional alphanuneric METAR are designed for trained humans to read, not for computers. Indeed, the WMO ststes it is impossible to write a computer programme than can decode any more than the basic METAR and that probably accounts for why I have not found any other decoder as ambitous as mine. To ensure I can decode almost all worldwide METAR my Remarks Group decoding script covers the most widely used codes (I call them Common) plus those relating specifically to Australia, Canada, New Zealand (including Antarctica), Italy, and USA . For USA I am decoding specifications in both Civil and Air Force handbooks as there are some differences. In case there is anybody with an interest in METAR, even if I cannnot impress you with my scripts, remember that ICAO and WMO are forcing abandonment of METAR format of traditional alphanumerical characters. They agreed it would be replaced with a new international XML style version mandatory from "ICAO Standards and Recommended Practices - Annex 3 Amendment 78 due November 2020", that will not be made directly available to pilots, let alone the public at large. So my script only has 3 years left for you to try it with the latest routine aviation weather reports whilst those reports are still available to the public!