P-VTEC parsing

This commit is contained in:
Dan Paulat 2022-01-23 12:43:52 -06:00
parent e5c40b9eb5
commit be1d7323bd
10 changed files with 835 additions and 5 deletions

View file

@ -0,0 +1,76 @@
#pragma once
#include <string>
namespace scwx
{
namespace awips
{
enum class Phenomenon
{
AshfallLand,
AirStagnation,
BeachHazard,
BriskWind,
Blizzard,
CoastalFlood,
DebrisFlow,
DustStorm,
BlowingDust,
ExtremeCold,
ExcessiveHeat,
ExtremeWind,
Flood,
FlashFlood,
DenseFogLand,
FloodForecastPoints,
Frost,
FireWeather,
Freeze,
Gale,
HurricaneForceWind,
Heat,
Hurricane,
HighWind,
Hydrologic,
HardFreeze,
IceStorm,
LakeEffectSnow,
LowWater,
LakeshoreFlood,
LakeWind,
Marine,
DenseFogMarine,
AshfallMarine,
DenseSmokeMarine,
RipCurrentRisk,
SmallCraft,
HazardousSeas,
DenseSmokeLand,
Storm,
StormSurge,
SnowSquall,
HighSurf,
SevereThunderstorm,
Tornado,
TropicalStorm,
Tsunami,
Typhoon,
HeavyFreezingSpray,
WindChill,
Wind,
WinterStorm,
WinterWeather,
FreezingFog,
FreezingRain,
FreezingSpray,
Unknown
};
Phenomenon GetPhenomenon(const std::string& code);
std::string GetPhenomenonCode(Phenomenon phenomenon);
std::string GetPhenomenonText(Phenomenon phenomenon);
} // namespace awips
} // namespace scwx

View file

@ -0,0 +1,75 @@
#pragma once
#include <scwx/awips/phenomenon.hpp>
#include <scwx/awips/significance.hpp>
#include <chrono>
#include <memory>
namespace scwx
{
namespace awips
{
class PVtecImpl;
class PVtec
{
public:
enum class ProductType
{
Operational,
Test,
Experimental,
OperationalWithExperimentalVtec,
Unknown
};
enum class Action
{
New,
Continued,
ExtendedInArea,
ExtendedInTime,
ExtendedInAreaAndTime,
Upgraded,
Canceled,
Expired,
Routine,
Correction,
Unknown
};
explicit PVtec();
~PVtec();
PVtec(const PVtec&) = delete;
PVtec& operator=(const PVtec&) = delete;
PVtec(PVtec&&) noexcept;
PVtec& operator=(PVtec&&) noexcept;
ProductType fixed_identifier() const;
Action action() const;
std::string office_id() const;
Phenomenon phenomenon() const;
Significance significance() const;
int16_t event_tracking_number() const;
std::chrono::system_clock::time_point event_begin() const;
std::chrono::system_clock::time_point event_end() const;
bool Parse(const std::string& s);
static ProductType GetProductType(const std::string& code);
static std::string GetProductTypeCode(ProductType productType);
static Action GetAction(const std::string& code);
static std::string GetActionCode(Action action);
private:
std::unique_ptr<PVtecImpl> p;
};
} // namespace awips
} // namespace scwx

View file

@ -0,0 +1,27 @@
#pragma once
#include <string>
namespace scwx
{
namespace awips
{
enum class Significance
{
Warning,
Watch,
Advisory,
Statement,
Forecast,
Outlook,
Synopsis,
Unknown
};
Significance GetSignificance(const std::string& code);
std::string GetSignificanceCode(Significance significance);
std::string GetSignificanceText(Significance significance);
} // namespace awips
} // namespace scwx