Never return -0 as temperature
authorTuomas Jormola <tj@solitudo.net>
Sun, 28 Oct 2012 10:16:45 +0000 (12:16 +0200)
committerTuomas Jormola <tj@solitudo.net>
Sun, 28 Oct 2012 10:16:45 +0000 (12:16 +0200)
src/metar.lua

index bc2045f..c092cd0 100644 (file)
@@ -464,7 +464,9 @@ end
 
 local function parse_metar_temperature(temperature, dewpoint)
        temperature = temperature:gsub('^M', '-')
+       temperature = temperature:gsub('^-0+$', '0')
        dewpoint = dewpoint:gsub('^M', '-')
+       dewpoint = dewpoint:gsub('^-0+$', '0')
        return { temperature = tonumber(temperature), dewpoint = tonumber(dewpoint) }
 end