"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/metgm/MetGmDimensionsTag.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).

MetGmDimensionsTag.cc  (fimex-1.4.1):MetGmDimensionsTag.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 39 skipping to change at line 39
#include "MetGmFileHandlePtr.h" #include "MetGmFileHandlePtr.h"
#include "MetGmHandlePtr.h" #include "MetGmHandlePtr.h"
#include "MetGmUtils.h" #include "MetGmUtils.h"
#include "metgm.h" #include "metgm.h"
namespace MetNoFimex { namespace MetNoFimex {
std::shared_ptr<MetGmHDTag> MetGmHDTag::createMetGmDimensionsTagForWriting(const CDMReader_p pCdmReader, const CDMVariable* pVariable) std::shared_ptr<MetGmHDTag> MetGmHDTag::createMetGmDimensionsTagForWriting(const CDMReader_p pCdmReader, const CDMVariable* pVariable)
{ {
std::shared_ptr<MetGmHDTag> tag = std::shared_ptr<MetGmHDTag>(new MetGmHDTag ); std::shared_ptr<MetGmHDTag> tag = std::shared_ptr<MetGmHDTag>(new MetGmHDTag );
tag->pXTag_ = MetGmHorizontalTag::createMetGmXTagForWriting(pCdmReader, pVar iable); tag->pXTag_ = MetGmHorizontalTag::createMetGmXTagForWriting(pCdmReader, pVar iable);
bool hasXAxis = tag->pXTag_.get() ? true : false; bool hasXAxis = tag->pXTag_ && tag->xTag()->nx() > 1;
tag->pYTag_ = MetGmHorizontalTag::createMetGmYTagForWriting(pCdmReader, pVar iable); tag->pYTag_ = MetGmHorizontalTag::createMetGmYTagForWriting(pCdmReader, pVar iable);
bool hasYAxis = tag->pYTag_.get() ? true : false; bool hasYAxis = tag->pYTag_ && tag->yTag()->ny() > 1;
tag->pZTag_ = MetGmVerticalTag::createMetGmVerticalTagForWriting(pCdmReader, pVariable); tag->pZTag_ = MetGmVerticalTag::createMetGmVerticalTagForWriting(pCdmReader, pVariable);
bool hasZAxis = tag->pZTag_.get() ? true : false; bool hasZAxis = tag->pZTag_ && tag->pZTag_->nz() > 1;
tag->pTTag_ = MetGmTimeTag::createMetGmTimeTagForWriting(pCdmReader, pVariab le); tag->pTTag_ = MetGmTimeTag::createMetGmTimeTagForWriting(pCdmReader, pVariab le);
bool hasTAxis = tag->pTTag_.get() ? true : false; bool hasTAxis = tag->pTTag_ && tag->pTTag_->nT() > 1;
if (hasZAxis && hasXAxis && hasYAxis) { if (hasZAxis && hasXAxis && hasYAxis) {
tag->hd_ = hasTAxis ? HD_3D_T : HD_3D; tag->hd_ = hasTAxis ? HD_3D_T : HD_3D;
} else if ((hasXAxis && hasYAxis) || (hasZAxis && hasYAxis) || (hasZAxis && hasXAxis)) { } else if ((hasXAxis && hasYAxis) || (hasZAxis && hasYAxis) || (hasZAxis && hasXAxis)) {
tag->hd_ = hasTAxis ? HD_2D_T : HD_2D; tag->hd_ = hasTAxis ? HD_2D_T : HD_2D;
} else if ((hasYAxis) || (hasXAxis) || (hasZAxis)) { } else if (hasYAxis || hasXAxis || hasZAxis) {
tag->hd_ = hasTAxis ? HD_1D_T : HD_1D; tag->hd_ = hasTAxis ? HD_1D_T : HD_1D;
} else { } else {
tag->hd_ = hasTAxis ? HD_0D_T : HD_0D; tag->hd_ = hasTAxis ? HD_0D_T : HD_0D;
} }
tag->sliceSize_ = (hasXAxis ? tag->pXTag_->nx() : 1) * (hasYAxis ? tag->pYTa g_->ny() : 1) * (hasZAxis ? tag->pZTag_->nz() : 1); tag->sliceSize_ = (hasXAxis ? tag->pXTag_->nx() : 1) * (hasYAxis ? tag->pYTa g_->ny() : 1) * (hasZAxis ? tag->pZTag_->nz() : 1);
tag->totalSize_ = tag->sliceSize() * ((hasTAxis) ? tag->pTTag_->nT() : 1); tag->totalSize_ = tag->sliceSize() * ((hasTAxis) ? tag->pTTag_->nT() : 1);
return tag; return tag;
} }
std::shared_ptr<MetGmHDTag> MetGmHDTag::createMetGmDimensionsTag(const std:: std::shared_ptr<MetGmHDTag> MetGmHDTag::createMetGmDimensionsTag(const std::shar
shared_ptr<MetGmGroup1Ptr> pGp1, const std::shared_ptr<MetGmGroup3Ptr> pGp3, ed_ptr<MetGmGroup1Ptr> pGp1, const std::shared_ptr<MetGmGroup3Ptr> pGp3,
const std:: const std::shar
shared_ptr<MetGmVerticalTag> vTag) ed_ptr<MetGmVerticalTag> vTag)
{ {
std::shared_ptr<MetGmHDTag> tag = std::shared_ptr<MetGmHDTag>(new MetGmH std::shared_ptr<MetGmHDTag> tag = std::shared_ptr<MetGmHDTag>(new MetGmHDTag
DTag); );
tag->pTTag_ = MetGmTimeTag::createMetGmTimeTagForReading(pGp1, pGp3);
tag->pTTag_ = MetGmTimeTag::createMetGmTimeTagForReading(pGp1, pGp3); tag->pXTag_ = MetGmHorizontalTag::createMetGmXTagForReading(pGp3);
tag->pXTag_ = MetGmHorizontalTag::createMetGmXTagForReading(pGp3); tag->pYTag_ = MetGmHorizontalTag::createMetGmYTagForReading(pGp3);
tag->pYTag_ = MetGmHorizontalTag::createMetGmYTagForReading(pGp3); tag->pZTag_ = MetGmVerticalTag::createMetGmVerticalTagForReading(pGp3, vTag)
tag->pZTag_ = MetGmVerticalTag::createMetGmVerticalTagForReading(pGp3, v ;
Tag);
bool hasXAxis = tag->pXTag_.get() ? true : false;
bool hasYAxis = tag->pYTag_.get() ? true : false;
bool hasZAxis = tag->pZTag_.get() ? true : false;
bool hasTAxis = tag->pTTag_.get() ? true : false;
if(hasZAxis && hasXAxis && hasYAxis) {
tag->hd_= hasTAxis ? HD_3D_T : HD_3D;
} else if((hasXAxis && hasYAxis) || (hasZAxis && hasYAxis) || (hasZAxis
&& hasXAxis)) {
tag->hd_= hasTAxis ? HD_2D_T : HD_2D;
} else if((hasYAxis) || (hasXAxis) || (hasZAxis)) {
tag->hd_= hasTAxis ? HD_1D_T : HD_1D;
} else {
tag->hd_= hasTAxis ? HD_0D_T : HD_0D;
}
tag->sliceSize_ = (hasXAxis ? tag->pXTag_->nx() : 1)
* (hasYAxis ? tag->pYTag_->ny() : 1)
* (hasZAxis ? tag->pZTag_->nz() : 1);
tag->totalSize_ = tag->sliceSize() * ( (hasTAxis) ? tag->pTTag_->nT() : bool hasXAxis = tag->pXTag_.get() ? true : false;
1 ); bool hasYAxis = tag->pYTag_.get() ? true : false;
bool hasZAxis = tag->pZTag_.get() ? true : false;
bool hasTAxis = tag->pTTag_.get() ? true : false;
return tag; if (hasZAxis && hasXAxis && hasYAxis) {
tag->hd_ = hasTAxis ? HD_3D_T : HD_3D;
} else if ((hasXAxis && hasYAxis) || (hasZAxis && hasYAxis) || (hasZAxis &&
hasXAxis)) {
tag->hd_ = hasTAxis ? HD_2D_T : HD_2D;
} else if ((hasYAxis) || (hasXAxis) || (hasZAxis)) {
tag->hd_ = hasTAxis ? HD_1D_T : HD_1D;
} else {
tag->hd_ = hasTAxis ? HD_0D_T : HD_0D;
} }
tag->sliceSize_ = (hasXAxis ? tag->pXTag_->nx() : 1) * (hasYAxis ? tag->pYTa
g_->ny() : 1) * (hasZAxis ? tag->pZTag_->nz() : 1);
tag->totalSize_ = tag->sliceSize() * ((hasTAxis) ? tag->pTTag_->nT() : 1);
return tag;
} }
} // namespace MetNoFimex
 End of changes. 13 change blocks. 
44 lines changed or deleted 39 lines changed or added

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