Skip to content

Commit

Permalink
MIR-645 HEALPix support for earthkit-regrid
Browse files Browse the repository at this point in the history
  • Loading branch information
pmaciel committed Feb 29, 2024
1 parent f15a0e5 commit 0707738
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/mir/repres/proxy/HEALPix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <ostream>
#include <tuple>

#include "eckit/log/JSON.h"
#include "eckit/types/FloatCompare.h"

#include "atlas/interpolation/method/knn/GridBox.h"
Expand Down Expand Up @@ -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() << "]";
}
Expand Down
1 change: 1 addition & 0 deletions src/mir/repres/proxy/HEALPix.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<util::GridBox> gridBoxes() const override;
Expand Down
16 changes: 14 additions & 2 deletions src/mir/repres/unsupported/HEALPixNested.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include <ostream>

#include "eckit/log/JSON.h"

#include "mir/iterator/UnstructuredIterator.h"
#include "mir/util/Exceptions.h"
#include "mir/util/Grib.h"
Expand All @@ -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();
}


Expand All @@ -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() << "]";
}


Expand Down
2 changes: 2 additions & 0 deletions src/mir/repres/unsupported/HEALPixNested.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class HEALPixNested final : public Gridded {
// -- Methods

inline const Representation& ring() const { return static_cast<const Representation&>(ring_); }
std::string name() const;

// -- Overridden methods

Expand All @@ -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<util::GridBox> gridBoxes() const override;
Expand Down

0 comments on commit 0707738

Please sign in to comment.