Commit 98522b64 authored by Marc R.'s avatar Marc R.

NetCDF reader: added warning if aux-p pressure fields contain '0'...

NetCDF reader: added warning if aux-p pressure fields contain '0' values--these lead to the raycaster shader crashing
parent c60401e1
......@@ -2030,6 +2030,21 @@ MStructuredGrid *MClimateForecastReader::readGrid(
throw MNcException("NcException", err.toStdString(),
__FILE__, __LINE__);
}
// Check for zero pressure values in grid. If these are present,
// problems will likely arise when the data is used (e.g. interpolation
// or shaders including the raycaster may crash).
if (grid->min() == 0.)
{
LOG4CPLUS_WARN(mlog,
"SEVERE WARNING: auxiliary pressure field "
"contains '0' values. This may lead to rendering "
"problems up to program crashes. Please fix your "
"data and remove all entries with '0' pressure. "
"If the '0' entries are located along a domain "
"border, you can use the 'ncks' utility, e.g. "
"'ncks -d lat,<min>,<max> in.nc out.nc'.");
}
}
#ifdef MSTOPWATCH_ENABLED
......
......@@ -2246,6 +2246,17 @@ void MLonLatAuxiliaryPressureGrid::dumpGridData(unsigned int maxValues)
str += QString("\n\ndata (column at i=0,j=0): ");
for (uint k = 0; k < nlevs; k++) str += QString("%1/").arg(getValue(k, 0, 0));
// str += QString("\n\nZeros at index positions (k,j,i): ");
// for (uint k = 0; k < nlevs; k++)
// for (uint j = 0; j < nlats; j++)
// for (uint i = 0; i < nlons; i++)
// {
// if (getValue(k, j, i) == 0.)
// {
// str += QString("%1,%2,%3/").arg(k).arg(j).arg(i);
// }
// }
nv = std::min(auxPressureField_hPa->getNumValues(), maxValues);
str += QString("\n\naux-p data (first %1 values): ").arg(nv);
for (uint i = 0; i < nv; i++) str += QString("%1/").arg(auxPressureField_hPa->getValue(i));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment