diff --git a/src/mir/repres/proxy/HEALPix.cc b/src/mir/repres/proxy/HEALPix.cc index 1b612e680..670f06a37 100644 --- a/src/mir/repres/proxy/HEALPix.cc +++ b/src/mir/repres/proxy/HEALPix.cc @@ -18,6 +18,7 @@ #include #include +#include "eckit/log/JSON.h" #include "eckit/types/FloatCompare.h" #include "atlas/interpolation/method/knn/GridBox.h" @@ -275,6 +276,11 @@ void HEALPix::fillJob(api::MIRJob&) const { } +void HEALPix::json(eckit::JSON& j) const { + j << "grid" << name(); +} + + void HEALPix::print(std::ostream& out) const { out << "HEALPix[name=" << name() << "]"; } diff --git a/src/mir/repres/proxy/HEALPix.h b/src/mir/repres/proxy/HEALPix.h index c81bd5eb4..e62f48aef 100644 --- a/src/mir/repres/proxy/HEALPix.h +++ b/src/mir/repres/proxy/HEALPix.h @@ -106,6 +106,7 @@ class HEALPix final : public ProxyGrid { void fillMeshGen(util::MeshGeneratorParameters&) const override; void fillJob(api::MIRJob&) const override; + void json(eckit::JSON&) const override; void print(std::ostream&) const override; std::vector gridBoxes() const override; diff --git a/src/mir/repres/unsupported/HEALPixNested.cc b/src/mir/repres/unsupported/HEALPixNested.cc index 385e0a092..3100a237e 100644 --- a/src/mir/repres/unsupported/HEALPixNested.cc +++ b/src/mir/repres/unsupported/HEALPixNested.cc @@ -14,6 +14,8 @@ #include +#include "eckit/log/JSON.h" + #include "mir/iterator/UnstructuredIterator.h" #include "mir/util/Exceptions.h" #include "mir/util/Grib.h" @@ -23,8 +25,13 @@ namespace mir::repres::unsupported { +std::string HEALPixNested::name() const { + return "H" + std::to_string(ring_.Nside()) + "_nested"; +} + + void HEALPixNested::makeName(std::ostream& out) const { - out << "H" << std::to_string(ring_.Nside()) << "_nested"; + out << name(); } @@ -38,8 +45,13 @@ void HEALPixNested::fillGrib(grib_info& info) const { } +void HEALPixNested::json(eckit::JSON& j) const { + j << "grid" << name(); +} + + void HEALPixNested::print(std::ostream& out) const { - out << "HEALPixNested[name=" << "H" << std::to_string(ring_.Nside()) << "_nested" << "]"; + out << "HEALPixNested[name=" << name() << "]"; } diff --git a/src/mir/repres/unsupported/HEALPixNested.h b/src/mir/repres/unsupported/HEALPixNested.h index e982ad2e1..78507106b 100644 --- a/src/mir/repres/unsupported/HEALPixNested.h +++ b/src/mir/repres/unsupported/HEALPixNested.h @@ -63,6 +63,7 @@ class HEALPixNested final : public Gridded { // -- Methods inline const Representation& ring() const { return static_cast(ring_); } + std::string name() const; // -- Overridden methods @@ -77,6 +78,7 @@ class HEALPixNested final : public Gridded { void fillMeshGen(util::MeshGeneratorParameters& param) const override { ring().fillMeshGen(param); } void fillJob(api::MIRJob& job) const override { ring().fillJob(job); } + void json(eckit::JSON&) const override; void print(std::ostream&) const override; std::vector gridBoxes() const override;