"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/metgm/MetGmCDMWriterImpl.cc" between
fimex-1.4.1.tar.gz and fimex-1.4.2.tar.gz

About: Fimex is a the File Interpolation, Manipulation and EXtraction library for gridded geospatial data. It converts between different, extensible dataformats (currently netcdf, NcML, grib1/2 and felt).

MetGmCDMWriterImpl.cc  (fimex-1.4.1):MetGmCDMWriterImpl.cc  (fimex-1.4.2)
/* /*
* Fimex * Fimex
* *
* (C) Copyright 2011, met.no * (C) Copyright 2011-2019, met.no
* *
* Project Info: https://wiki.met.no/fimex/start * Project Info: https://wiki.met.no/fimex/start
* *
* This library is free software; you can redistribute it and/or modify it * This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by * under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or * the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, but * This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
skipping to change at line 28 skipping to change at line 28
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA. * USA.
*/ */
#include "MetGmCDMWriterImpl.h" #include "MetGmCDMWriterImpl.h"
// private/implementation code // private/implementation code
// //
#include "MetGmTags.h" #include "MetGmCommentAttributeParser.h"
#include "MetGmUtils.h"
#include "MetGmVersion.h"
#include "MetGmHandlePtr.h"
#include "MetGmGroup1Ptr.h" #include "MetGmGroup1Ptr.h"
#include "MetGmGroup2Ptr.h" #include "MetGmGroup2Ptr.h"
#include "MetGmGroup3Ptr.h" #include "MetGmGroup3Ptr.h"
#include "MetGmGroup5Ptr.h" #include "MetGmVersion.h"
#include "MetGmFileHandlePtr.h"
#include "MetGmConfigurationMappings.h"
// METGM C Lib
#include "metgm.h"
// fimex // fimex
// //
#include "fimex/CDM.h" #include "fimex/CDM.h"
#include "fimex/Data.h"
#include "fimex/SharedArray.h" #include "fimex/SharedArray.h"
#include "fimex/String2Type.h" #include "fimex/String2Type.h"
#include "fimex/Units.h" #include "fimex/Units.h"
#include "fimex/interpolation.h" #include "fimex/XMLDoc.h"
#include "fimex/min_max.h"
// udunits
#include <udunits2.h>
// libxml2 // libxml2
#include <libxml/tree.h> #include <libxml/tree.h>
#include <libxml/xpath.h> #include <libxml/xpath.h>
// standard // standard
#include <algorithm>
#include <cassert>
#include <cmath> #include <cmath>
#include <cstdio>
#include <deque>
#include <limits>
#include <map>
#include <memory> #include <memory>
#include <numeric>
#include <set>
namespace MetNoFimex { namespace MetNoFimex {
#define FREE_TEXT "metgm_free_text"
#define VERSION "metgm_version"
#define ANALYSIS_DATE_TIME "metgm_analysis_date_time"
#define START_DATE_TIME "metgm_start_date_time"
#define DATA_TYPE "metgm_data_type"
#define MODEL_TYPE "metgm_model_type"
#define PRODUCTION_NATION "metgm_production_nation"
typedef std::shared_ptr<MetGmTags> MetGmTagsPtr; typedef std::shared_ptr<MetGmTags> MetGmTagsPtr;
void MetGmCDMWriterImpl::configure(const std::unique_ptr<XMLDoc>& doc) MetGmCDMWriterImpl::MetGmCDMWriterImpl(CDMReader_p cdmReader, const std::string&
outputFile, const std::string& configFile)
: CDMWriter(cdmReader, outputFile)
{
if (configFile.empty())
throw CDMException("Please supply xml config file the MetGm writer has t
o be informed how are pids mapped to actual CDM variables");
xmlConfig_.reset(new XMLDoc(configFile));
}
MetGmCDMWriterImpl::~MetGmCDMWriterImpl() {}
void MetGmCDMWriterImpl::configureAndWrite()
{ {
if (!doc.get()) metgmTimeTag_ = MetGmTimeTag::createMetGmTimeTagGlobal(cdmReader);
throw CDMException("Please supply xml config file the MetGmReader has to metgmVersion_ = MetGmVersion::createMetGmVersion(xmlConfig_);
be informed how are pids mapped to actual CDM variables"); metgmFileHandle_ = MetGmFileHandlePtr::createMetGmFileHandlePtrForWriting(ou
tputFile);
metgmHandle_ = MetGmHandlePtr::createMetGmHandleForWriting(metgmFileHandle_,
metgmVersion_);
configure(xmlConfig_);
init();
write();
}
void MetGmCDMWriterImpl::configure(const std::unique_ptr<XMLDoc>& doc)
{
const CDM& cdmRef = cdmReader->getCDM(); const CDM& cdmRef = cdmReader->getCDM();
// start metgm_parameter // start metgm_parameter
xmlXPathObject_p xpathObj = doc->getXPathObject("/metgm_config/writer/metgm_ parameter"); xmlXPathObject_p xpathObj = doc->getXPathObject("/metgm_config/writer/metgm_ parameter");
xmlNodeSetPtr nodes = xpathObj->nodesetval; xmlNodeSetPtr nodes = xpathObj->nodesetval;
size_t size = (nodes) ? nodes->nodeNr : 0; size_t size = (nodes) ? nodes->nodeNr : 0;
for (size_t i = 0; i < size; ++i) { for (size_t i = 0; i < size; ++i) {
xmlNodePtr node = nodes->nodeTab[i]; xmlNodePtr node = nodes->nodeTab[i];
std::string metgmName = getXmlProp(node, "name"); std::string metgmName = getXmlProp(node, "name");
skipping to change at line 183 skipping to change at line 174
std::string kildeName = getXmlProp(node, "name"); std::string kildeName = getXmlProp(node, "name");
if (kildeName.empty()) { if (kildeName.empty()) {
continue; continue;
} }
if (!cdmRef.hasVariable(kildeName)) { if (!cdmRef.hasVariable(kildeName)) {
continue; continue;
} }
xmlXPathObject_p xpathObj = doc->getXPathObject("/metgm_config/writer/va riable[@name=\"" + kildeName + "\"]/attribute[@name=\"metgm_p_id\"]"); xmlXPathObject_p xpathObj = doc->getXPathObject("/metgm_config/writer/va riable[@name=\"" + kildeName + "\"]/attribute[@name=\"metgm_p_id\"]");
std::string str_p_id;
short p_id = 0; short p_id = 0;
if (xpathObj->nodesetval && xpathObj->nodesetval->nodeNr > 0) { if (xpathObj->nodesetval && xpathObj->nodesetval->nodeNr > 0) {
str_p_id = getXmlProp(xpathObj->nodesetval->nodeTab[0], "value"); const std::string str_p_id = getXmlProp(xpathObj->nodesetval->nodeTa b[0], "value");
if (str_p_id.empty()) { if (str_p_id.empty()) {
continue; continue;
} }
p_id = string2type<size_t>(str_p_id); p_id = string2type<size_t>(str_p_id);
} else { } else {
continue; continue;
} }
xpathObj = doc->getXPathObject("/metgm_config/writer/metgm_parameter[@na me=\"" + kildeName + "\"]/attribute[@name=\"units\"]"); xpathObj = doc->getXPathObject("/metgm_config/writer/metgm_parameter[@na me=\"" + kildeName + "\"]/attribute[@name=\"units\"]");
std::string str_units; std::string str_units;
skipping to change at line 230 skipping to change at line 220
cfgEntry.addOffset_ = getXmlProp(xpathObj->nodesetval->nodeTab[0], " value"); cfgEntry.addOffset_ = getXmlProp(xpathObj->nodesetval->nodeTab[0], " value");
} }
xpathObj = doc->getXPathObject("/metgm_config/writer/variable[@name=\"" + kildeName + "\"]/attribute[@name=\"scale_factor\"]"); xpathObj = doc->getXPathObject("/metgm_config/writer/variable[@name=\"" + kildeName + "\"]/attribute[@name=\"scale_factor\"]");
if (xpathObj->nodesetval && xpathObj->nodesetval->nodeNr > 0) { if (xpathObj->nodesetval && xpathObj->nodesetval->nodeNr > 0) {
cfgEntry.scaleFactor_ = getXmlProp(xpathObj->nodesetval->nodeTab[0], "value"); cfgEntry.scaleFactor_ = getXmlProp(xpathObj->nodesetval->nodeTab[0], "value");
} }
xmlConfiguration_.insert(cfgEntry); xmlConfiguration_.insert(cfgEntry);
} }
} }
void MetGmCDMWriterImpl::writeGroup0Data()
{
MGM_THROW_ON_ERROR(mgm_set_version(*metgmHandle_, *metgmVersion_));
}
void MetGmCDMWriterImpl::writeGroup1Data()
{
std::shared_ptr<MetGmGroup1Ptr> pg1 = MetGmGroup1Ptr::createMetGmGroup1P
trForWriting(cdmReader);
MGM_THROW_ON_ERROR(mgm_set_analysis_date_time(*metgmHandle_, pg1->analys void MetGmCDMWriterImpl::init()
isTime())) {
for (xml_configuration::const_iterator pIt : sorted_by_pid(xmlConfiguration_
MGM_THROW_ON_ERROR(mgm_set_start_date_time(*metgmHandle_, pg1->startTime )) {
())) const MetGmConfigurationMappings& entry = *pIt;
MGM_THROW_ON_ERROR(mgm_set_free_text(*metgmHandle_, pg1->freeText().c_st if (std::find_if(cdmConfiguration_.begin(), cdmConfiguration_.end(), Met
r())) GmCDMVariableProfileEqName(entry.cdmName_)) != cdmConfiguration_.end()) {
throw CDMException("hmmm... the variable should not be found in cdm
profile map");
}
MGM_THROW_ON_ERROR(mgm_set_data_type(*metgmHandle_, pg1->dataType())) const CDMVariable* pVariable = &cdmReader->getCDM().getVariable(entry.cd mName_);
MGM_THROW_ON_ERROR(mgm_set_model_type(*metgmHandle_, pg1->modelType().c_ MetGmTagsPtr tags = MetGmTags::createMetGmTagsForWriting(cdmReader, pVar
str())) iable, metgmHandle_, entry.p_id_);
assert(tags.get());
MGM_THROW_ON_ERROR(mgm_set_production_nation(*metgmHandle_, pg1->product if (!tags->data()) {
Nation().c_str())) continue;
}
MetGmCDMVariableProfile profile(entry.p_id_, entry.cdmName_, tags);
cdmConfiguration_.push_back(profile);
} }
}
void MetGmCDMWriterImpl::writeGroup2Data() void MetGmCDMWriterImpl::write()
{ {
const short np = cdmConfiguration_.size(); writeGroup0Data();
writeGroup1Data();
MGM_THROW_ON_ERROR(mgm_set_number_of_params(*metgmHandle_, np)) writeGroup2Data();
if(*metgmVersion_ == MGM_Edition2) {
std::set<short> uniquePid;
for (const MetGmCDMVariableProfile& profile : cdmConfiguration_)
uniquePid.insert(profile.p_id_);
const short ndp = uniquePid.size();
MGM_THROW_ON_ERROR(mgm_set_number_of_dist_params(*metgmHandle_, ndp) ) writeHeader();
size_t index = 0; const CDM& cdmRef = cdmReader->getCDM();
for (const short p_id : uniquePid) { for (const auto& profile : cdmConfiguration_) {
const CDMVariable* pVariable = &cdmRef.getVariable(profile.cdmName_);
writeGroup3Data(profile);
writeGroup4Data(profile);
writeGroup5Data(profile, pVariable);
}
}
++index; void MetGmCDMWriterImpl::writeGroup0Data()
{
MGM_THROW_ON_ERROR(mgm_set_version(*metgmHandle_, *metgmVersion_));
}
const MetGmCDMVariableProfileEqPId byPId(p_id); void MetGmCDMWriterImpl::writeGroup1Data()
cdm_configuration::const_iterator pIt = std::find_if(cdmConfigur {
ation_.begin(), cdmConfiguration_.end(), byPId), nIt = pIt; std::shared_ptr<MetGmGroup1Ptr> pg1 = MetGmGroup1Ptr::createMetGmGroup1PtrFo
size_t ndpr = 1; rWriting(cdmReader);
while ((nIt = std::find_if(++nIt, cdmConfiguration_.end(), byPId MGM_THROW_ON_ERROR(mgm_set_analysis_date_time(*metgmHandle_, pg1->analysisTi
)) != cdmConfiguration_.end()) me()))
ndpr += 1; MGM_THROW_ON_ERROR(mgm_set_start_date_time(*metgmHandle_, pg1->startTime()))
MGM_THROW_ON_ERROR(mgm_set_free_text(*metgmHandle_, pg1->freeText().c_str())
)
MGM_THROW_ON_ERROR(mgm_set_data_type(*metgmHandle_, pg1->dataType()))
MGM_THROW_ON_ERROR(mgm_set_model_type(*metgmHandle_, pg1->modelType().c_str(
)))
MGM_THROW_ON_ERROR(mgm_set_production_nation(*metgmHandle_, pg1->productNati
on().c_str()))
}
MGM_THROW_ON_ERROR(mgm_set_param_id(*metgmHandle_, index, p_id)) void MetGmCDMWriterImpl::writeGroup2Data()
MGM_THROW_ON_ERROR(mgm_set_ndpr(*metgmHandle_, index, ndpr)) {
const short np = cdmConfiguration_.size();
/** MGM_THROW_ON_ERROR(mgm_set_number_of_params(*metgmHandle_, np))
* TODO: should HD be treated as CDMAttribute?
*
* the HD value should be highest for given parameter
*/
MGM_THROW_ON_ERROR(mgm_set_hd(*metgmHandle_, index, pIt->hd()))
}
}
}
void MetGmCDMWriterImpl::writeHeader() if (*metgmVersion_ == MGM_Edition2) {
{
MGM_THROW_ON_ERROR(mgm_write_header(*metgmFileHandle_, *metgmHandle_))
}
void MetGmCDMWriterImpl::writeGroup3TimeAxis(const CDMVariable* pVar) std::set<short> uniquePid;
{ for (const MetGmCDMVariableProfile& profile : cdmConfiguration_)
const MetGmTagsPtr& tags = std::find_if(cdmConfiguration_.begin(), cdmCo uniquePid.insert(profile.p_id_);
nfiguration_.end(), MetGmCDMVariableProfileEqName(pVar->getName()))->pTags_;
if(tags->tTag().get()) {
MGM_THROW_ON_ERROR(tags->set_nt(tags->tTag()->nT()))
MGM_THROW_ON_ERROR(tags->set_dt(tags->tTag()->dT()))
} else {
MGM_THROW_ON_ERROR(tags->set_nt(1))
MGM_THROW_ON_ERROR(tags->set_dt(metgmTimeTag_->dT() * metgmTimeTag_-
>nT()))
}
}
void MetGmCDMWriterImpl::writeGroup3HorizontalAxis(const CDMVariable* pVar) const short ndp = uniquePid.size();
{ MGM_THROW_ON_ERROR(mgm_set_number_of_dist_params(*metgmHandle_, ndp))
const MetGmTagsPtr& tags = std::find_if(cdmConfiguration_.begin(), cdmCo
nfiguration_.end(), MetGmCDMVariableProfileEqName(pVar->getName()))->pTags_;
// x
MGM_THROW_ON_ERROR(tags->set_dx(tags->xTag()->dx()));
MGM_THROW_ON_ERROR(tags->set_nx(tags->xTag()->nx()));
MGM_THROW_ON_ERROR(tags->set_cx(tags->xTag()->cx()));
// y
MGM_THROW_ON_ERROR(tags->set_dy(tags->yTag()->dy()));
MGM_THROW_ON_ERROR(tags->set_ny(tags->yTag()->ny()));
MGM_THROW_ON_ERROR(tags->set_cy(tags->yTag()->cy()));
}
void MetGmCDMWriterImpl::writeGroup3VerticalAxis(const CDMVariable* pVar) size_t index = 0;
{ for (const short p_id : uniquePid) {
const MetGmTagsPtr& tags = std::find_if(cdmConfiguration_.begin(), cdmCo
nfiguration_.end(), MetGmCDMVariableProfileEqName(pVar->getName()))->pTags_;
if(tags->zTag().get()) {
MGM_THROW_ON_ERROR(tags->set_nz(tags->zTag()->nz()));
MGM_THROW_ON_ERROR(tags->set_pr(tags->zTag()->pr()));
MGM_THROW_ON_ERROR(tags->set_pz(tags->zTag()->pz()));
} else {
MGM_THROW_ON_ERROR(tags->set_nz(1));
MGM_THROW_ON_ERROR(tags->set_pr(0));
MGM_THROW_ON_ERROR(tags->set_pz(1));
}
}
void MetGmCDMWriterImpl::writeGroup3Data(const CDMVariable* pVar) ++index;
{
writeGroup3TimeAxis(pVar);
writeGroup3HorizontalAxis(pVar); const MetGmCDMVariableProfileEqPId byPId(p_id);
writeGroup3VerticalAxis(pVar); size_t ndpr = std::count_if(cdmConfiguration_.begin(), cdmConfigurat ion_.end(), byPId);
cdm_configuration::iterator it = std::find_if(cdmConfiguration_.begin(), MGM_THROW_ON_ERROR(mgm_set_param_id(*metgmHandle_, index, p_id))
cdmConfiguration_.end(), MetGmCDMVariableProfileEqName(pVar->getName())); MGM_THROW_ON_ERROR(mgm_set_ndpr(*metgmHandle_, index, ndpr))
MGM_THROW_ON_ERROR(mgm_write_group3(*metgmFileHandle_, *metgmHandle_, *(
it)->pTags_->gp3()));
}
void MetGmCDMWriterImpl::writeGroup4Data(const CDMVariable* pVar) /**
{ * TODO: should HD be treated as CDMAttribute?
const MetGmTagsPtr& tags = std::find_if(cdmConfiguration_.begin(), cdmCo *
nfiguration_.end(), MetGmCDMVariableProfileEqName(pVar->getName()))->pTags_; * the HD value should be highest for given parameter
if (tags->zTag()) { */
MGM_THROW_ON_ERROR(mgm_write_group4(*metgmFileHandle_, *metgmHandle_ const cdm_configuration::iterator pEnd = cdmConfiguration_.end();
, tags->zTag()->points().get())); cdm_configuration::iterator pIt = std::find_if(cdmConfiguration_.beg
} else { in(), pEnd, byPId);
/* no z profile for variable */ const short hd = pIt->hd();
float f = 0; #if 1
MGM_THROW_ON_ERROR(mgm_write_group4 (*metgmFileHandle_, *metgmHandle for (cdm_configuration::iterator nIt = pIt; (nIt = std::find_if(++nI
_, &f)); t, pEnd, byPId)) != pEnd;) {
if (hd != nIt->hd())
throw CDMException("change in dimensionality");
}
#endif
MGM_THROW_ON_ERROR(mgm_set_hd(*metgmHandle_, index, hd))
} }
} }
}
void MetGmCDMWriterImpl::writeGroup5Data(const CDMVariable* pVar) void MetGmCDMWriterImpl::writeHeader()
{ {
const MetGmCDMVariableProfile& profile = MGM_THROW_ON_ERROR(mgm_write_header(*metgmFileHandle_, *metgmHandle_))
*std::find_if(cdmConfiguration_.begin(), cdmConfiguration_.end(), Me }
tGmCDMVariableProfileEqName(pVar->getName()));
MGM_THROW_ON_ERROR(mgm_write_group5 (*metgmFileHandle_, *metgmHandle_, p void MetGmCDMWriterImpl::writeGroup3TimeAxis(const MetGmTagsPtr& tags)
rofile.pTags_->data().get())); {
if (tags->tTag().get()) {
MGM_THROW_ON_ERROR(tags->set_nt(tags->tTag()->nT()))
MGM_THROW_ON_ERROR(tags->set_dt(tags->tTag()->dT()))
} else {
MGM_THROW_ON_ERROR(tags->set_nt(1))
MGM_THROW_ON_ERROR(tags->set_dt(metgmTimeTag_->dT() * metgmTimeTag_->nT(
)))
} }
}
void MetGmCDMWriterImpl::init() void MetGmCDMWriterImpl::writeGroup3HorizontalAxis(const MetGmTagsPtr& tags)
{ {
for (xml_configuration::const_iterator pIt : sorted_by_pid(xmlConfigurat // x
ion_)) { MGM_THROW_ON_ERROR(tags->set_dx(tags->xTag()->dx()));
const MetGmConfigurationMappings& entry = *pIt; MGM_THROW_ON_ERROR(tags->set_nx(tags->xTag()->nx()));
MGM_THROW_ON_ERROR(tags->set_cx(tags->xTag()->cx()));
MetGmTagsPtr tags; // y
MGM_THROW_ON_ERROR(tags->set_dy(tags->yTag()->dy()));
if (std::find_if(cdmConfiguration_.begin(), cdmConfiguration_.end(), MGM_THROW_ON_ERROR(tags->set_ny(tags->yTag()->ny()));
MetGmCDMVariableProfileEqName(entry.cdmName_)) != cdmConfiguration_.end()) { MGM_THROW_ON_ERROR(tags->set_cy(tags->yTag()->cy()));
throw CDMException("hmmm... the variable should not be found in }
cdm profile map");
}
const CDMVariable* pVariable = &cdmReader->getCDM().getVariable(entr
y.cdmName_);
tags = MetGmTags::createMetGmTagsForWriting(cdmReader, pVariable, me
tgmHandle_,
entry.p_id_, entry.fillV
alue_, entry.addOffset_, entry.scaleFactor_);
assert(tags.get());
if(tags->data().get() == 0) {
continue;
}
MetGmCDMVariableProfile profile(entry.p_id_, entry.cdmName_, tags);
cdmConfiguration_.insert(profile);
}
writeGroup0Data(); void MetGmCDMWriterImpl::writeGroup3VerticalAxis(const MetGmTagsPtr& tags)
writeGroup1Data(); {
writeGroup2Data(); if (tags->zTag().get()) {
MGM_THROW_ON_ERROR(tags->set_nz(tags->zTag()->nz()));
writeHeader(); MGM_THROW_ON_ERROR(tags->set_pr(tags->zTag()->pr()));
MGM_THROW_ON_ERROR(tags->set_pz(tags->zTag()->pz()));
const CDM& cdmRef = cdmReader->getCDM(); } else {
cdm_configuration::const_iterator varIt; MGM_THROW_ON_ERROR(tags->set_nz(1));
for(varIt = cdmConfiguration_.begin(); varIt != cdmConfiguration_.end(); MGM_THROW_ON_ERROR(tags->set_pr(0));
++varIt) { MGM_THROW_ON_ERROR(tags->set_pz(1));
const CDMVariable* pVariable = &cdmRef.getVariable(varIt->cdmName_);
writeGroup3Data(pVariable);
writeGroup4Data(pVariable);
writeGroup5Data(pVariable);
}
} }
}
MetGmCDMWriterImpl::MetGmCDMWriterImpl void MetGmCDMWriterImpl::writeGroup3Data(const MetGmCDMVariableProfile& profile)
( {
CDMReader_p cdmReader, const MetGmTagsPtr& tags = profile.pTags_;
const std::string& outputFile, writeGroup3TimeAxis(tags);
const std::string& configFile writeGroup3HorizontalAxis(tags);
) writeGroup3VerticalAxis(tags);
: CDMWriter(cdmReader, outputFile), configFileName_(conf MGM_THROW_ON_ERROR(mgm_write_group3(*metgmFileHandle_, *metgmHandle_, *tags-
igFile) >gp3()));
{ }
std::unique_ptr<XMLDoc> xmlDoc;
if (!configFileName_.empty()) {
xmlDoc.reset(new XMLDoc(configFileName_));
}
metgmTimeTag_ = MetGmTimeTag::createMetGmTimeTagGlobal(cdmReader);
metgmVersion_ = MetGmVersion::createMetGmVersion(xmlDoc);
metgmFileHandle_ = MetGmFileHandlePtr::createMetGmFileHandlePtrForWritin
g(outputFile);
metgmHandle_ = MetGmHandlePtr::createMetGmHandleForWriting(metgmFileHand
le_, metgmVersion_);
configure(xmlDoc);
init(); void MetGmCDMWriterImpl::writeGroup4Data(const MetGmCDMVariableProfile& profile)
{
if (std::shared_ptr<MetGmVerticalTag> ztag = profile.pTags_->zTag()) {
MGM_THROW_ON_ERROR(mgm_write_group4(*metgmFileHandle_, *metgmHandle_, zt
ag->points().get()));
} else {
/* no z profile for variable */
float f = 0;
MGM_THROW_ON_ERROR(mgm_write_group4(*metgmFileHandle_, *metgmHandle_, &f
));
} }
}
MetGmCDMWriterImpl::MetGmCDMWriterImpl(CDMReader_p cdmReader, const std::str void MetGmCDMWriterImpl::writeGroup5Data(const MetGmCDMVariableProfile& profile,
ing& outputFile) const CDMVariable*)
: CDMWriter(cdmReader, outputFile) {
{ } MGM_THROW_ON_ERROR(mgm_write_group5(*metgmFileHandle_, *metgmHandle_, profil
e.pTags_->data().get()));
MetGmCDMWriterImpl::~MetGmCDMWriterImpl() { } }
} // end namespace } // namespace MetNoFimex
 End of changes. 51 change blocks. 
248 lines changed or deleted 182 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)