|
30 | 30 | #include "eckit/option/SimpleOption.h" |
31 | 31 | #include "metkit/codes/CodesContent.h" |
32 | 32 | #include "metkit/codes/api/CodesAPI.h" |
33 | | -#include "multio/LibMultio.h" |
| 33 | +#include "metkit/mars2grib/api/Grib2Encoder.h" |
34 | 34 | #include "multio/datamod/AtlasGeo.h" |
35 | 35 | #include "multio/datamod/core/Record.h" |
36 | 36 | #include "multio/tools/MultioTool.h" |
37 | 37 |
|
38 | 38 | #include "multio/datamod/ContainerInterop.h" |
39 | 39 | #include "multio/datamod/MarsMiscGeo.h" |
40 | | -#include "multio/mars2grib/api/RawAPI.h" |
41 | 40 | #include "multio/mars2mars/Rules.h" |
42 | 41 | #include "multio/util/Print.h" |
43 | 42 |
|
@@ -1005,7 +1004,7 @@ void Grib1ToGrib2::execute(const eckit::option::CmdArgs& args) { |
1005 | 1004 | // optDict.set("print-whole-error-stack", std::to_string(verbosity_ > 1 ? 1 : 0)); |
1006 | 1005 | // optDict.set("print-dictionaries", std::to_string(verbosity_ > 1 ? 1 : 0)); |
1007 | 1006 |
|
1008 | | - mars2grib::Mars2GribRaw mars2grib{}; |
| 1007 | + metkit::mars2grib::Grib2Encoder encoder{}; |
1009 | 1008 |
|
1010 | 1009 | eckit::message::Message msg; |
1011 | 1010 | while ((msg = reader.next())) { |
@@ -1129,9 +1128,14 @@ void Grib1ToGrib2::execute(const eckit::option::CmdArgs& args) { |
1129 | 1128 | datamod::applyRecordDefaults(misc); |
1130 | 1129 | datamod::validateRecord(misc); |
1131 | 1130 |
|
1132 | | - std::unique_ptr<metkit::codes::CodesHandle> preparedHandle = mars2grib.getHandle(mars, misc, geo); |
1133 | | - preparedHandle->set("values", values); |
| 1131 | + // Convert mars/misc/geo to eckit::LocalConfiguration |
| 1132 | + const auto marsConfig = dm::dumpRecord<eckit::LocalConfiguration>(mars); |
| 1133 | + const auto miscConfig = dm::dumpRecord<eckit::LocalConfiguration>(misc); |
| 1134 | + const auto geomConfig |
| 1135 | + = std::visit([](const auto& geomRec) { return dm::dumpRecord<eckit::LocalConfiguration>(geomRec); }, geo); |
1134 | 1136 |
|
| 1137 | + // Call the GRIB2 encoder in metkit |
| 1138 | + auto preparedHandle = encoder.encode(marsConfig, miscConfig, geomConfig, values); |
1135 | 1139 |
|
1136 | 1140 | // Apply more changes |
1137 | 1141 | extract::postFixToolOnly(*inputHandle.get(), *preparedHandle.get()); |
|
0 commit comments