WSL/SLF GitLab Repository

Commit 680fff0e authored by Mathias Bavay's avatar Mathias Bavay
Browse files

Better plugin template, as mentioned in issue 411. Brief description of the...

Better plugin template, as mentioned in issue 411. Brief description of the scripts in tools/ in the examples readme.
parent ca016a9e
......@@ -21,3 +21,8 @@ The necessary data set for these examples lies in "input" directory. It contains
sun.cc : calculate solar radiation at a given place and time
time.cc : time handling example
4) Available scripts
Several useful scripts are given in the "tools" subdirectory of MeteoIO's root sources directory. These scripts allow to
extract statictics from SMET input files, extract a single parameter, plot SMET files in xmGrace or in Matlab. There is also
a script to convert the locations given in SMET files to a KML file that can be opened in a GIS or online mapping service
(such as google maps).
\ No newline at end of file
......@@ -40,6 +40,20 @@ const double TEMPLATE::plugin_nodata = -999.; //plugin specific nodata value. It
TEMPLATE::TEMPLATE(const std::string& configfile) : cfg(configfile)
{
IOUtils::getProjectionParameters(cfg, coordin, coordinparam, coordout, coordoutparam);
/* Example: how to read keys from the Config object*/
/*const double factor = cfg.get("PLUGIN_FACTOR", "Input"); //if the key PLUGIN_FACTOR is not found in the [Input] section, an exception will be thrown
*
* bool enable_feature = false;
* cfg.getValue("ENABLE_FEATURE", "Input", enable_feature, IOUtils::nothrow); //if the key is not found, it simply keeps its previous value
*
* int parameter = 0;
* cfg.getValue("PLUGIN_NR_PARAMS", "Output", parameter); //if the key is not found, an exception will be thrown
*
* //it is also possible to get all the keys starting with a given pattern at once and then loop through them:
* std::vector<std::string> vecFilenames;
* cfg.getValues("STATION", "INPUT", vecFilenames);
*/
}
TEMPLATE::TEMPLATE(const Config& cfgreader) : cfg(cfgreader)
......@@ -101,6 +115,50 @@ void TEMPLATE::writeMeteoData(const std::vector< std::vector<MeteoData> >& /*vec
{
//Nothing so far
throw IOException("Nothing implemented here", AT);
/* Example: how to read coordinate in the input coordinate system and make them availabe to any other coordinate system*/
/* //we assume we already have eatsing, northing and altitude in "double" variables
* Coords point1(coordin, coordinparam);
* point1.setXY(easting , northing., altitude);
*
* //in order to get lat/lon:
* const double lat = point1.getLat();
*
* //if we have lat/lon instead:
* point1.setLatLon(lat , lon., altitude);
*
* //to set a coodrinate system by EPSG code:
* point1.setEPSG(epsg);
*
* //for more information: see the "Coords" class and the "coordinates.cc" example
*/
/* Example: how to copy the meteo data has read by the plugin into the vector of MeteoData*/
/*
* //for each station, repeat the following:
* vector<MeteoData> timeseries; //create a time vector of MeteoData for the station
*
* //we read the station coordinates and put them in a Coords object (see above).
* //we also read a station id and station name (they might be identical if only one is available)
* StationData sd(point1, id, name);
*
* //then, we loop over all the available timestamps and fill the MeteoData
* for(size_t step=0; step<nr_steps; step++) {
* //we read the date and put it in a Date object:
* Date date(julian, TZ_in); //from julian date and input timezone
*
* Date date; //other possibility:
* IOUtils::convertString(date, timestamp, TZ_in); //from a text timestamp and input timezone
*
* MeteoData md(date, sd); //create an empty MeteoData object initialized at a given date and station
* md(MeteoData::TA) = my_ta; //add each field
* md(MeteoData::RH) = my_rh; //of course, this could be done without relying on these "my_rh" intermediate variables!
* //etc
*
* timeseries.push_back( md ); //add the MeteoData to the time vector
* }
*/
}
void TEMPLATE::readPOI(std::vector<Coords>&)
......
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