Skip to content

Commit

Permalink
Merge pull request #57 from mivek/bugfix/recent_intensity
Browse files Browse the repository at this point in the history
Bugfix/recent intensity
  • Loading branch information
mivek authored Dec 10, 2023
2 parents c5d5eac + cb3cfcf commit 164900f
Show file tree
Hide file tree
Showing 10 changed files with 127 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## [1.7.1] - 2023-12-09

### Fixed

- Parsing of `WeatherCondition` tokens with recent (`RE`) intensity.

## [1.7.0] - 2023-08-20

### Added
Expand Down
Binary file modified metar_taf_parser/locale/en/LC_MESSAGES/messages.mo
Binary file not shown.
4 changes: 4 additions & 0 deletions metar_taf_parser/locale/en/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,10 @@ msgstr "Light"
msgid "Intensity.+"
msgstr "Heavy"

#:
msgid "Intensity.RE"
msgstr "Recent"

#:
msgid "Intensity.VC"
msgstr "In the vicinity"
Expand Down
Binary file modified metar_taf_parser/locale/fr/LC_MESSAGES/messages.mo
Binary file not shown.
100 changes: 100 additions & 0 deletions metar_taf_parser/locale/fr/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ msgstr "nuages épars"
msgid "CloudQuantity.SKC"
msgstr "pas de nuage"

#:
msgid "CloudType.AC"
msgstr "Altocumulus"

#:
msgid "CloudType.AS"
msgstr "Altostratus"

#:
msgid "CloudType.CB"
msgstr "Cumunolinbus"
Expand All @@ -38,6 +46,30 @@ msgstr "Cumunolinbus"
msgid "CloudType.CC"
msgstr "Cirrocumulus"

#:
msgid "CloudType.CI"
msgstr "Cirrus"

#:
msgid "CloudType.CS"
msgstr "Cirrostratus"

#:
msgid "CloudType.CU"
msgstr "Cumulus"

#:
msgid "CloudType.NS"
msgstr "Nimbostratus"

#:
msgid "CloudType.SC"
msgstr "Stratocumulus"

#:
msgid "CloudType.ST"
msgstr "Stratus"

#:
msgid "CloudType.TCU"
msgstr "Cumulus bourgeonnant"
Expand Down Expand Up @@ -70,6 +102,10 @@ msgstr "bonne"
msgid "DepositBrakingCapacity.99"
msgstr "valeurs non fiables"

#:
msgid "DepositBrakingCapacity.default"
msgstr "friction coefficient of {0}"

#:
msgid "DepositCoverage.NOT_REPORTED"
msgstr "non reportée"
Expand Down Expand Up @@ -98,6 +134,30 @@ msgstr "non reportée"
msgid "DepositThickness.00"
msgstr "moins de 1 mm"

#:
msgid "DepositThickness.92"
msgstr "10 cm"

#:
msgid "DepositThickness.93"
msgstr "15 cm"

#:
msgid "DepositThickness.94"
msgstr "20 cm"

#:
msgid "DepositThickness.95"
msgstr "25 cm"

#:
msgid "DepositThickness.96"
msgstr "30 cm"

#:
msgid "DepositThickness.97"
msgstr "35 cm"

#:
msgid "DepositThickness.98"
msgstr "40 cm ou plus"
Expand All @@ -106,6 +166,10 @@ msgstr "40 cm ou plus"
msgid "DepositThickness.99"
msgstr "fermée"

#:
msgid "DepositThickness.default"
msgstr "{0} mm"

#:
msgid "DepositType.NOT_REPORTED"
msgstr "non reportée"
Expand Down Expand Up @@ -270,6 +334,10 @@ msgstr "Faible"
msgid "Intensity.+"
msgstr "Fort"

#:
msgid "Intensity.RE"
msgstr "Récent(e)"

#:
msgid "Intensity.VC"
msgstr "Au voisinage de"
Expand Down Expand Up @@ -326,6 +394,10 @@ msgstr "granules de glace"
msgid "Phenomenon.PO"
msgstr "tourbillon de poussières sable"

#:
msgid "Phenomenon.PY"
msgstr "spray"

#:
msgid "Phenomenon.RA"
msgstr "pluie"
Expand Down Expand Up @@ -610,6 +682,10 @@ msgstr "couche de nuages variant entre {0} et {1}"
msgid "Remark.Variable.Sky.Condition.Height"
msgstr "couche de nuages à {0} pieds variant entre {1} et {2}"

#:
msgid "Remark.VIRGA"
msgstr "virga"

#:
msgid "Remark.Virga.Direction"
msgstr "virga au {0} de la station"
Expand Down Expand Up @@ -698,6 +774,10 @@ msgstr "Sud Ouest"
msgid "Converter.U"
msgstr "accroissement"

#:
msgid "Converter.VRB"
msgstr "Variable"

#:
msgid "Converter.W"
msgstr "Ouest"
Expand Down Expand Up @@ -754,10 +834,18 @@ msgstr "altimètre (hPa)"
msgid "ToString.amendment"
msgstr "amendement"

#:
msgid "ToString.auto"
msgstr "auto"

#:
msgid "ToString.baseHeight"
msgstr "Base de la couche en pied"

#:
msgid "ToString.cavok"
msgstr "cavok"

#:
msgid "ToString.clouds"
msgstr "nuages"
Expand Down Expand Up @@ -834,6 +922,10 @@ msgstr "message original"
msgid "ToString.name"
msgstr "nom"

#:
msgid "ToString.nosig"
msgstr "nosig"

#:
msgid "ToString.phenomenons"
msgstr "phénomènes"
Expand Down Expand Up @@ -890,6 +982,10 @@ msgstr "tendance"
msgid "ToString.trends"
msgstr "tendances"

#:
msgid "ToString.type"
msgstr "type"

#:
msgid "ToString.visibility.main"
msgstr "visibilité principale"
Expand All @@ -914,6 +1010,10 @@ msgstr "visibilité verticale (pieds)"
msgid "ToString.weather.conditions"
msgstr "conditions météorologique"

#:
msgid "ToString.wind.direction"
msgstr "direction"

#:
msgid "ToString.wind.direction.degrees"
msgstr "direction (degrés)"
Expand Down
4 changes: 4 additions & 0 deletions metar_taf_parser/locale/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,10 @@ msgstr "Light"
msgid "Intensity.+"
msgstr "Heavy"

#:
msgid "Intensity.RE"
msgstr "Recent"

#:
msgid "Intensity.VC"
msgstr "In the vicinity"
Expand Down
1 change: 1 addition & 0 deletions metar_taf_parser/model/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class Intensity(enum.Enum):
LIGHT = '-'
HEAVY = '+'
IN_VICINITY = 'VC'
RECENT = 'RE'

def __repr__(self):
return _('Intensity.' + self.value)
Expand Down
2 changes: 1 addition & 1 deletion metar_taf_parser/parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class AbstractParser(abc.ABC):
BECMG = 'BECMG'
RMK = 'RMK'
TOKENIZE_REGEX = r'\s((?=\d\/\dSM)(?<!\s\d\s)|(?!\d\/\dSM))|='
INTENSITY_REGEX = r'^(-|\+|VC)'
INTENSITY_REGEX = r'^(-|\+|VC|RE)'
CAVOK = 'CAVOK'

def __init__(self):
Expand Down
10 changes: 10 additions & 0 deletions metar_taf_parser/tests/parser/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,16 @@ def test_parse_empty_wind(self):
self.assertEqual(0, metar.wind.speed)
self.assertEqual(0, metar.wind._degrees)

def test_parse_recent_rain(self):
metar = MetarParser().parse('LTAE 250250Z VRB02KT 9999 BKN030 BKN080 06/05 Q1005 RESHRA NOSIG RMK RWY21 07004KT 040V100')

self.assertEqual('LTAE', metar.station)
self.assertEqual(1, len(metar.weather_conditions))
self.assertEqual(Intensity.RECENT, metar.weather_conditions[0].intensity)
self.assertEquals(Descriptive.SHOWERS, metar.weather_conditions[0].descriptive)
self.assertEqual(1, len(metar.weather_conditions[0].phenomenons))
self.assertEqual(Phenomenon.RAIN, metar.weather_conditions[0].phenomenons[0])


class FunctionTestCase(unittest.TestCase):

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = metar-taf-parser-mivek
version = 1.7.0
version = 1.7.1
author = Jean-Kevin KPADEY
author_email = [email protected]
description = Python project parsing metar and taf message
Expand Down

0 comments on commit 164900f

Please sign in to comment.