Skip to content

Commit

Permalink
Add missing to Encoding of Levtype iceLayerOnWater (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefaniereuter authored Jan 7, 2025
1 parent 2c04b5d commit a3a6e75
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/multio/action/encode/GribEncoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,16 @@ void setSoilLayerTypeOfLevel(GribEncoder& g, const std::string& typeOfLevel, lon
g.setValue("scaledValueOfSecondFixedSurface", level);
}

void setMissingFixedSurface(GribEncoder& g, const std::string& typeOfLevel, long level) {
g.setValue("typeOfLevel", typeOfLevel);

g.setMissing(glossary().scaleFactorOfFirstFixedSurface);
g.setMissing(glossary().scaledValueOfFirstFixedSurface);
g.setMissing(glossary().scaleFactorOfSecondFixedSurface);
g.setMissing(glossary().scaledValueOfSecondFixedSurface);

}

using TypeOfLevelSetter = std::function<void(GribEncoder&, const std::string&, long)>;

const std::map<std::string, TypeOfLevelSetter> typeOfLevelSetters{
Expand All @@ -287,9 +297,9 @@ const std::map<std::string, TypeOfLevelSetter> typeOfLevelSetters{
{"lowCloudLayer", &setLevelUnrelatedTypeOfLevel},
{"highCloudLayer", &setLevelUnrelatedTypeOfLevel},
{"meanSea", &setLevelUnrelatedTypeOfLevel},
{"iceLayerOnWater", &setMissingFixedSurface},
};


template <typename Dict>
QueriedMarsKeys setMarsKeys(GribEncoder& g, const Dict& md) {
QueriedMarsKeys ret;
Expand Down Expand Up @@ -849,6 +859,7 @@ void GribEncoder::setOceanMetadata(message::Metadata& md) {
setValue("scaleFactorOfFirstFixedSurface", 0l);
}


std::string gridType;
const auto searchGridType = md.find(glossary().gridType);
if (searchGridType != md.end() && searchGridType->second.get<std::string>() == "unstructured_grid") {
Expand Down

0 comments on commit a3a6e75

Please sign in to comment.