diff --git a/src/goesproc/config.cc b/src/goesproc/config.cc index 40e31e27..6fe4dd96 100644 --- a/src/goesproc/config.cc +++ b/src/goesproc/config.cc @@ -174,6 +174,11 @@ bool loadHandlers(const toml::Value& v, Config& out) { h.json = json->as(); } + auto exclude_txt = th->find("exclude_txt"); + if (exclude_txt) { + h.exclude_txt = exclude_txt->as(); + } + auto crop = th->find("crop"); if (crop) { auto vs = crop->as>(); diff --git a/src/goesproc/config.h b/src/goesproc/config.h index 1591f1e6..31b888f8 100644 --- a/src/goesproc/config.h +++ b/src/goesproc/config.h @@ -51,6 +51,9 @@ struct Config { // Write LRIT header contents as JSON file. bool json = false; + // Exclude TXT files from EMWIN. + bool exclude_txt = false; + // Crop (applied before scaling) Area crop; diff --git a/src/goesproc/handler_emwin.cc b/src/goesproc/handler_emwin.cc index 16b47636..1c931387 100644 --- a/src/goesproc/handler_emwin.cc +++ b/src/goesproc/handler_emwin.cc @@ -52,6 +52,13 @@ void EMWINHandler::handle(std::shared_ptr f) { auto zip = Zip(f->getData()); fb.filename = zip.fileName(); + // Don't write file if EMWIN TXT is disabled in config + if (config_.exclude_txt) { + if (fb.filename.substr(fb.filename.length() - 3) == "TXT") { + return; + } + } + // Use filename and extension straight from ZIP file const auto path = fb.build("{filename}"); fileWriter_->write(path, zip.read()); @@ -66,6 +73,12 @@ void EMWINHandler::handle(std::shared_ptr f) { // Write with TXT extension if this is not a compressed file if (nlh.noaaSpecificCompression == 0) { + + // Don't write file if EMWIN TXT is disabled in config + if (config_.exclude_txt) { + return; + } + fb.filename = removeSuffix(text); // Compressed TXT files also use the uppercase TXT extension