@@ -173,6 +173,15 @@ std::string generateKey(const message::Message& msg, const std::string& cache_pa
173173
174174} // namespace
175175
176+
177+ Interpolate::Interpolate (const ComponentConfiguration& compConf) :
178+ ChainedAction (compConf),
179+ additionalMetadata_{message::toMetadata (
180+ compConf.parsedConfig ().has (" additional-metadata" )
181+ ? eckit::LocalConfiguration{compConf.parsedConfig ().getSubConfiguration (" additional-metadata" )}
182+ : eckit::LocalConfiguration{})} {}
183+
184+
176185void fill_out_metadata (const message::Metadata& in_md, message::Metadata& out_md) {
177186 for (const auto & kv : in_md) {
178187 if (std::find (metadata_black_list.cbegin (), metadata_black_list.cend (), kv.first )
@@ -182,6 +191,7 @@ void fill_out_metadata(const message::Metadata& in_md, message::Metadata& out_md
182191 }
183192};
184193
194+
185195message::MetadataValue getInputGrid (const eckit::LocalConfiguration& cfg, message::Metadata& md) {
186196 auto searchAtlasGridKind = md.find (" atlas-grid-kind" );
187197 if (searchAtlasGridKind != md.end ()) { // metadata has always precedence
@@ -402,7 +412,8 @@ void fill_job(const eckit::LocalConfiguration& cfg, mir::param::SimpleParametris
402412 }
403413 const auto & options = cfg.getSubConfiguration (" options" );
404414 const auto cache_path = cfg.getString (" cache-path" , " " );
405- const auto weights_file = generateKey<double >(msg, cache_path, grid[0 ], gridKind == " HEALPix_nested" ? " nested" : " ring" );
415+ const auto weights_file
416+ = generateKey<double >(msg, cache_path, grid[0 ], gridKind == " HEALPix_nested" ? " nested" : " ring" );
406417 destination.set (" interpolation-matrix" , weights_file);
407418 }
408419 }
@@ -425,14 +436,16 @@ message::Message Interpolate::InterpolateMessage<double>(message::Message&& msg)
425436
426437 message::Metadata md;
427438 fill_out_metadata (msg.metadata (), md);
439+ md.updateOverwrite (additionalMetadata_);
428440 md.set (dm::legacy::Precision, " double" );
429441
430442 mir::param::SimpleParametrisation inputPar;
431443 auto inp = getInputGrid (config, md);
432444 fill_input (config, inputPar, size, msg.metadata ().getOpt <std::string>(dm::legacy::Domain).value_or (" " ), inp);
433445 auto searchMissingValue = msg.metadata ().find (" missingValue" );
434446 auto searchBitmapPresent = msg.metadata ().find (" bitmapPresent" );
435- if (searchMissingValue != msg.metadata ().end () && searchBitmapPresent != msg.metadata ().end () && searchBitmapPresent->second .get <bool >()) {
447+ if (searchMissingValue != msg.metadata ().end () && searchBitmapPresent != msg.metadata ().end ()
448+ && searchBitmapPresent->second .get <bool >()) {
436449 inputPar.set (" missing_value" , searchMissingValue->second .get <double >());
437450 }
438451 else if (config.getSubConfiguration (" options" ).has (" missing_value" )) {
0 commit comments