WSL/SLF GitLab Repository

Commit 537cb767 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

First version of the new COSMO (in fact, FieldExtract) plugin. It currently...

First version of the new COSMO (in fact, FieldExtract) plugin. It currently only reads data from one single file that is provided as argument, but this file can contain all the stations and all the time steps. This plugin only relies on libxml2.
parent 55a4ce01
......@@ -759,6 +759,7 @@ const Date Date::operator/(const double& value) const {
* - 'Z' like in 2013-02-13T19:43Z, meaning GMT
* - '+01' like in 2013-02-13T20:43+01 meaning GMT+1
* - '+0130' like in 2013-02-13T21:13+0130 meaning GMT+1.5
* - '+01:30' like in 2013-02-13T21:13+01:30 meaning GMT+1.5
* - '-0515' like in 2013-02-13T15:28-0515 meaning GMT-5.25
* See for more information
* @param timezone_iso time zone string
......@@ -103,7 +103,7 @@ namespace mio {
* <tr><td>\subpage arc "ARC"</td><td>dem, landuse, grid2d</td><td>ESRI/ARC ascii grid files</td><td></td></tr>
* <tr><td>\subpage arps "ARPS"</td><td>dem, grid2d</td><td>ARPS ascii formatted grids</td><td></td></tr>
* <tr><td>\subpage borma "BORMA"</td><td>meteo</td><td>Borma xml meteo files</td><td><A HREF="">libxml++</A></td></tr>
* <tr><td>\subpage cosmoxml "COSMOXML"</td><td>meteo</td><td>MeteoSwiss COSMO's postprocessing XML format</td><td><A HREF="">libxml++</A></td></tr>
* <tr><td>\subpage cosmoxml "COSMOXML"</td><td>meteo</td><td>MeteoSwiss COSMO's postprocessing XML format</td><td><A HREF="">libxml2</A></td></tr>
* <tr><td>\subpage geotop "GEOTOP"</td><td>meteo</td><td>GeoTop meteo files</td><td></td></tr>
* <tr><td>\subpage grass "GRASS"</td><td>dem, landuse, grid2d</td><td>Grass grid files</td><td></td></tr>
* <tr><td>\subpage gribio "GRIB"</td><td>meteo, dem, grid2d</td><td>GRIB meteo grid files</td><td><A HREF="">grib-api</A></td></tr>
......@@ -1003,7 +1003,7 @@ TREEVIEW_WIDTH = 250
# to manually remove any form_*.png images from the HTML output directory
# to force them to be regenerated.
# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
......@@ -23,9 +23,9 @@ IF(PLUGIN_BORMAIO)
SET(plugin_libs ${plugin_libs} ${LibXML++_LIBRARIES})
SET(plugin_libs ${plugin_libs} ${LIBXML2_LIBRARIES})
SET(plugins_sources ${plugins_sources} plugins/
This diff is collapsed.
......@@ -24,13 +24,13 @@ along with MeteoIO. If not, see <>.
#include <meteoio/Coords.h>
#include <meteoio/IOExceptions.h>
#include <libxml++/libxml++.h>
#include <libxml++/parsers/textreader.h>
#include <string>
#include <sstream>
#include <iostream>
#include <libxml/parser.h>
#include <libxml/xpath.h>
namespace mio {
......@@ -39,16 +39,18 @@ namespace mio {
* This is the plugin for reading the XML data genereated by FieldExtra, the post-processor
* of the MeteoSwiss COSMO meteorological model.
* @author Marc Diebold
* @date January/February 2011
* @author Mathias Bavay
* @date 2014
class CosmoXMLIO : public IOInterface {
CosmoXMLIO(const std::string& configfile);
CosmoXMLIO(const CosmoXMLIO&);
CosmoXMLIO(const Config& cfgreader);
CosmoXMLIO(const Config& cfg);
~CosmoXMLIO() throw();
CosmoXMLIO& operator=(const CosmoXMLIO&); ///<Assignement operator, required because of pointer member
virtual void read2DGrid(Grid2DObject& grid_out, const std::string& parameter="");
virtual void read2DGrid(Grid2DObject& grid_out, const MeteoGrids::Parameters& parameter, const Date& date);
......@@ -66,25 +68,25 @@ class CosmoXMLIO : public IOInterface {
virtual void write2DGrid(const Grid2DObject& grid_in, const MeteoGrids::Parameters& parameter, const Date& date);
void cleanup() throw();
std::string getValue(xmlpp::TextReader& reader);
double getDoubleValue(xmlpp::TextReader& reader);
Date getDateValue(xmlpp::TextReader& reader);
double c2k(const double& value);
double k2c(const double& value);
void finishMeteo(const double& latitude, const double& longitude, const double& altitude,
double& dew_point, MeteoData& meteo);
void writeHeader(std::stringstream& XMLdata); //Write the first lines of the XML output file
void writeLocationHeader(const StationData& station, std::stringstream& XMLdata);
void writeMeteoDataDescription(std::stringstream& XMLdata); //Write the middle of the XML output file
void writeMeteo(const std::vector<MeteoData>& vecMeteo, std::stringstream& XMLdata);
void writeFooter(std::stringstream& XMLdata); //Write the last lines of the XML output file
const Config cfg;
static const std::string dflt_extension;
void openIn_XML(const std::string& in_meteofile);
void closeIn_XML() throw();
bool parseStationData(const std::string& station_id, const xmlXPathContextPtr& xpathCtx, StationData &sd);
bool parseMeteoDataPoint(const Date& dateStart, const Date& dateEnd, const xmlNodePtr &element, MeteoData &md) const;
bool parseMeteoData(const Date& dateStart, const Date& dateEnd, const std::string& station_id,
const StationData& sd, const xmlXPathContextPtr& xpathCtx, std::vector<MeteoData> &vecMeteo) const;
std::map<std::string, std::string> xml_stations_id; //mapping between true station ID and the messy id used in the xml
std::vector<std::string> input_id; //user specified stations to read
std::string meteofile; //file containing all the data, for all the stations
double plugin_nodata; //plugin specific no data value
xmlDocPtr in_doc;
xmlXPathContextPtr in_xpathCtx;
static const double in_tz, out_tz; //plugin specific time zones
static const std::string xml_namespace, StationData_xpath, MeteoData_xpath;
std::string coordin, coordinparam, coordout, coordoutparam; //projection parameters
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