WSL/SLF GitLab Repository

Commit 42ab416c authored by Mathias Bavay's avatar Mathias Bavay
Browse files

Better documentation for the USER interpolation method (grids are read from...

Better documentation for the USER interpolation method (grids are read from GRID2DPATH or a provided sub-dir) and better info message
parent 46f472ae
......@@ -934,11 +934,13 @@ void WinstralAlgorithm::calculate(const DEMObject& dem, Grid2DObject& grid)
std::string USERInterpolation::getGridFileName() const
{
//HACK: use read2DGrid(grid, MeteoGrid::Parameters, Date) instead?
if (vecArgs.size() != 1){
throw InvalidArgumentException("Please provide the path to the grids for the "+algo+" interpolation algorithm", AT);
const size_t nrArgs = vecArgs.size();
if (nrArgs > 2){
throw InvalidArgumentException("Too many arguments for the "+algo+" interpolation algorithm", AT);
}
const std::string ext(".asc");
const std::string gridname = vecArgs[0] + "/" + date.toString(Date::NUM) + "_" + MeteoData::getParameterName(param) + ext;
const std::string prefix = (nrArgs==1)? vecArgs[0] + "/" : "";
const std::string ext = (nrArgs==2)? vecArgs[1] : ".asc";
const std::string gridname = prefix + date.toString(Date::NUM) + "_" + MeteoData::getParameterName(param) + ext;
return gridname;
}
......@@ -962,9 +964,9 @@ void USERInterpolation::calculate(const DEMObject& dem, Grid2DObject& grid)
info.clear(); info.str("");
gridsmanager.read2DGrid(grid, filename);
if (!grid.isSameGeolocalization(dem)) {
throw InvalidArgumentException("[E] trying to load a grid(" + filename + ") that has not the same georeferencing as the DEM!", AT);
throw InvalidArgumentException("[E] trying to load a grid(" + filename + ") that does not have the same georeferencing as the DEM!", AT);
} else {
info << filename;
info << IOUtils::getFilename(filename);
}
}
......
......@@ -476,17 +476,25 @@ class WinstralAlgorithm : public InterpolationAlgorithm {
/**
* @class USERInterpolation
* @brief Reads user provided gridded data on the disk.
* The grids are all in a directory that is given as the algorithm's argument. The files must be named
* according to the following schema:
* - {numeric date}_{capitalized meteo parameter}.asc, for example 200812011500_TA.asc
* - Default_{capitalized meteo parameter}.asc for the grid to use when no measurements exist (which prevents
* retrieving the date for the interpolation)
* The grids are all in the GRID2DPATH directory given in the [Input] section or in one of
* its sub-directories that is given as the algorithm's argument (optional). By default, the file extension is assumed to
* be ".asc" but it is possible to provide as second argument another file extension (then it is mandatory to
* also provide a sub-directory argument in first position).
* The files must be named according to the following schema: <b>{numeric date}_{capitalized meteo parameter}.{ext}</b>, for example 200812011500_TA.asc
* The meteo parameters can be found in \ref meteoparam "MeteoData". Example of use:
* @code
* TA::algorithms = USER
* TA::user = ./meteo_grids
* TA::algorithms = USER # read grids from GRID2DPATH using the GRID2D plugin
*
* VW::algorithms = USER # read grids from GRID2DPATH/wind
* VW::user = wind
*
* HNW::algorithms = USER # read grids from GRID2DPATH/precip with the ".dat" extension
* HNW::user = precip .dat
* @endcode
*
* If no grid exists for a given timestamp and parameter, the algorithm returns a zero rating so any other interpolation algorithm can pickup
* and provide a fallback. Therefore, it is not necessary to provide grids for all time steps but one can focuss on only the relevant and interesting
* time steps.
*/
class USERInterpolation : public InterpolationAlgorithm {
public:
......
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