Skip to content

Commit

Permalink
Added remark groups AO1A and AO2A
Browse files Browse the repository at this point in the history
  • Loading branch information
nnaumenko committed Oct 4, 2019
1 parent aed226c commit 7e0cd17
Show file tree
Hide file tree
Showing 10 changed files with 247 additions and 151 deletions.
8 changes: 8 additions & 0 deletions docs/sphinx/api_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,14 @@ The following syntax corresponds to this group in METAR/TAF reports (in remarks

Indicates an automated station with precipitation discriminator.

.. cpp:enumerator:: AO1A

Indicates an automated station without precipitation discriminator and denotes an automated observation augmented by a human observer.

.. cpp:enumerator:: AO2A

Indicates an automated station with precipitation discriminator and denotes an automated observation augmented by a human observer.

.. cpp:enumerator:: NOSPECI

Indicates a manual station where SPECI (unscheduled) reports are not issued.
Expand Down
4 changes: 2 additions & 2 deletions docs/sphinx/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
author = 'Nick Naumenko'

# The short X.Y version
version = '3.3.2'
version = '3.4.0'
# The full version, including alpha/beta/rc tags
release = '3.3.2'
release = '3.4.0'


# -- General configuration ---------------------------------------------------
Expand Down
303 changes: 159 additions & 144 deletions docs/sphinx/fixedgrouprmk.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions examples/explain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,18 @@ std::string VisitorExplain::visitFixedGroup(const metaf::FixedGroup & group,
result << "This automated station is equipped with a precipitation discriminator";
break;

case metaf::FixedGroup::Type::AO1A:
result << "This automated station is not equipped with a precipitation discriminator";
result << lineBreak;
result << "Automated observation is augmented by a human observer";
break;

case metaf::FixedGroup::Type::AO2A:
result << "This automated station is equipped with a precipitation discriminator";
result << lineBreak;
result << "Automated observation is augmented by a human observer";
break;

case metaf::FixedGroup::Type::NOSPECI:
result << "This manual station does not issue SPECI (unscheduled) reports";
break;
Expand Down
11 changes: 9 additions & 2 deletions include/metaf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ namespace metaf {
// Metaf library version
struct Version {
inline static const int major = 3;
inline static const int minor = 3;
inline static const int patch = 2;
inline static const int minor = 4;
inline static const int patch = 0;
inline static const char tag [] = "";
};

Expand Down Expand Up @@ -704,6 +704,8 @@ class FixedGroup {
MAINTENANCE_INDICATOR,
AO1,
AO2,
AO1A,
AO2A,
NOSPECI,
RVRNO,
PWINO,
Expand Down Expand Up @@ -1621,6 +1623,7 @@ class CloudLayersGroup {
static inline std::optional<HighLayer> highLayerFromChar(char c);
};

// TODO: LTG groups
class LightningGroup {
public:
inline bool isValid() const { return true; }
Expand All @@ -1642,6 +1645,7 @@ class LightningGroup {
}
};

// TODO: RAB, RAE, SNB, DZB, etc.
class WeatherBeginEndGroup {
public:
inline bool isValid() const { return true; }
Expand All @@ -1663,6 +1667,7 @@ class WeatherBeginEndGroup {
}
};

// TODO: TS x MOV y, CB x MOV y, etc.
class VicinityGroup {
public:
inline bool isValid() const { return true; }
Expand Down Expand Up @@ -3270,6 +3275,8 @@ std::optional<FixedGroup> FixedGroup::parse(const std::string & group,
if (reportPart == ReportPart::RMK) {
if (group == "AO1") return FixedGroup(Type::AO1);
if (group == "AO2") return FixedGroup(Type::AO2);
if (group == "AO1A") return FixedGroup(Type::AO1A);
if (group == "AO2A") return FixedGroup(Type::AO2A);
if (group == "NOSPECI") return FixedGroup(Type::NOSPECI);
if (group == "RVRNO") return FixedGroup(Type::RVRNO);
if (group == "PWINO") return FixedGroup(Type::PWINO);
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/785c3536264b4a90bd8d94e1a799d275)](https://www.codacy.com/manual/nnaumenko/metaf?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=nnaumenko/metaf&amp;utm_campaign=Badge_Grade)
[![Codecov](https://codecov.io/gl/nnaumenko/metaf/branch/master/graph/badge.svg)](https://codecov.io/gl/nnaumenko/metaf)
[![MIT license](https://img.shields.io/github/license/nnaumenko/metaf)](LICENSE.md)
[![Try online](https://img.shields.io/badge/try-online-blue)](https://wandbox.org/permlink/nqOCxCKCgJuawMkv)
[![Try online](https://img.shields.io/badge/try-online-blue)](https://wandbox.org/permlink/MLo1N9Voe9Iuisb5)


## Introduction
Expand Down
28 changes: 28 additions & 0 deletions test/test_fixedgroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,34 @@ TEST(FixedGroup, parseAo2) {
EXPECT_FALSE(metaf::FixedGroup::parse(gs, metaf::ReportPart::TAF).has_value());
}

TEST(FixedGroup, parseAo1a) {
static const char gs[] = "AO1A";
static const auto type = metaf::FixedGroup::Type::AO1A;

auto fg = metaf::FixedGroup::parse(gs, metaf::ReportPart::RMK);
ASSERT_TRUE(fg.has_value());
EXPECT_EQ(fg->type(), type);

EXPECT_FALSE(metaf::FixedGroup::parse(gs, metaf::ReportPart::UNKNOWN).has_value());
EXPECT_FALSE(metaf::FixedGroup::parse(gs, metaf::ReportPart::HEADER).has_value());
EXPECT_FALSE(metaf::FixedGroup::parse(gs, metaf::ReportPart::METAR).has_value());
EXPECT_FALSE(metaf::FixedGroup::parse(gs, metaf::ReportPart::TAF).has_value());
}

TEST(FixedGroup, parseAo2a) {
static const char gs[] = "AO2A";
static const auto type = metaf::FixedGroup::Type::AO2A;

auto fg = metaf::FixedGroup::parse(gs, metaf::ReportPart::RMK);
ASSERT_TRUE(fg.has_value());
EXPECT_EQ(fg->type(), type);

EXPECT_FALSE(metaf::FixedGroup::parse(gs, metaf::ReportPart::UNKNOWN).has_value());
EXPECT_FALSE(metaf::FixedGroup::parse(gs, metaf::ReportPart::HEADER).has_value());
EXPECT_FALSE(metaf::FixedGroup::parse(gs, metaf::ReportPart::METAR).has_value());
EXPECT_FALSE(metaf::FixedGroup::parse(gs, metaf::ReportPart::TAF).has_value());
}

TEST(FixedGroup, parseNospeci) {
static const char gs[] = "NOSPECI";
static const auto type = metaf::FixedGroup::Type::NOSPECI;
Expand Down
12 changes: 12 additions & 0 deletions test/test_getsyntaxgroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ TEST(getSyntaxGroup, OTHER_AO2) {
EXPECT_EQ(metaf::getSyntaxGroup(g.value()), metaf::SyntaxGroup::OTHER);
}

TEST(getSyntaxGroup, OTHER_AO1A) {
const auto g = metaf::FixedGroup::parse("AO1A", metaf::ReportPart::RMK);
ASSERT_TRUE(g.has_value());
EXPECT_EQ(metaf::getSyntaxGroup(g.value()), metaf::SyntaxGroup::OTHER);
}

TEST(getSyntaxGroup, OTHER_AO2A) {
const auto g = metaf::FixedGroup::parse("AO2A", metaf::ReportPart::RMK);
ASSERT_TRUE(g.has_value());
EXPECT_EQ(metaf::getSyntaxGroup(g.value()), metaf::SyntaxGroup::OTHER);
}

TEST(getSyntaxGroup, OTHER_NOSPECI) {
const auto g = metaf::FixedGroup::parse("NOSPECI", metaf::ReportPart::RMK);
ASSERT_TRUE(g.has_value());
Expand Down
4 changes: 2 additions & 2 deletions test/test_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ TEST(Visitor, visitorVoid) {
}
}

EXPECT_EQ((v.count[variant_index<metaf::Group, metaf::FixedGroup>()]), 18);
EXPECT_EQ((v.count[variant_index<metaf::Group, metaf::FixedGroup>()]), 19);
EXPECT_EQ((v.count[variant_index<metaf::Group, metaf::LocationGroup>()]), 10);
EXPECT_EQ((v.count[variant_index<metaf::Group, metaf::ReportTimeGroup>()]), 10);
EXPECT_EQ((v.count[variant_index<metaf::Group, metaf::TrendGroup>()]), 3);
Expand All @@ -309,6 +309,6 @@ TEST(Visitor, visitorVoid) {
EXPECT_EQ((v.count[variant_index<metaf::Group, metaf::WeatherBeginEndGroup>()]), 0);
EXPECT_EQ((v.count[variant_index<metaf::Group, metaf::VicinityGroup>()]), 0);
EXPECT_EQ((v.count[variant_index<metaf::Group, metaf::MiscGroup>()]), 1);
EXPECT_EQ((v.count[variant_index<metaf::Group, metaf::UnknownGroup>()]), 5);
EXPECT_EQ((v.count[variant_index<metaf::Group, metaf::UnknownGroup>()]), 4);
}

14 changes: 14 additions & 0 deletions test/testdata_real.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4401,5 +4401,19 @@ const std::vector<testdata::MetarTafRealData> testdata::realDataSet = {
" TEMPO 1014/1017 VRB15G25KT 5000 TSRA BKN015 SCT035C"
" BECMG 1108/1110 5000 -RA BR BKN015 OVC040"
"="
},

{
"PHHI", "Wheeler(AAF)", {2019, 9, 23},
"METAR PHHI 262356Z 29009KT 4SM -SHRA BR VCTS FEW005 BKN016 OVC020CB 25/24 A2989"
" RMK AO2A DZE2259RAB2259E16DZB16E22RAB37 TS 7E MOV NE"
" CIG 016V020 SLP111 P0007 60007 T02470238 10295 20243 57016 $"
"=",
"TAF PHHI 232300Z 2323/2505 24009KT 1600 RA BR BKN004 BKN015 BKN025 OVC035 QNH2990INS"
" TEMPO 2323/2405 24008KT 9999 SCT005 OVC015"
" BECMG 2405/2406 VRB06KT 9999 NSW FEW015 SCT025 BKN040 QNH2993INS"
" BECMG 2422/2423 08009KT 9999 SCT015 BKN030 QNH2993INS"
" TX27/2401Z TN23/2416Z"
"="
}
};

0 comments on commit 7e0cd17

Please sign in to comment.