WSL/SLF GitLab Repository

Commit 92d795db authored by Mathias Bavay's avatar Mathias Bavay
Browse files

A bug has been found (thanks to ctest!) that was introduced when we added...

A bug has been found (thanks to ctest!) that was introduced when we added TAU_CLD: the new MeteoGrid SHADE was only partially implemented and this lead to segfaults. The decrementing code in ARCIO was wrong and this has been fixed.
parent 198433d4
......@@ -55,6 +55,7 @@ bool MeteoGrids::initStaticData()
paramname.push_back("ROT");
paramname.push_back("ALB");
paramname.push_back("DEM");
paramname.push_back("SHADE");
paramname.push_back("SLOPE");
paramname.push_back("AZI");
......
......@@ -356,7 +356,7 @@ void ARCIO::write2DGrid(const Grid2DObject& grid_in, const std::string& name)
fout << "NODATA_value " << (int)(IOUtils::nodata) << "\n";
if(nrows>0) {
for (size_t kk=nrows-1; kk-->0; ) {
for (size_t kk=nrows; kk-->0; ) {
for (size_t ll=0; ll < ncols; ll++){
fout << grid_in(ll, kk) << " ";
}
......
#include <stdio.h>
#include <meteoio/dataClasses/MeteoData.h>
#include <meteoio/MeteoIO.h>
using namespace mio; //The MeteoIO namespace is called mio
......@@ -51,8 +52,9 @@ bool simpleDEMcontroll(DEMObject& dem, double results[]){
}
// Make output files
bool makeDEMfiles(){
bool makeDEMfiles()
{
bool status=true;
cout << " ----- Read DEM, make subfiles and some basic controll \n";
cout << " ---- Init Values \n";
......@@ -72,10 +74,18 @@ bool makeDEMfiles(){
io.readDEM(dem);
cout << " ---- Generate file with slope values \n";
if (MeteoGrids::getParameterName(MeteoGrids::SLOPE)!="SLOPE") {
std::cout << "getParameterName() returned " << MeteoGrids::getParameterName(MeteoGrids::SLOPE) << " when SLOPE was expected!\n";
status=false;
}
Grid2DObject slope(dem.cellsize, dem.llcorner, dem.slope);
io.write2DGrid(slope, MeteoGrids::SLOPE, Date(0.));
cout << " ---- Generate file with azimut values \n";
if (MeteoGrids::getParameterName(MeteoGrids::AZI)!="AZI") {
std::cout << "getParameterName() returned " << MeteoGrids::getParameterName(MeteoGrids::AZI) << " when AZI was expected!\n";
status=false;
}
Grid2DObject azi(dem.cellsize, dem.llcorner, dem.azi);
io.write2DGrid(azi, MeteoGrids::AZI, Date(0.));
......@@ -95,7 +105,6 @@ bool makeDEMfiles(){
sub_dem.grid2D.setKeepNodata(true); //HACK this removes error, but should it not take it in constructor ???
io.write2DGrid(sub_dem, MeteoGrids::DEM, Date(0.));
bool status=true;
cout << " --- Controll some basic data from DEM\n";
if(!simpleDEMcontroll(dem, r_DEM)){
cerr << " Error on controlling basic values of DEM object !!! \n";
......
Supports Markdown
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