Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/goesproc/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ bool loadHandlers(const toml::Value& v, Config& out) {
h.json = json->as<bool>();
}

auto exclude_txt = th->find("exclude_txt");
if (exclude_txt) {
h.exclude_txt = exclude_txt->as<bool>();
}

auto crop = th->find("crop");
if (crop) {
auto vs = crop->as<std::vector<int>>();
Expand Down
3 changes: 3 additions & 0 deletions src/goesproc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
13 changes: 13 additions & 0 deletions src/goesproc/handler_emwin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ void EMWINHandler::handle(std::shared_ptr<const lrit::File> 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());
Expand All @@ -66,6 +73,12 @@ void EMWINHandler::handle(std::shared_ptr<const lrit::File> 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
Expand Down