38 OshdIO(
const std::string& configfile);
45 std::vector< std::vector<MeteoData> >& vecMeteo);
54 file_index(
const Date& i_date,
const std::string& i_path,
const std::string& i_filename,
const std::string& i_run_date)
55 : date(i_date), run_date(i_run_date), path(i_path), filename(i_filename) {}
56 bool operator<(
const file_index& a)
const {
59 bool operator>(
const file_index& a)
const {
63 return "<"+date.toString(
Date::ISO)+
" - "+run_date+
" "+path+
" "+filename+
">";
71 struct station_index {
72 station_index(
const std::string& i_id)
73 : id(i_id), oshd_acro(), idx(IOUtils::
npos) {}
74 station_index(
const std::string& i_id,
const std::string& acro,
const size_t& i_idx)
75 : id(i_id), oshd_acro(acro), idx(i_idx) {}
76 std::string id, oshd_acro;
80 void parseInputOutputSection();
81 void readFromFile(
const std::string& file_and_path,
const Date& in_timestep, std::vector< std::vector<MeteoData> >& vecMeteo)
const;
82 void buildVecIdx(std::vector<std::string> vecAcro);
83 void fillStationMeta();
85 static size_t getFileIdx(
const std::vector< struct file_index >& cache,
const Date& start_date);
86 static std::vector< struct file_index > scanMeteoPath(
const std::string& meteopath_in,
const bool& is_recursive);
87 static double convertUnits(
const double& val,
const std::string& units,
const size_t& param,
const std::string& filename);
90 std::vector< struct file_index > cache_meteo_files;
91 std::vector< struct file_index > cache_grid_files;
92 std::vector<StationData> vecMeta;
93 std::vector< struct station_index > statIDs;
94 std::string coordin, coordinparam;
95 std::string grid2dpath_in, in_meteopath, in_metafile;
99 static const char* meteo_ext;
100 static std::map< std::string, MeteoGrids::Parameters > params_map;
101 static std::map< MeteoGrids::Parameters, std::string > grids_map;
102 static const double in_dflt_TZ;
103 static const bool __init;
104 static bool initStaticData();
A class that reads a key/value file. These files (typically named *.ini) follow the INI file format s...
Definition: Config.h:79
A class to represent DEMs and automatically compute some properties. This class stores elevation grid...
Definition: DEMObject.h:40
A class to handle timestamps. This class handles conversion between different time display formats (I...
Definition: Date.h:87
@ ISO
ISO 8601 extended format combined date: YYYY-MM-DDTHH:mm:SS.sss (fields might be dropped,...
Definition: Date.h:91
A class to represent 2D Grids. Typical application as DEM or Landuse Model.
Definition: Grid2DObject.h:42
A class representing the IO Layer of the software Alpine3D. For each type of IO (File,...
Definition: IOInterface.h:98
Parameters
this enum provides names for possible meteogrids (from an ARPS file, etc)
Definition: MeteoData.h:46
This plugin reads Matlab binary files, relying on the MatIO library.
Definition: OshdIO.h:36
virtual void readMeteoData(const Date &dateStart, const Date &dateEnd, std::vector< std::vector< MeteoData > > &vecMeteo)
Fill vecMeteo with a time series of objects corresponding to the interval indicated by dateStart and ...
Definition: OshdIO.cc:293
virtual bool list2DGrids(const Date &start, const Date &end, std::map< Date, std::set< size_t > > &list)
Return the list of grids within a given time period that could be read by the plugin,...
Definition: OshdIO.cc:251
virtual void read2DGrid(Grid2DObject &grid_out, const std::string &filename="")
A generic function for parsing 2D grids into a Grid2DObject. The string parameter shall be used for a...
Definition: OshdIO.cc:529
virtual void readStationData(const Date &date, std::vector< StationData > &vecStation)
Fill vecStation with StationData objects for a certain date of interest.
Definition: OshdIO.cc:286
OshdIO(const std::string &configfile)
Definition: OshdIO.cc:128
virtual void readDEM(DEMObject &dem_out)
Parse the DEM (Digital Elevation Model) into the Grid2DObject.
Definition: OshdIO.cc:576
const size_t npos
npos is the out-of-range value
Definition: IOUtils.h:80
std::string toString(const T &t)
Definition: IOUtils.h:294