WSL/SLF GitLab Repository

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

Using the new Coords constructor and making the list of STATIONS in GRIBIO...

Using the new Coords constructor and making the list of STATIONS in GRIBIO support discontinuous numbering
parent ca875488
......@@ -173,48 +173,16 @@ void GRIBIO::setOptions()
void GRIBIO::readStations(std::vector<Coords> &vecPoints)
{
cfg.getValue("METEOPATH", "Input", meteopath_in);
size_t current_stationnr = 1;
string current_station;
do {
current_station.clear();
ostringstream ss;
ss << "STATION" << current_stationnr;
cfg.getValue(ss.str(), "Input", current_station, IOUtils::nothrow);
IOUtils::stripComments(current_station);
if (!current_station.empty()) {
addStation(current_station, vecPoints);
std::cerr << "\tRead virtual station " << vecPoints.back().printLatLon() << "\n";
}
current_stationnr++;
} while (!current_station.empty());
}
std::vector<std::string> vecStation;
cfg.getValues("STATION", "INPUT", vecStation);
for(size_t ii=0; ii<vecStation.size(); ii++) {
Coords tmp(coordin, coordinparam, vecStation[ii]);
if(!tmp.isNodata())
vecPoints.push_back( tmp );
void GRIBIO::addStation(const std::string& coord_spec, std::vector<Coords> &vecPoints)
{
std::istringstream iss(coord_spec);
double coord1=IOUtils::nodata, coord2=IOUtils::nodata;
int epsg=IOUtils::inodata;
iss >> std::skipws >> coord1;
iss >> std::skipws >> coord2;
iss >> std::skipws >> epsg;
if(coord1!=IOUtils::nodata && coord2!=IOUtils::nodata && epsg!=IOUtils::inodata) {
Coords point;
point.setEPSG(epsg);
point.setXY(coord1, coord2, IOUtils::nodata);
vecPoints.push_back(point);
return;
}
if(coord1!=IOUtils::nodata && coord2!=IOUtils::nodata) {
Coords point(coordin, coordinparam);
point.setLatLon(coord1, coord2, IOUtils::nodata);
vecPoints.push_back(point);
return;
std::cerr << "\tRead virtual station " << vecPoints.back().printLatLon() << "\n";
}
throw InvalidArgumentException("Coordinate specification \""+coord_spec+"\" is invalid!", AT);
}
void GRIBIO::listKeys(grib_handle** h, const std::string& filename)
......
......@@ -71,7 +71,6 @@ class GRIBIO : public IOInterface {
void read2DGrid(const std::string& filename, Grid2DObject& grid_out, const MeteoGrids::Parameters& parameter, const Date& date);
void readWind(const std::string& filename, const Date& date);
void indexFile(const std::string& filename);
void addStation(const std::string& coord_spec, std::vector<Coords> &vecPoints);
void readStations(std::vector<Coords> &vecPoints);
void listKeys(grib_handle** h, const std::string& filename);
void scanMeteoPath();
......
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