"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/CDMOverlay.cc" between
fimex-1.6.6.tar.gz and fimex-1.6.7.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).

CDMOverlay.cc  (fimex-1.6.6):CDMOverlay.cc  (fimex-1.6.7)
skipping to change at line 75 skipping to change at line 75
CDMOverlay::~CDMOverlay() {} CDMOverlay::~CDMOverlay() {}
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
namespace { namespace {
template<class T> bool value_is_nan(T) { return false; } template<class T> bool value_is_nan(T) { return false; }
template<> bool value_is_nan<float>(float f) { return mifi_isnan(f); } template<> bool value_is_nan<float>(float f) { return mifi_isnan(f); }
template<> bool value_is_nan<double>(double d) { return mifi_isnan(d); } template<> bool value_is_nan<double>(double d) { return mifi_isnan(d); }
template <class T> template <class T>
DataPtr overlayDataSlices(T fillT, DataPtr sliceT, DataPtr sliceB) DataPtr overlayDataSlices(T fillT, T fillB, DataPtr sliceT, DataPtr sliceB)
{ {
const shared_array<T> valuesT = dataAs<T>(sliceT); const shared_array<T> valuesT = dataAs<T>(sliceT);
shared_array<T> valuesB = dataAs<T>(sliceB); shared_array<T> valuesB = dataAs<T>(sliceB);
for (size_t i = 0; i < sliceB->size(); ++i) { for (size_t i = 0; i < sliceB->size(); ++i) {
const T valueT = valuesT[i]; const T valueT = valuesT[i];
T& valueB = valuesB[i];
if (!(value_is_nan<T>(valueT) || valueT == fillT)) if (!(value_is_nan<T>(valueT) || valueT == fillT))
valuesB[i] = valueT; valueB = valueT;
if (value_is_nan<T>(valueB) || valueB == fillB)
valueB = fillT; // need to use FillValue from top
} }
return createData(sliceB->size(), valuesB); return createData(sliceB->size(), valuesB);
} }
} // namespace } // namespace
DataPtr CDMOverlay::getDataSlice(const std::string &varName, size_t unLimDimPos) DataPtr CDMOverlay::getDataSlice(const std::string &varName, size_t unLimDimPos)
{ {
const CDM& cdmT = p->readerT->getCDM(); const CDM& cdmT = p->readerT->getCDM();
// use cdmB if not defined in cdmT // use cdmB if not defined in cdmT
skipping to change at line 123 skipping to change at line 126
if (unitsT == unitsB if (unitsT == unitsB
&& dtT == dtB && dtT == dtB
&& cdmT.getScaleFactor(varName) == cdmB.getScaleFactor(varName) && cdmT.getScaleFactor(varName) == cdmB.getScaleFactor(varName)
&& cdmT.getAddOffset(varName) == cdmB.getAddOffset(varName)) && cdmT.getAddOffset(varName) == cdmB.getAddOffset(varName))
{ {
DataPtr sliceT = p->readerT->getDataSlice(varName, unLimDimPos); DataPtr sliceT = p->readerT->getDataSlice(varName, unLimDimPos);
DataPtr sliceB = p->interpolatedB->getDataSlice(varName, unLimDimPos); DataPtr sliceB = p->interpolatedB->getDataSlice(varName, unLimDimPos);
if (dtT == CDM_FLOAT) { if (dtT == CDM_FLOAT) {
LOG4FIMEX(logger, Logger::DEBUG, "overlay using float without scalin g"); LOG4FIMEX(logger, Logger::DEBUG, "overlay using float without scalin g");
return overlayDataSlices<float>(cdmT.getFillValue(varName), sliceT, sliceB); return overlayDataSlices<float>(cdmT.getFillValue(varName), cdmB.get FillValue(varName), sliceT, sliceB);
} else if (dtT == CDM_DOUBLE) { } else if (dtT == CDM_DOUBLE) {
LOG4FIMEX(logger, Logger::DEBUG, "overlay using double without scali ng"); LOG4FIMEX(logger, Logger::DEBUG, "overlay using double without scali ng");
return overlayDataSlices<double>(cdmT.getFillValue(varName), sliceT, sliceB); return overlayDataSlices<double>(cdmT.getFillValue(varName), cdmB.ge tFillValue(varName), sliceT, sliceB);
} }
} }
// getScaledDataSlice always returns DataPtr with CDM_DOUBLE // getScaledDataSlice always returns DataPtr with CDM_DOUBLE
const bool emptyUnits = unitsT.empty() || unitsB.empty(); const bool emptyUnits = unitsT.empty() || unitsB.empty();
DataPtr sliceT = p->readerT->getScaledDataSlice(varName, unLimDimPos); DataPtr sliceT = p->readerT->getScaledDataSlice(varName, unLimDimPos);
DataPtr sliceB; DataPtr sliceB;
if (emptyUnits || unitsT == unitsB) { if (emptyUnits || unitsT == unitsB) {
if (emptyUnits) { if (emptyUnits) {
LOG4FIMEX(logger, Logger::WARN, LOG4FIMEX(logger, Logger::WARN,
 End of changes. 5 change blocks. 
4 lines changed or deleted 7 lines changed or added

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