diff --git a/src/metkit/codes/api/CodesAPI.cc b/src/metkit/codes/api/CodesAPI.cc index 9137ccb1..dff4cc05 100644 --- a/src/metkit/codes/api/CodesAPI.cc +++ b/src/metkit/codes/api/CodesAPI.cc @@ -407,7 +407,12 @@ std::vector OwningCodesHandle::getStringArray(const std::string& ke std::vector OwningCodesHandle::getBytes(const std::string& key) const { std::vector ret; - std::size_t ksize = length(key) / 2; + /// Note: The returned length for bytes often is much higher than needed. + /// For UIDs (i.e. "uuidOfHGrid"), the native type is BYTES, but length returns the number of characters in its + /// string representation - which is twice the number of bytes. However, in contrast for fields like "bitmap" it + /// directly returns the number of bytes. It has been discussed with Shahram several times without a change taking + /// in. + std::size_t ksize = length(key); ret.resize(ksize); throwOnError(codes_get_bytes(raw(), key.c_str(), ret.data(), &ksize), Here(), "CodesHandle::getBytes(string)", key); ret.resize(ksize); diff --git a/src/metkit/mars2grib/backend/concepts/representation/representationEncoding.h b/src/metkit/mars2grib/backend/concepts/representation/representationEncoding.h index f3c969ad..f9747d47 100644 --- a/src/metkit/mars2grib/backend/concepts/representation/representationEncoding.h +++ b/src/metkit/mars2grib/backend/concepts/representation/representationEncoding.h @@ -440,14 +440,14 @@ void RepresentationOp(const MarsDict_t& mars, const ParDict_t& par, const OptDic const auto* grid = dynamic_cast(genericGrid.get()); const auto nside = static_cast(grid->Nside()); - const auto orderingConvention = grid->order() == eckit::geo::order::HEALPix::RING ? 0L : 1L; + const auto orderingConvention = grid->order(); const auto longitudeOfFirstGridPointInDegrees = std::get(grid->first_point()).lon(); // Encoding set_or_throw(out, "resolutionAndComponentFlags", 0); // Flag table 3.3 - set_or_throw(out, "nside", nside); - set_or_throw(out, "orderingConvention", orderingConvention); + set_or_throw(out, "Nside", nside); + set_or_throw(out, "orderingConvention", orderingConvention); set_or_throw(out, "longitudeOfFirstGridPointInDegrees", longitudeOfFirstGridPointInDegrees); } else if constexpr (Variant == RepresentationType::Orca) { diff --git a/src/metkit/mars2grib/backend/concepts/representation/representationMatcher.h b/src/metkit/mars2grib/backend/concepts/representation/representationMatcher.h index ab226695..aa8a4d53 100644 --- a/src/metkit/mars2grib/backend/concepts/representation/representationMatcher.h +++ b/src/metkit/mars2grib/backend/concepts/representation/representationMatcher.h @@ -36,6 +36,9 @@ std::size_t representationMatcher(const MarsDict_t& mars, const OptDict_t& opt) else if (gridType == "ORCA") { return static_cast(RepresentationType::Orca); } + else if (gridType == "healpix") { + return static_cast(RepresentationType::Healpix); + } throw utils::exceptions::Mars2GribMatcherException( "Cannot match grid \"" + marsGrid + "\" with grid type \"" + gridType + "\"! ", Here());