Skip to content

Commit 27745b2

Browse files
committed
Added config option for EMWIN handler to disable output of TXT files
1 parent ca5a7e7 commit 27745b2

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

src/goesproc/config.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ bool loadHandlers(const toml::Value& v, Config& out) {
174174
h.json = json->as<bool>();
175175
}
176176

177+
auto exclude_txt = th->find("exclude_txt");
178+
if (exclude_txt) {
179+
h.exclude_txt = exclude_txt->as<bool>();
180+
}
181+
177182
auto crop = th->find("crop");
178183
if (crop) {
179184
auto vs = crop->as<std::vector<int>>();

src/goesproc/config.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ struct Config {
5151
// Write LRIT header contents as JSON file.
5252
bool json = false;
5353

54+
// Exclude TXT files from EMWIN.
55+
bool exclude_txt = false;
56+
5457
// Crop (applied before scaling)
5558
Area crop;
5659

src/goesproc/handler_emwin.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ void EMWINHandler::handle(std::shared_ptr<const lrit::File> f) {
5050
auto zip = Zip(f->getData());
5151
fb.filename = zip.fileName();
5252

53+
// Don't write file if EMWIN TXT is disabled in config
54+
if (config_.exclude_txt) {
55+
if (fb.filename.substr(fb.filename.length() - 3) == "TXT") {
56+
return;
57+
}
58+
}
59+
5360
// Use filename and extension straight from ZIP file
5461
const auto path = fb.build("{filename}");
5562
fileWriter_->write(path, zip.read());
@@ -61,6 +68,12 @@ void EMWINHandler::handle(std::shared_ptr<const lrit::File> f) {
6168

6269
// Write with TXT extension if this is not a compressed file
6370
if (nlh.noaaSpecificCompression == 0) {
71+
72+
// Don't write file if EMWIN TXT is disabled in config
73+
if (config_.exclude_txt) {
74+
return;
75+
}
76+
6477
auto filename = removeSuffix(f->getHeader<lrit::AnnotationHeader>().text);
6578
fb.filename = filename;
6679

0 commit comments

Comments
 (0)