WSL/SLF GitLab Repository

Commit 116db032 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

Improved an error message, improved the main documentation page by adding...

Improved an error message, improved the main documentation page by adding links to the home page, improved the code examples
parent a5d3cf39
......@@ -38,7 +38,7 @@ void real_main(int argc, char** argv) {
vecMeteo.insert(vecMeteo.begin(), Meteo.size(), std::vector<MeteoData>()); //allocation for the vectors
for(; d1<=d2; d1+=Tstep) { //time loop
io.getMeteoData(d1, Meteo); //read 1 timestep at once, forcing resampling to the timestep
for(unsigned int ii=0; ii<Meteo.size(); ii++) {
for(size_t ii=0; ii<Meteo.size(); ii++) {
vecMeteo.at(ii).push_back(Meteo[ii]); //fill the data manually into the vector of vectors
}
}
......
......@@ -5,30 +5,27 @@ using namespace mio; //The MeteoIO namespace is called mio
//This is a basic example of using as dem: the dem is read, the grid coordinates of a point given by its (lat,long) are retrieved
//and a sub-dem is extracted starting at these coordinates and extending dist_x and dist_y and written out.
int main(void) {
//DEMObject dem;
Grid2DObject dem;
DEMObject dem;
Config cfg("io.ini");
IOManager io(cfg);
//reading dem
//dem.setUpdatePpt(DEMObject::SLOPE);
//io.readDEM(dem);
io.read2DGrid(dem, "./input/surface-grids/Switzerland_1000m.asc");
dem.setUpdatePpt(DEMObject::SLOPE);
io.readDEM(dem);
//writing some statistics about this dem
//dem.grid2D.getMin() scans the DEM grid to get the min, while dem.min_altitude is cached and therefore very cheap
//The raw content of the 2D grids can also be accessed, for example dem.grid2D.getMin(IOUtils::RAW_NODATA). In this case, there would be no interpretation of some values as nodata.
/*std::cout << "DEM information: \n";
std::cout << "DEM information: \n";
std::cout << "\tmin=" << dem.grid2D.getMin() << " max=" << dem.grid2D.getMax() << " mean=" << dem.grid2D.getMean() << "\n";
std::cout << "\tmin slope=" << dem.min_slope << " max slope=" << dem.max_slope << std::endl;*/
std::cout << "\tmin slope=" << dem.min_slope << " max slope=" << dem.max_slope << std::endl;
io.write2DGrid(dem, MeteoGrids::DEM, Date(0.));
/*Grid2DObject slope(dem.ncols, dem.nrows, dem.cellsize, dem.llcorner, dem.slope);
Grid2DObject slope(dem.ncols, dem.nrows, dem.cellsize, dem.llcorner, dem.slope);
io.write2DGrid(slope, MeteoGrids::SLOPE, Date(0.));
Grid2DObject azi(dem.ncols, dem.nrows, dem.cellsize, dem.llcorner, dem.azi);
io.write2DGrid(azi,"azi.asc");*/
io.write2DGrid(dem,MeteoGrids::DEM, Date(0.));
io.write2DGrid(azi,"azi.png");
return 0;
}
......@@ -84,12 +84,12 @@ COORDSYS = CH1903
TIME_ZONE = 1
GRID2D = PNG
GRID2DPATH = ./
;png_legend = false
png_autoscale = false
;png_min_size = 400x400
png_max_size = 1366*768
METEO = SMET
METEOPATH = ./
......@@ -154,7 +154,8 @@ HS::resample = linear
VW::resample = nearest_neighbour
VW::args = extrapolate
HNW::resample = linear
HNW::resample = accumulate
HNW::args = 3600
[Interpolations2D]
TA::algorithms = IDW_LAPSE CST_LAPSE
......
......@@ -911,15 +911,15 @@ void Date::plausibilityCheck(const int& in_year, const int& in_month, const int&
|| (in_hour < 0) || (in_hour > 24)
|| (in_minute < 0) || (in_minute > 59)) {
stringstream ss;
ss << "Invalid Date requested: " << in_year << " " << in_month;
ss << " " << in_day << " " << in_hour << " " << in_minute;
ss << "Invalid Date requested: " << in_year << "-" << in_month;
ss << "-" << in_day << "T" << in_hour << ":" << in_minute;
throw IOException(ss.str(), AT);
}
if ((in_hour == 24) && (in_minute != 0)) {
stringstream ss;
ss << "Invalid Date requested: " << in_year << " " << in_month;
ss << " " << in_day << " " << in_hour << " " << in_minute;
ss << "Invalid Date requested: " << in_year << "-" << in_month;
ss << "-" << in_day << "T" << in_hour << ":" << in_minute;
throw IOException(ss.str(), AT);
}
}
......
......@@ -59,6 +59,11 @@ namespace mio {
* This library is available under LPGL version 3 or above, see <a href="http://www.gnu.org/licenses/lgpl.txt">www.gnu.org</a>.
*
* @section table_of_content Table of content
* -# External Links
* -# <A HREF="https://models.slf.ch/p/meteoio/">MeteoIO's home page</A>
* -# <A HREF="https://models.slf.ch/p/meteoio/page/Getting-started/">Installation, compilation</A>
* -# <A HREF="https://models.slf.ch/p/meteoio/page/GettingHelp/">Getting help</A>
* -# subscribe to <A HREF="https://freecode.com/projects/meteoio">MeteoIO's release announcements</A>
* -# End User documentation
* -# \subpage general "General concepts"
* -# \subpage plugins "Available plugins" and usage
......@@ -352,7 +357,7 @@ namespace mio {
* mio::Config cfg("io.ini");
* io = new mio::IOManager(cfg);
* } catch (const IOException& e){
* std::cout << "Problem with IOHandler creation, cause: " << e.what() << std::endl;
* std::cout << "Problem with IOManager creation, cause: " << e.what() << std::endl;
* }
*
* try {
......@@ -446,6 +451,9 @@ namespace mio {
* return 0;
* }
* \endcode
*
* Do not forget to have a look at the examples provided in doc/examples! An example io.ini is provided as well as some data sets
* (7 weather stations as well as one DEM).
*/
} //end namespace mio
......
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