Skip to content

Commit

Permalink
Added SkipWeatherData flag
Browse files Browse the repository at this point in the history
*	Fix for #42
  • Loading branch information
racerxdl committed May 13, 2017
1 parent e3569cb commit 96e4e1a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
5 changes: 4 additions & 1 deletion goesdump/GoesDecoder/FileHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ public static class FileHandler {

public static bool SkipDCS { get; set; }
public static bool SkipEMWIN { get; set; }
public static bool SkipWeatherData { get; set; }


static FileHandler() {
byProductIdHandler = new Dictionary<int, FileHandlerFunction>();
byCompressionTypeHandler = new Dictionary<int, FileHandlerFunction>();
SkipDCS = false;
SkipEMWIN = false;
SkipWeatherData = false;
}

public static void AttachByCompressionHandler(int compressionType, FileHandlerFunction handler) {
Expand Down Expand Up @@ -53,7 +55,8 @@ public static void DefaultHandler(string filename, XRITHeader fileHeader) {
if (
(fileHeader.Product.ID == (int)NOAAProductID.DCS && SkipDCS) ||
(fileHeader.Product.ID == (int)NOAAProductID.EMWIN && SkipEMWIN) ||
(fileHeader.Product.ID == (int)NOAAProductID.HRIT_EMWIN && SkipEMWIN)
(fileHeader.Product.ID == (int)NOAAProductID.HRIT_EMWIN && SkipEMWIN) ||
(fileHeader.Product.ID == (int)NOAAProductID.WEATHER_DATA && SkipWeatherData)
) {
try {
File.Delete(filename);
Expand Down
5 changes: 4 additions & 1 deletion goesdump/GoesDecoder/PacketManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,10 @@ public static string DumpFile(string filename, XRITHeader fileHeader, string new
string f = FixFileFolder(dir, fileHeader.Filename, fileHeader.Product, fileHeader.SubProduct);
f = f.Replace(".lrit", "." + newExt);

if (FileHandler.SkipEMWIN && fileHeader.Product.ID == (int)NOAAProductID.HRIT_EMWIN) {
if (
FileHandler.SkipEMWIN && fileHeader.Product.ID == (int)NOAAProductID.HRIT_EMWIN ||
FileHandler.SkipWeatherData && f.Contains(WeatherDataFolder)
) {
try {
File.Delete(filename);
} catch (Exception) {
Expand Down
2 changes: 2 additions & 0 deletions goesdump/HeadlessMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ public HeadlessMain() {
config.SysLogServer = config.SysLogServer;
config.SysLogFacility = config.SysLogFacility;
config.UseNOAAFormat = config.UseNOAAFormat;
config.EnableWeatherData = config.EnableWeatherData;
config.Save();
#endregion

FileHandler.SkipEMWIN = !config.EnableEMWIN;
FileHandler.SkipDCS = !config.EnableDCS;
FileHandler.SkipWeatherData = !config.EnableWeatherData;
ImageManager.EraseFiles = config.EraseFilesAfterGeneratingFalseColor;
ImageManager.GenerateInfrared = config.GenerateInfraredImages;
ImageManager.GenerateVisible = config.GenerateVisibleImages;
Expand Down
2 changes: 2 additions & 0 deletions goesdump/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public Main() {
config.SysLogServer = config.SysLogServer;
config.SysLogFacility = config.SysLogFacility;
config.UseNOAAFormat = config.UseNOAAFormat;
config.EnableWeatherData = config.EnableWeatherData;
config.Save();
#endregion

Expand All @@ -86,6 +87,7 @@ public Main() {

FileHandler.SkipEMWIN = !config.EnableEMWIN;
FileHandler.SkipDCS = !config.EnableDCS;
FileHandler.SkipWeatherData = !config.EnableWeatherData;
ImageManager.EraseFiles = config.EraseFilesAfterGeneratingFalseColor;
ImageManager.GenerateInfrared = config.GenerateInfraredImages;
ImageManager.GenerateVisible = config.GenerateVisibleImages;
Expand Down
8 changes: 8 additions & 0 deletions goesdump/Models/ProgConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public bool UseNOAAFormat {
get { return (bool)this["UseNOAAFormat"]; }
set { this["UseNOAAFormat"] = value; }
}

#endregion

#region Packet Processing
Expand All @@ -154,6 +155,13 @@ public bool EnableEMWIN {
get { return (bool)this["EnableEMWIN"]; }
set { this["EnableEMWIN"] = value; }
}

[UserScopedSettingAttribute()]
[DefaultSettingValueAttribute("true")]
public bool EnableWeatherData {
get { return (bool)this["EnableWeatherData"]; }
set { this["EnableWeatherData"] = value; }
}
#endregion

#region Syslog Configuration
Expand Down

0 comments on commit 96e4e1a

Please sign in to comment.