WSL/SLF GitLab Repository

Commit fa847006 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

A new option has been added to smet, to skip the plot_xxx headers (default:...

A new option has been added to smet, to skip the plot_xxx headers (default: keep them). The virtual stations were not providing a proper call to only get the metadata, this is now available.
parent 2b94834d
......@@ -66,7 +66,13 @@ void IOManager::push_meteo_data(const IOUtils::ProcessingLevel& level, const Dat
size_t IOManager::getStationData(const Date& date, STATIONS_SET& vecStation)
{
return tsmanager.getStationData(date, vecStation);
vecStation.clear();
if (virtual_stations || downscaling) {
return interpolator.getVirtualStationsMeta(date, vecStation);
} else { //usual case
return tsmanager.getStationData(date, vecStation);
}
}
//for an interval of data: decide whether data should be filtered or raw
......
......@@ -411,6 +411,12 @@ void Meteo2DInterpolator::initVirtualStations(const bool& adjust_coordinates)
}
}
size_t Meteo2DInterpolator::getVirtualStationsMeta(const Date& /*date*/, STATIONS_SET& vecStation)
{
vecStation = v_stations;
return vecStation.size();
}
size_t Meteo2DInterpolator::getVirtualStationsData(const Date& i_date, METEO_SET& vecMeteo)
{
vecMeteo.clear();
......
......@@ -150,6 +150,13 @@ class Meteo2DInterpolator {
const std::string& algorithm,
std::vector<std::string>& vecArgs) const;
/**
* @brief Returns the metadata associated with the configured virtual stations
* @param date when to extract the virtual stations' metadata
* @param vecStation a vector of stationdata for the configured virtual stations
*/
size_t getVirtualStationsMeta(const Date& date, STATIONS_SET& vecStation);
/**
* @brief Compute point measurements from grids following a given computing strategy
* @param strategy sampling/computing strategy
......
......@@ -46,6 +46,7 @@ namespace mio {
* - STATION#: input filename (in METEOPATH). As many meteofiles as needed may be specified
* - METEOPATH: meteo files directory where to read/write the meteofiles; [Input] and [Output] sections
* - METEOPARAM: output file format options (ASCII or BINARY that might be followed by GZIP)
* - SMET_PLOT_HEADERS: should the plotting headers (to help make more meaningful plots) be included in the outputs (default: true)? [Output] section
* - POIFILE: a path+file name to the a file containing grid coordinates of Points Of Interest (for special outputs)
*
* Example:
......@@ -83,7 +84,7 @@ SMETIO::SMETIO(const std::string& configfile)
: cfg(configfile),
coordin(), coordinparam(), coordout(), coordoutparam(),
vec_smet_reader(), vecFiles(), outpath(), out_dflt_TZ(0.),
plugin_nodata(IOUtils::nodata), nr_stations(0), outputIsAscii(true)
plugin_nodata(IOUtils::nodata), nr_stations(0), outputIsAscii(true), outputPlotHeaders(true)
{
parseInputOutputSection();
}
......@@ -92,7 +93,7 @@ SMETIO::SMETIO(const Config& cfgreader)
: cfg(cfgreader),
coordin(), coordinparam(), coordout(), coordoutparam(),
vec_smet_reader(), vecFiles(), outpath(), out_dflt_TZ(0.),
plugin_nodata(IOUtils::nodata), nr_stations(0), outputIsAscii(true)
plugin_nodata(IOUtils::nodata), nr_stations(0), outputIsAscii(true), outputPlotHeaders(true)
{
parseInputOutputSection();
}
......@@ -147,9 +148,9 @@ void SMETIO::parseInputOutputSection()
std::vector<std::string> vecArgs;
cfg.getValue("METEOPATH", "Output", outpath, IOUtils::nothrow);
cfg.getValue("METEOPARAM", "Output", vecArgs, IOUtils::nothrow); //"ASCII|BINARY GZIP"
cfg.getValue("SMET_PLOT_HEADERS", "Output", outputPlotHeaders, IOUtils::nothrow); //should the plot_xxx header lines be included?
if (outpath.empty())
return;
if (outpath.empty()) return;
if (vecArgs.empty())
vecArgs.push_back("ASCII");
......@@ -529,17 +530,19 @@ void SMETIO::generateHeaderInfo(const StationData& sd, const bool& i_outputIsAsc
myprecision.push_back(tmpprecision);
mywidth.push_back(tmpwidth);
getPlotProperties(ll, plot_units, plot_description, plot_color, plot_min, plot_max);
if (outputPlotHeaders) getPlotProperties(ll, plot_units, plot_description, plot_color, plot_min, plot_max);
}
}
mywriter.set_header_value("fields", ss.str());
mywriter.set_header_value("plot_unit", plot_units.str());
mywriter.set_header_value("plot_description", plot_description.str());
mywriter.set_header_value("plot_color", plot_color.str());
mywriter.set_header_value("plot_min", plot_min.str());
mywriter.set_header_value("plot_max", plot_max.str());
if (outputPlotHeaders) {
mywriter.set_header_value("plot_unit", plot_units.str());
mywriter.set_header_value("plot_description", plot_description.str());
mywriter.set_header_value("plot_color", plot_color.str());
mywriter.set_header_value("plot_min", plot_min.str());
mywriter.set_header_value("plot_max", plot_max.str());
}
mywriter.set_width(mywidth);
mywriter.set_precision(myprecision);
}
......
......@@ -83,7 +83,7 @@ class SMETIO : public IOInterface {
double out_dflt_TZ; //default time zone
double plugin_nodata;
size_t nr_stations; //number of stations to read from
bool outputIsAscii;//read from the Config [Output] section
bool outputIsAscii, outputPlotHeaders;//read from the Config [Output] section
};
} //namespace
......
Markdown is supported
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