Skip to content

Commit

Permalink
add support for satdump-generated gk2a image filename parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
FCWYzzr committed Oct 29, 2024
1 parent c23e7a6 commit 76a0432
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
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

0 comments on commit 76a0432

Please sign in to comment.