WSL/SLF GitLab Repository

Commit c9cc2dab authored by Mathias Bavay's avatar Mathias Bavay
Browse files

Fixed a bug in libinterpol2D, improved the documentation of the ALS_SCALING...

Fixed a bug in libinterpol2D, improved the documentation of the ALS_SCALING interpolation method, fixed a few bugs in BormaIO and added a constant in Meteoconst.h
parent bc6ca3bd
......@@ -555,7 +555,7 @@ class USERInterpolation : public InterpolationAlgorithm {
* then the name of the file (in GRID2DPATH) containing the gridded ALS data (relying on the GRID2D plugin).
* If there are some time steps when only one station provides the necessary parameter, the base method will
* automatically switch to "AVG". A third (optional) argument can be provided that is the air temperature
* threshold (in K) below which such redistribution occurs.
* threshold (in K) below which such redistribution occurs (so liquid precipitation is not redistributed).
*
* @code
* PSUM::algorithms = ALS_SCALING
......
......@@ -39,6 +39,7 @@ namespace Cst {
const double std_press = 101325.; // (Pa) at sea level
const double std_temp = 288.15; // (K) at sea level
const double mean_adiabatique_lapse_rate = 0.0065; // (K/m)
const double dry_adiabatique_lapse_rate = 0.0098; // (K/m)
const double gaz_constant_dry_air = 287.058; // (J kg-1 K-1)
const double gaz_constant_water_vapor = 461.9; // (J kg-1 K-1)
......
......@@ -24,8 +24,6 @@
#include <meteoio/MathOptim.h> //math optimizations
#include <meteoio/ResamplingAlgorithms2D.h> //for Winstral
#include <meteoio/IOManager.h> //HACK HACK HACK
using namespace std;
namespace mio {
......@@ -809,7 +807,7 @@ void Interpol2D::Winstral(const DEMObject& dem, const Grid2DObject& TA, const do
for (size_t ii=0; ii<Sx.getNx()*Sx.getNy(); ii++) {
if (TA(ii)>Cst::t_water_freezing_pt) Sx(ii)=IOUtils::nodata;
}
//get the scaling parameters
const double min_sx = Sx.grid2D.getMin(); //negative
const double max_sx = Sx.grid2D.getMax(); //positive
......@@ -846,6 +844,7 @@ void Interpol2D::Winstral(const DEMObject& dem, const Grid2DObject& TA, const do
val += deposited;
}
}
}
void Interpol2D::Winstral(const DEMObject& dem, const Grid2DObject& TA, const Grid2DObject& DW, const Grid2DObject& VW, const double& dmax, Grid2DObject& grid)
......@@ -859,7 +858,7 @@ void Interpol2D::Winstral(const DEMObject& dem, const Grid2DObject& TA, const Gr
for (size_t ii=0; ii<Sx.getNx()*Sx.getNy(); ii++) {
if (TA(ii)>Cst::t_water_freezing_pt) Sx(ii)=IOUtils::nodata;
}
//get the scaling parameters
const double min_sx = Sx.grid2D.getMin(); //negative
const double max_sx = Sx.grid2D.getMax(); //positive
......@@ -868,7 +867,7 @@ void Interpol2D::Winstral(const DEMObject& dem, const Grid2DObject& TA, const Gr
//erosion: fully eroded at min_sx
for (size_t ii=0; ii<Sx.getNx()*Sx.getNy(); ii++) {
const double sx = Sx(ii);
if (sx==IOUtils::nodata || VW(ii)<vw_thresh) continue; //low wind speed pixels don't contribute to erosion
if (sx==IOUtils::nodata || (sx<0 && VW(ii)<vw_thresh)) continue; //low wind speed pixels don't contribute to erosion
double &val = grid(ii);
if (sx<0.) {
const double eroded = val * sx/min_sx;
......@@ -896,6 +895,7 @@ void Interpol2D::Winstral(const DEMObject& dem, const Grid2DObject& TA, const Gr
val += deposited;
}
}
}
/**
......
......@@ -15,7 +15,13 @@
You should have received a copy of the GNU Lesser General Public License
along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
*/
#include "BormaIO.h"
#include <meteoio/plugins/BormaIO.h>
#include <meteoio/IOUtils.h>
#include <meteoio/dataClasses/Coords.h>
#include <meteoio/IOExceptions.h>
#include <sstream>
#include <iostream>
using namespace std;
......@@ -152,7 +158,7 @@ void BormaIO::getFiles(const std::string& stationname, const Date& start_date, c
bool BormaIO::bufferData(const Date& dateStart, const Date& dateEnd,
std::vector< std::vector<MeteoData> >& vecMeteo,
const unsigned int& stationnr)
const size_t& stationnr)
{
std::vector<std::string> vecFiles;
std::vector<Date> vecDate;
......
......@@ -20,15 +20,10 @@
#include <meteoio/Config.h>
#include <meteoio/IOInterface.h>
#include <meteoio/IOUtils.h>
#include <meteoio/dataClasses/Coords.h>
#include <meteoio/IOExceptions.h>
#include <meteoio/Date.h>
#include <meteoio/dataClasses/Date.h>
#include <libxml++/libxml++.h>
#include <string>
#include <sstream>
#include <iostream>
namespace mio {
......@@ -68,7 +63,7 @@ class BormaIO : public IOInterface {
void readStationNames(void);
bool bufferData(const Date& dateStart, const Date& dateEnd,
std::vector< std::vector<MeteoData> >& vecMeteo,
const unsigned int& stationnr);
const size_t& stationnr);
std::vector<std::string> vecStationName;
const Config cfg;
......
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