Show only the newest SFI, A and K in the solar weather bar

For sh/wwv, only the first record under the header is used, since the
table lists the newest first. The date, time, forecast and logger are
dropped, and the status bar reads "SFI 140  A 5  K 2". The line the node
sent is the tool tip. Announcement lines give the same three values.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 12:17:44 +00:00
co-authored by Claude Sonnet 5.5
parent e55159ba49
commit cf39b5af9c
5 changed files with 93 additions and 36 deletions
@@ -3,21 +3,43 @@ namespace Nonemm.Spotting.Tests;
public class SolarReaderTests
{
[Theory]
[InlineData("WWV de VE7CC <18Z> : SFI=140, A=5, K=2, No Storms -> No Storms\a\a")]
[InlineData("WCY de DK0WCY-1 <19> : K=2 expK=2 A=5 R=0 SFI=140 SA=qui GMF=qui Au=no")]
[InlineData("WWV: SFI=140 A=5 K=2")]
public void AnnouncementLinesAreKeptAsTheNodeSentThem(string line) =>
Assert.Equal(line.TrimEnd('\a'), new SolarReader().Read(line));
[InlineData("WWV de VE7CC <18Z> : SFI=140, A=5, K=2, No Storms -> No Storms\a\a", "SFI 140 A 5 K 2")]
[InlineData("WCY de DK0WCY-1 <19> : K=2 expK=2 A=5 R=0 SFI=140 SA=qui", "SFI 140 A 5 K 2")]
[InlineData("WWV: SFI=140 A=5 K=2", "SFI 140 A 5 K 2")]
public void AnnouncementLinesShowTheirIndices(string line, string text)
{
SolarReport? report = new SolarReader().Read(line);
Assert.Equal(text, report?.Text);
Assert.Equal(line.TrimEnd('\a'), report?.Original);
}
[Fact]
public void TheLineUnderAShWwvHeaderIsLabelled()
public void TheNewestRecordUnderAShWwvHeaderIsShownWithoutDateOrTime()
{
SolarReader reader = new();
Assert.Null(reader.Read("Date Hour SFI A K Forecast Logger"));
Assert.Equal("SFI/A/K: 24-Oct-2026 1200Z 140 5 2 No Storms", reader.Read("24-Oct-2026 1200Z 140 5 2 No Storms"));
Assert.Null(reader.Read(" Date Hour SFI A K Forecast Logger"));
SolarReport? newest = reader.Read("24-Oct-2026 1200Z 140 5 2 No Storms -> No Storms VE7CC");
Assert.Equal("SFI 140 A 5 K 2", newest?.Text);
Assert.Equal("24-Oct-2026 1200Z 140 5 2 No Storms -> No Storms VE7CC", newest?.Original);
}
[Fact]
public void TheOlderRecordsUnderTheHeaderAreIgnored()
{
SolarReader reader = new();
reader.Read("Date Hour SFI A K Forecast Logger");
reader.Read("24-Oct-2026 1200Z 140 5 2 No Storms -> No Storms VE7CC");
Assert.Null(reader.Read("24-Oct-2026 0900Z 138 6 3 No Storms -> No Storms VE7CC"));
}
[Fact]
public void AnAnnouncementWithoutIndicesIsNotSolarWeather() =>
Assert.Null(new SolarReader().Read("WWV de VE7CC <18Z> : no data"));
[Fact]
public void ASpotCancelsTheHeader()
{
@@ -25,7 +47,7 @@ public class SolarReaderTests
reader.Read("Date Hour SFI A K Forecast Logger");
reader.Read("DX de K1TTT: 14025.0 JA1XYZ CW 1205Z");
Assert.Null(reader.Read("some other line"));
Assert.Null(reader.Read("24-Oct-2026 1200Z 140 5 2 No Storms -> No Storms VE7CC"));
}
[Fact]