Skip to content

Commit e247bd0

Browse files
authored
Merge pull request #105 from FCWYzzr/master
Add name parsing support for Satdump GK-2A Plugin generated gk2a image
2 parents b5b4408 + 76a0432 commit e247bd0

File tree

5 files changed

+39
-1
lines changed

5 files changed

+39
-1
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.idea/
2+
.vs/
23
bin/
34
obj/
45
*.DotSettings.user

Diff for: Sanchez.Processing/Services/Filesystem/FilenameParserProvider.cs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public static IFilenameParser GetParser(FilenameParserType type, string? prefix,
1010
{
1111
FilenameParserType.Goesproc => new GoesFilenameParser(prefix, suffix),
1212
FilenameParserType.Xrit => new Gk2AFilenameParser(prefix, suffix),
13+
FilenameParserType.SatDumpGK2APlugin => new Gk2ASatDumpVariantFilenameParser(prefix, suffix),
1314
FilenameParserType.Electro => new ElectroFilenameParser(prefix, suffix),
1415
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
1516
};

Diff for: Sanchez.Processing/Services/Filesystem/FilenameParserType.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ public enum FilenameParserType
1111
/// Images produced by <c>xrit-rx</c> for GK-2A images.
1212
/// </summary>
1313
Xrit,
14-
14+
15+
///<summary>
16+
/// Images produced by <c>satdump gk2a plugin</c> for GK-2A images.
17+
/// </summary>
18+
SatDumpGK2APlugin,
19+
1520
/// <summary>
1621
/// Images produced for Electro-L N2 images.
1722
/// </summary>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Text.RegularExpressions;
2+
3+
namespace Sanchez.Processing.Services.Filesystem.Parsers;
4+
5+
/// <summary>
6+
/// Parses filenames of satellite imagery received from GK-2A and processed by <c>xrit-rc</c>.
7+
/// </summary>
8+
public class Gk2ASatDumpVariantFilenameParser : AbstractFilenameParser
9+
{
10+
protected override Regex Regex { get; }
11+
12+
protected override string TimestampFormat => "yyyyMMddTHHmmssZ";
13+
14+
public Gk2ASatDumpVariantFilenameParser(string? prefix, string? suffix)
15+
{
16+
Regex = new Regex(prefix + "([0-9]{8}T[0-9]{6}Z)" + suffix + "\\.[^ ]*", RegexOptions.Compiled);
17+
}
18+
}

Diff for: Sanchez/Resources/Satellites.json

+13
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,19 @@
6262
0.006363
6363
]
6464
},
65+
{
66+
"DisplayName": "GEO-KOMPSAT-2A-SatDump-Variant",
67+
"FilenamePrefix": "^GK2A_IR105_",
68+
"FilenameParser": "SatDumpGK2APlugin",
69+
"Longitude": 128.2,
70+
"Brightness": 0.97,
71+
"Crop": [
72+
0.006363,
73+
0.006363,
74+
0.006363,
75+
0.006363
76+
]
77+
},
6578
{
6679
"DisplayName": "Electro-L N2",
6780
"FilenameSuffix": "[1-3]",

0 commit comments

Comments
 (0)