WSL/SLF GitLab Repository

Commit 198433d4 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

Fixing two tests that were not working anymore (since a new parameter, TAU_CLD...

Fixing two tests that were not working anymore (since a new parameter, TAU_CLD had been inserted). White spaces in MeteoData.h, more logical iteration in ARCIO.
parent 5fe50ed0
......@@ -67,7 +67,7 @@ class MeteoGrids {
ROT, ///< Total generated runoff
ALB, ///< Albedo
DEM, ///< Digital Elevation Model
SHADE, ///< Hillshade
SHADE, ///< Hillshade
SLOPE, ///< DEM slope angle
AZI, ///< DEM slope azimuth
lastparam=AZI};
......
......@@ -345,17 +345,19 @@ void ARCIO::write2DGrid(const Grid2DObject& grid_in, const std::string& name)
//so that we output is done in the same system as the inputs
llcorner.setProj(coordout, coordoutparam);
const size_t ncols = grid_in.getNx();
const size_t nrows = grid_in.getNy();
fout << fixed << showpoint << setprecision(6);
fout << "ncols " << setw(23-6) << grid_in.getNx() << "\n";
fout << "nrows " << setw(23-6) << grid_in.getNy() << "\n";
fout << "ncols " << setw(23-6) << ncols << "\n";
fout << "nrows " << setw(23-6) << nrows << "\n";
fout << "xllcorner " << setw(23-10) << setprecision(3) << llcorner.getEasting() << "\n";
fout << "yllcorner " << setw(23-10) << setprecision(3) << llcorner.getNorthing() << "\n";
fout << "cellsize " << setw(23-9) << setprecision(3) << grid_in.cellsize << "\n";
fout << "NODATA_value " << (int)(IOUtils::nodata) << "\n";
if(grid_in.getNy()>0) {
for (size_t kk=grid_in.getNy()-1; kk < grid_in.getNy(); kk--) {
for (size_t ll=0; ll < grid_in.getNx(); ll++){
if(nrows>0) {
for (size_t kk=nrows-1; kk-->0; ) {
for (size_t ll=0; ll < ncols; ll++){
fout << grid_in(ll, kk) << " ";
}
fout << "\n";
......
......@@ -26,7 +26,8 @@ const double res_Met_8 [] = {IOUtils::nodata, IOUtils::nodata, IOUtils::nodata,
const double res_Met_9 [] = {84.79166651, 81.29166661, 67.83333342, 50.37500004, 88.41666666, 85.45833337, 87.4999999}; //RSWR
const double res_Met_10 [] = {IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata}; // ISWR
const double res_Met_11 [] = {IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata}; // ILWR
const double res_Met_12 [] = {IOUtils::nodata, 2.632907412, IOUtils::nodata, 2.255830171, 3.593920512, 0., 0.}; // HNW
const double res_Met_12 [] = {IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata}; // TAU_CLD
const double res_Met_13 [] = {IOUtils::nodata, 2.632907412, IOUtils::nodata, 2.255830171, 3.593920512, 0., 0.}; // HNW
// methode do controll content of Meteo Data !!
// Also controlles != operator of containing special structures
......@@ -154,6 +155,10 @@ bool controllStation(MeteoData& datMeteo, int i_results, Date datDate){
cerr << "error on " << MeteoData::getParameterName(12) << " : " << std::setprecision(10) << datMeteo(12) << " != " << res_Met_12[i_results] << endl;
status = false;
}
if(!IOUtils::checkEpsilonEquality(datMeteo(13), res_Met_13[i_results], epsilon)){
cerr << "error on " << MeteoData::getParameterName(13) << " : " << std::setprecision(10) << datMeteo(13) << " != " << res_Met_13[i_results] << endl;
status = false;
}
MeteoData refMeteo(datDate);
refMeteo.standardizeNodata(IOUtils::nodata);
......@@ -171,6 +176,7 @@ bool controllStation(MeteoData& datMeteo, int i_results, Date datDate){
refMeteo(10)= res_Met_10[i_results];
refMeteo(11)= res_Met_11[i_results];
refMeteo(12)= res_Met_12[i_results];
refMeteo(13)= res_Met_13[i_results];
if(datMeteo != refMeteo){
cerr << "error on == operator for MeteoData :" << datMeteo.getNrOfParameters() << " - " << refMeteo.getNrOfParameters() << endl;
cerr << datMeteo.toString() << endl;
......
......@@ -27,8 +27,8 @@ const double res_Met_8 [] = {IOUtils::nodata, IOUtils::nodata, IOUtils::nodata,
const double res_Met_9 [] = {119.5, 105.5, 86.5, 67., 120.5, 105., 115.5}; //RSWR
const double res_Met_10 [] = {IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata}; // ISWR
const double res_Met_11 [] = {IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata}; // ILWR
const double res_Met_12 [] = {IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, 4., 5.160045665, 0., IOUtils::nodata}; // HNW
const double res_Met_12 [] = {IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, IOUtils::nodata}; // TAU_CLD
const double res_Met_13 [] = {IOUtils::nodata, IOUtils::nodata, IOUtils::nodata, 4., 5.160045665, 0., IOUtils::nodata}; // HNW
// methode do controll content of Meteo Data !!
// Also controlles != operator of containing special structures
......@@ -156,6 +156,10 @@ bool controllStation(MeteoData& datMeteo, int i_results, Date datDate){
cerr << "error on " << MeteoData::getParameterName(12) << " : " << std::setprecision(10) << datMeteo(12) << " != " << res_Met_12[i_results] << endl;
status = false;
}
if(!IOUtils::checkEpsilonEquality(datMeteo(13), res_Met_13[i_results], epsilon)){
cerr << "error on " << MeteoData::getParameterName(13) << " : " << std::setprecision(10) << datMeteo(13) << " != " << res_Met_13[i_results] << endl;
status = false;
}
MeteoData refMeteo(datDate);
refMeteo.standardizeNodata(IOUtils::nodata);
......@@ -173,6 +177,7 @@ bool controllStation(MeteoData& datMeteo, int i_results, Date datDate){
refMeteo(10)= res_Met_10[i_results];
refMeteo(11)= res_Met_11[i_results];
refMeteo(12)= res_Met_12[i_results];
refMeteo(13)= res_Met_13[i_results];
if(datMeteo != refMeteo){
cerr << "error on == operator for MeteoData :" << datMeteo.getNrOfParameters() << " - " << refMeteo.getNrOfParameters() << endl;
cerr << datMeteo.toString() << endl;
......
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