Error in Metar String

May 18, 2011 at 9:47 PM

I am using NOAA's METAR data and I am receiving an error when I try to read it. It just states basically, it is not in the correct format. Here is a sample URL from NOAA:

 

http://weather.noaa.gov/pub/data/observations/metar/stations/KSDF.TXT

You can view all available METAR data here:

http://weather.noaa.gov/pub/data/observations/metar/stations/

Thanks!

Coordinator
May 19, 2011 at 12:29 PM

Hi. I checked this but I found no error. Unfortunately you did not write any information about the thrown exception. There can be two possible problems:

a) the curret source (which is something like ftp:/ftp???.noaa.gov/....) is not accessible from your location. I didn't know URL you pasted here, but for support, I created a class NoaaGovRetrieverV2 which will download metar from the URL you entered. This class is not available via main package, but is located in separated release - see http://metar.codeplex.com/releases/view/66639 . Only choose which library do you need (.NET vs Silverlight) and overwrite the previous files. *

b) the metar on the page is in formal incorrect form (that means there is syntax error in the metar string). I made the library by METAR specification, however I found some US airports sometimes distrurb the original string and in that case the metar cannot be decoded. In this case I can help you only if you send me the text of the incorrect metar string. The current metar string for KSDF works ok.

 

* BTW the content of the files in both source of "a)" problems is the same. So simply, all you need is to open a stream to your URL, download the content, take the second line (this is important, first line contains some date), add keyword "METAR " before it as it is required by METAR specification and send it for parsing.

May 19, 2011 at 2:19 PM

Thanks to your reply I figured out what it was. The NOAA METAR does not have METAR keyword at the beginning of the string.

Thanks!

Coordinator
May 19, 2011 at 2:27 PM

I'm glad to read that :-)

 

Unfortunately, keyword METAR is required at the beginning of the string to recognize between METAR and SPECI report. However, most of US metar stations does not include it. I do this in the algorithm of retriever manually.

Jul 19, 2012 at 3:47 PM
Edited Jul 19, 2012 at 5:01 PM

METAR LIRS 191355Z /////KT CAVOK 33/11 Q1014

---------------------------DecodeException---------------------------

Decoding failed at ->Whole METAR->Wind with variability->Wind->Wind. Reason: >> Failed text is >/////KT CAVOK 33/11 Q1014<. --> Decoding failed at ->Wind with variability->Wind->Wind. Reason: >> Failed text is >/////KT CAVOK 33/11 Q1014<. --> Decoding failed at ->Wind->Wind. Reason: >> Failed text is >/////KT CAVOK 33/11 Q1014<. --> Decoding failed at ->Wind. Reason: >> Failed text is >/////KT CAVOK 33/11 Q1014<. --> Failed text is >/////KT CAVOK 33/11 Q1014<.

/////KT means that the information about wind is not available

Thanks

Coordinator
Jul 20, 2012 at 7:42 PM

Hi!

I know the "issue" what is not the issue. The problem is that in the specification of WMO, the "Wind direction" and "wind speed" are not optional blocks. They must be present with valid values.

However, I got multiple reports about this, so I will do something with that. So far I can offer you two solutions:

* you can manually check for /////KT string and replace it with something valid, like 00000KT

* if you downloaded latest version, you can try to use different analyse, "ENG.WMOCodes.Decoders.MetarDecoderWithAllOptional" class may help you, which tries to decode the METAR string with all blocks as optional. It was developed for Canada metars, where this is valid metar format.

 

The future version of decoder with try to deal with this.