Please read the posts in the Announcements section about the current status of Cumulus development now that I have retired

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

Decoding METARS

Talk about the weather
User avatar
saratogaWX
Posts: 835
Joined: Wed May 06, 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows XP SP3
Location: Saratoga, CA, USA
Contact:

Re: Decoding METARS

Postby saratogaWX » Fri Sep 29, 2017 5:55 pm

Wow, thanks for the detailed report about the changes!

I'm interested in your PHP7 code if you're willing to share.

I will be updating the get-metar-conditions-inc.php script to accommodate the 2017 changes (and a couple of bug fixes that have emerged lately).

Thanks!

Best regards,
Ken

sfws
Posts: 344
Joined: Fri Jul 27, 2012 11:29 am
Weather Station: off-line Fine Offset plus others
Operating System: off-line Vista and W10 PCs
Location: UK

Re: Decoding METARS

Postby sfws » Sat Sep 30, 2017 8:55 pm

saratogaWX wrote:I'm interested in your PHP7 code if you're willing to share.

Shared (September 2017 version) with Ken by PM. I have a new version, but the changes relate to coping better with just a few foreign METAR which use RMK group or push the boundaries a bit (e.g. a colour state of 'BLU+')!

Although I cannot guarantee my script will always work, I have tested my script with around a thousand METAR, most are UK sourced, some are from North Sea rigs, some from European aerodromes nearby, and other examples have been taken from a wide selection of countries in all the continents. To test the standard international format a few of my test METAR have been made-up. Unlike many scripts found on-line, my script does attempt to cope with many malformed METARs I have encountered, and it does decode not just the mandatory key parts of a METAR report (that is all that the current version of Ken's script can handle) but also the more rarely used conditional elements. There is a Group within the METAR definition for general remarks. As the allowed content is set by each country and often is abbreviated plain text (not always in English) I can only decode a selection of the possible content there.

Any Canadians familiar with their METAR content can help me as I do not yet have ability to translate your two letter codes for cloud and general weather, (in RMK Group) nor understand your 'BBBB' system with RR?, CC?, AA? or P?? that appears before the Surface Wind Group.

The previous most comprehensive internationally-focussed METAR decoding option in a freely available source code was written (2002 to 2007) in JavaScript by Manuel Heras and is available at "http://www.heras-gilsanz.com/manuel/METAR-Decoder.html". North American use of Altimeter readings in "in Hg" instead of QNH in "hPa" and prevailing visibility in "statute miles" instead of "metres" was added to this script by Ricardo Fernández. This script is widely used on many commercial web sites (JavaScript is processed by a browser so your browser can therefore display it, and allow it to be downloaded) but that script does less than my script as it does not cope with malformed METAR entry, nor Colour State codes, and it excludes any RMK group decoding. Those unable to use PHP might want to use that script instead.
Last edited by sfws on Mon Oct 23, 2017 7:15 pm, edited 1 time in total.

User avatar
PaulMy
Posts: 1547
Joined: Sun Sep 28, 2008 11:54 pm
Weather Station: Davis Vantage Pro 2 w/Envoy USB
Operating System: Windows-8
Location: Komoka, ON Canada
Contact:

Re: Decoding METARS

Postby PaulMy » Mon Oct 02, 2017 11:12 pm

In trying to reply to PM I get
"Some users couldn’t be added as they have disabled private message receipt."

You can email me.

Paul

User avatar
PaulMy
Posts: 1547
Joined: Sun Sep 28, 2008 11:54 pm
Weather Station: Davis Vantage Pro 2 w/Envoy USB
Operating System: Windows-8
Location: Komoka, ON Canada
Contact:

Re: Decoding METARS

Postby PaulMy » Mon Oct 02, 2017 11:48 pm

Hi sfws;
Any Canadians familiar with their METAR content can help me as I do not yet have ability to translate your two letter codes for cloud and general weather, (in RMK Group) nor understand your 'BBBB' system with RR?, CC?, AA? or P?? that appears before the Surface Wind Group.


I am not knowledgeable about METAR but a couple of years ago I started a spreadsheet by regularly copying in the local CYXU METAR (London, ON) and comparing my station's data to the METAR, especially pressure. At that time I also copied into my spreadsheet the METAR definitions that was linked at the CYXU site. I haven't updated this for about 18 months and now see that the METAR definitions are no longer linked at the CYXU station.

I can share my spreadsheet if that could be helpful.

I presume you have looked at https://ec.gc.ca/manobs/default.asp?lan ... 3a380ded-1
If there is something specific in this that is not clear I would gladly get in touch with an EC Meteorologist who I communicate with on occasion (CANWARN) and see if he has the information or where to get it.

Regards,
Paul

sfws
Posts: 344
Joined: Fri Jul 27, 2012 11:29 am
Weather Station: off-line Fine Offset plus others
Operating System: off-line Vista and W10 PCs
Location: UK

Re: Decoding METARS

Postby sfws » Tue Oct 03, 2017 8:22 am

PaulMy wrote:I presume you have looked at https://ec.gc.ca/manobs/default.asp?lan ... 3a380ded-1

Paul

That is exactly what I was looking for, I had tried a search for 'METAR' on a different part of the EC site, but it gave me access to METAR reports, not the definition. I should have thought of adding 'publications' or something similar to my search.

Thank you very much. From a quick glance, that almost certainly contains everything I wanted. When I'm next able to spend time coding, that will allow me to really make my decoder the most comprehensive one available, accepting METAR from anywhere.

Since other people successfully send me (and reply to) PMs, and I have not changed any settings since I cannot account for the error you saw.

User avatar
PaulMy
Posts: 1547
Joined: Sun Sep 28, 2008 11:54 pm
Weather Station: Davis Vantage Pro 2 w/Envoy USB
Operating System: Windows-8
Location: Komoka, ON Canada
Contact:

Re: Decoding METARS

Postby PaulMy » Tue Oct 03, 2017 1:23 pm

Hi sfws, and glad that will be helpful, and look forward to your finished work. Let me know if I can be of any further help.

Since other people successfully send me (and reply to) PMs, and I have not changed any settings since I cannot account for the error you saw.
Your PM was received but could not send a reply and that message came up. Tried several times and got the same message. Today I couldn't even find a PM button on your profile but does show up for other users. Here is what I get from my control panel when I enter your user name to add recipient.

Enjoy,
Paul
You do not have the required permissions to view the files attached to this post.

sfws
Posts: 344
Joined: Fri Jul 27, 2012 11:29 am
Weather Station: off-line Fine Offset plus others
Operating System: off-line Vista and W10 PCs
Location: UK

Re: Decoding METARS

Postby sfws » Tue Oct 03, 2017 6:32 pm

PaulMy wrote:when I enter your user name to add recipient
Maybe what others have been doing is just hitting 'send reply' button (i.e. using button when my PM is displayed), rather than attempting to create a new message, maybe I just clicked the wrong place in the user panel sometime or maybe when Steve migrated to a new bulletin board version a while ago now some setting defaults changed! Although I have been contributing quite a bit recently, there was a period when I was focussed on more active outdoor activities. Anyway, I have reset all my user panel settings, so that should cure any PM sending difficulties.

PaulMy wrote: look forward to your finished work. Let me know if I can be of any further help.

I realise now that looking at other decoders or at places like Wipedia to see what codes exist, muddles me as the information there is often incomplete or out of date. That is why it is critical that I look at detailed reference books written by the appropriate office in each country. But each time I look at the script I am improving it and I remain confident that I will soon have the best possible script to parse METAR and decode almost everything that is not free text!

I've just added Canada's "Variable Visibility" type to my decoder, I made a few errors (for me it is the end of a busy day) while typing in the extra code, but when I corrected my carelessness that new addition works on the METAR quoted as an example and gives an equivalent explanation. It will be a while before I work through all the extras as I have some more busy days coming, but I do feel cheered up!

User avatar
PaulMy
Posts: 1547
Joined: Sun Sep 28, 2008 11:54 pm
Weather Station: Davis Vantage Pro 2 w/Envoy USB
Operating System: Windows-8
Location: Komoka, ON Canada
Contact:

Re: Decoding METARS

Postby PaulMy » Tue Oct 03, 2017 8:06 pm

Success I think, PM sent.

Paul

sfws
Posts: 344
Joined: Fri Jul 27, 2012 11:29 am
Weather Station: off-line Fine Offset plus others
Operating System: off-line Vista and W10 PCs
Location: UK

Re: Decoding METARS

Postby sfws » Wed Nov 08, 2017 3:42 pm

sfws wrote:If anyone is interested, I have written in PHP 7 a METAR decoding script that takes into account all the 2017 changes
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]". As a result it is now compatible with PHP 5.4.0 to PHP 7.1.11, but not earlier versions of PHP that do not support PHP constructs like "labels" as these are an essential part of my design.

Currently, the decoding script is in 3 files (easier than a single file to maintain). In the Remarks Group decoding aspects I cover the most widely used codes relating to Australia, Canada, and Italy. I cover 32 out of the 41 USA Remark codes available (and therefore those bases shared with New Zealand and US bases in other nations). 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. Although I put a lot of time and mental effort into trying to make the best possible decoder, I have concluded it is not of wider interest, and there is little incentive to continue, especially as my Remarks Group script has now grown into a rather inefficient mess of over 2 thousand lines!

I have a number of web pages that call my decoder. There is a linked pair; one for selecting a METAR, and one for displaying the selected one. These has helped me to extend my knowledge into such areas as understanding use of 'POST', different ways of designing HTML forms, experimenting with regular expressions, more approaches to validation, and related issues that I did not know that much about, as well as helping me to do more extensive testing of my decoding suite against METAR issued from almost all nations internationally as well as a range of European ones. I don't see these web pages as a polished product that will suit someone else, but they have been successful, in line with their designed purpose, with testing the extremes of what can be done. I also have 3 variants of a Cumulus template to show the decoded output from "Nearest METAR stations" as a series of responsive tables; for a site in the Home Counties around London, UK (contact by PM elicted no response); for a site near London in Canada (see http://www.komokaweather.com/metar/metar_display.php), and the third showing New Zealand plus Antartica (my last challenge was coping with the content of those METAR).


Return to “Weather”

Who is online

Users browsing this forum: No registered users and 3 guests