MeteoIODoc  MeteoIODoc-2.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PGMIO.h
Go to the documentation of this file.
1 /***********************************************************************************/
2 /* Copyright 2009 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
3 /***********************************************************************************/
4 /* This file is part of MeteoIO.
5  MeteoIO is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  MeteoIO is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef PGMIO_H
19 #define PGMIO_H
20 
21 #include <meteoio/IOInterface.h>
22 
23 #include <string>
24 #include <sstream>
25 
26 namespace mio {
27 
36 class PGMIO : public IOInterface {
37  public:
38  PGMIO(const std::string& configfile);
39  PGMIO(const PGMIO&);
40  PGMIO(const Config& cfgreader);
41 
42  virtual void read2DGrid(Grid2DObject& grid_out, const std::string& parameter="");
43  virtual void read2DGrid(Grid2DObject& grid_out, const MeteoGrids::Parameters& parameter, const Date& date);
44 
45  virtual void readDEM(DEMObject& dem_out);
46 
47  virtual void write2DGrid(const Grid2DObject& grid_in, const std::string& filename);
48  virtual void write2DGrid(const Grid2DObject& grid_in, const MeteoGrids::Parameters& parameter, const Date& date);
49 
50  private:
51  void getGridPaths();
52  void read2DGrid_internal(Grid2DObject& grid_out, const std::string& full_name);
53  size_t getNextHeader(std::vector<std::string>& vecString, const std::string& filename, std::ifstream& fin);
54 
55  const Config cfg;
56  static const double plugin_nodata; //plugin specific nodata value, e.g. -999
57  std::string coordin, coordinparam, coordout, coordoutparam; //projection parameters
58  std::string grid2dpath_in, grid2dpath_out;
59 };
60 
61 } //namespace
62 #endif
virtual void read2DGrid(Grid2DObject &grid_out, const std::string &parameter="")
A generic function for parsing 2D grids into a Grid2DObject. The string parameter shall be used for a...
Definition: PGMIO.cc:183
A class representing the IO Layer of the software Alpine3D. For each type of IO (File, DB, Webservice, etc) a derived class is to be created that holds the specific implementation of the appropriate virtual methods. The IOHandler class is a wrapper class that is able to deal with all above implementations of the IOInterface abstract base class.
Definition: IOInterface.h:43
virtual void readDEM(DEMObject &dem_out)
Parse the DEM (Digital Elevation Model) into the Grid2DObject.
Definition: PGMIO.cc:194
virtual void write2DGrid(const Grid2DObject &grid_in, const std::string &filename)
Write a Grid2DObject The filename is specified relative to GRID2DPATH for most plugins.
Definition: PGMIO.cc:201
This class writes 2D grids as Portable Grey Map file format.
Definition: PGMIO.h:36
A class that reads a key/value file. These files (typically named *.ini) follow the INI file format s...
Definition: Config.h:58
A class to represent DEMs and automatically compute some properties. This class stores elevation grid...
Definition: DEMObject.h:39
A class to represent 2D Grids. Typical application as DEM or Landuse Model.
Definition: Grid2DObject.h:37
A class to handle timestamps. This class handles conversion between different time display formats (I...
Definition: Date.h:79
PGMIO(const std::string &configfile)
Definition: PGMIO.cc:56
Parameters
Definition: MeteoData.h:44