Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add name parsing support for Satdump GK-2A Plugin generated gk2a image #105

Merged
merged 2 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea/
.vs/
bin/
obj/
*.DotSettings.user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public static IFilenameParser GetParser(FilenameParserType type, string? prefix,
{
FilenameParserType.Goesproc => new GoesFilenameParser(prefix, suffix),
FilenameParserType.Xrit => new Gk2AFilenameParser(prefix, suffix),
FilenameParserType.SatDumpGK2APlugin => new Gk2ASatDumpVariantFilenameParser(prefix, suffix),
FilenameParserType.Electro => new ElectroFilenameParser(prefix, suffix),
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
};
Expand Down
7 changes: 6 additions & 1 deletion Sanchez.Processing/Services/Filesystem/FilenameParserType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ public enum FilenameParserType
/// Images produced by <c>xrit-rx</c> for GK-2A images.
/// </summary>
Xrit,


///<summary>
/// Images produced by <c>satdump gk2a plugin</c> for GK-2A images.
/// </summary>
SatDumpGK2APlugin,

/// <summary>
/// Images produced for Electro-L N2 images.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Text.RegularExpressions;

namespace Sanchez.Processing.Services.Filesystem.Parsers;

/// <summary>
/// Parses filenames of satellite imagery received from GK-2A and processed by <c>xrit-rc</c>.
/// </summary>
public class Gk2ASatDumpVariantFilenameParser : AbstractFilenameParser
{
protected override Regex Regex { get; }

protected override string TimestampFormat => "yyyyMMddTHHmmssZ";

public Gk2ASatDumpVariantFilenameParser(string? prefix, string? suffix)
{
Regex = new Regex(prefix + "([0-9]{8}T[0-9]{6}Z)" + suffix + "\\.[^ ]*", RegexOptions.Compiled);
}
}
13 changes: 13 additions & 0 deletions Sanchez/Resources/Satellites.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@
0.006363
]
},
{
"DisplayName": "GEO-KOMPSAT-2A-SatDump-Variant",
"FilenamePrefix": "^GK2A_IR105_",
"FilenameParser": "SatDumpGK2APlugin",
"Longitude": 128.2,
"Brightness": 0.97,
"Crop": [
0.006363,
0.006363,
0.006363,
0.006363
]
},
{
"DisplayName": "Electro-L N2",
"FilenameSuffix": "[1-3]",
Expand Down
Loading