Hi all,
When I submit a SYNOP with ddff=0000, I get no wind information at all in the output xml. I believe I should have wind direction=0 and wind force=0.
For example, this SYNOP message:
AAXX 31004 42027 32596 80000 10026 20003 38457 48544 8452/ 333 59035=
The Nddff group is 80000.
In the XML I get:
<sfcWind s="0000">
<wind>
<isCalm/>
</wind>
</sfcWind>
I think I should have got something like:
<sfcWind s="0000">
<wind>
<dir v="0" rp="?" rn="?"/>
<speed v="0" u="KT"/>
</wind>
</sfcWind>
The issue is in parser.pm, where dd=00 is considered as a special case:
} elsif ($2 eq '00') {
$report{sfcWind}{wind}{isCalm} = undef;
$report{sfcWind}{wind}{isEstimated} = undef if $windEST;
} else {
Why introducing this isCalm attribute, when we could just ouput 0 speed and direction?
Otherwise: great and solid-rock software!
Keep it up!
chpod
PS: Using 1.37, but according to Changelog, should be the same in 1.38.
Hi chpod,
> Why introducing this isCalm attribute, when we could just ouput 0 speed and direction?
The reason is that it is not quite the same. I found <isCalm/> is closer to the documentation, and I think also to the general language use.
Please let me explain (sorry if it is too detailed and lengthy :-).
The meaning of "dd" in Nddff is given in a section of a document that is quoted one line above the code you quoted:
> # WMO-No. 306 Vol I.1, Part A, code table 0877:
This is short for:
Manual on Codes
International Codes VOLUME I.1
Part A — Alphanumeric Codes
WMO–No. 306
Section C SPECIFICATIONS OF CODE FIGURES (code tables)
b. CODE TABLES
Table 0877
I have the 1995 edition with supplement 6 from August 2007. (I'd be very grateful to get a later version if there is one.)
This manual describes the meaning of "dd" as:
> dd - True direction, in tens of degrees, from which wind is blowing
> ... (Code table 0877; ...) (FM 12, ...)
(FM 12 being the code form for SYNOP messages).
And the code table 0877 in the same manual says:
> 00 - Calm
So "00" actually indicates the wind _speed_ but not a direction, as opposed to "36" which means 355..004 degrees.
BTW, manual section 15.5.4 for METAR explicitly states that the numbers in "00000KT" must not be interpreted as numbers:
> “Calm” shall be coded as 00000 followed immediately ... by ... the unit ...
Of course, when processing the XML, you can always replace the node <isCalm/>: the wind direction is unknown; the wind speed for "calm" (according to Beaufort) is less than 1 for the units knots, km/h, and m.p.h. So, using XSLT, maybe the closest thing that is still correct (and even valid according to the current DTD) would be:
<xsl:template match="isCalm">
<xsl:element name="dirNotAvailable"/>
<xsl:element name="speed">
<xsl:attribute name="v">1</xsl:attribute>
<xsl:attribute name="q">isLess</xsl:attribute>
<xsl:attribute name="u">KT</xsl:attribute>
</xsl:element>
</xsl:template>
I also chose <isCalm/> because the transformation this way is much easier than the other way round. :-)
Sorry, but for the sake of correctness, I'd rather not use speed=0 and dir=0 for "calm".
HTH.
(Regarding "solid-rock software": while working on this reply, I found a bug related to "calm": in version 1.38, the keyword "calm" in the language translation file was replaced by "calmWind", to be able to distinguish it from "calmSea", but I forgot to apply the changes for the summary :-)
Kind regards,
Thomas
Well, you are right, you remain closer to the documentation this way.
I will make a special case in a downstream parser in order to process the isCalm tag.
Thanks very much for your answer,
chpod
Hi chpod,
[quote=chpod]I will make a special case in a downstream parser ...[/quote]
Well, you can easily change the code in the parser.pm itself if it is more convenient for you. Assuming you are still using version 1.37, you could change line 2137 from:
[code]
} elsif ($2 eq '00') {
[/code]
to:
[code]
} elsif (0 && $2 eq '00') {
[/code]
to skip the code path for isCalm, and get wind direction=0 and wind force=0.
Or instead of this, you could replace line 2138 with:
[code]
$report{sfcWind}{wind}{dirNotAvailable} = undef;
$report{sfcWind}{wind}{speed} = { v => 1, q => 'isLess', u => 'KMH' };
[/code]
to get direction=unknown and force <1 km/h, as proposed previously. You then probably want to make similar changes to other lines that use isCalm for wind in SYNOP (line 4294) or METAR/TAF (line 605).
HTH. If you need any help with such changes, just ask.
Kind regards,
Thomas
Related
Code: code