Skip to content

Commit

Permalink
Merge pull request #105 from FCWYzzr/master
Browse files Browse the repository at this point in the history
Add name parsing support for Satdump GK-2A Plugin generated gk2a image
  • Loading branch information
nullpainter authored Nov 23, 2024
2 parents b5b4408 + 76a0432 commit e247bd0
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
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

0 comments on commit e247bd0

Please sign in to comment.