WSL/SLF GitLab Repository

Commit 07e0a8a1 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

A bug has been found in NetCDFIO: it should look for the GRID2D key, not the...

A bug has been found in NetCDFIO: it should look for the GRID2D key, not the METEO key! In Coords, the lat/lon are checked for validity in setLatLon() in order to catch grossly out of range coordinates (as was found on the Snowpack operational system for a few stations).
parent c9cc2dab
...@@ -503,7 +503,14 @@ void Coords::setLatLon(const std::string& in_coordinates, const double in_altitu ...@@ -503,7 +503,14 @@ void Coords::setLatLon(const std::string& in_coordinates, const double in_altitu
* @param[in] in_altitude altitude to set * @param[in] in_altitude altitude to set
* @param[in] in_update should the easting/northing be updated? (default=true) * @param[in] in_update should the easting/northing be updated? (default=true)
*/ */
void Coords::setLatLon(const double in_latitude, const double in_longitude, const double in_altitude, const bool in_update) { void Coords::setLatLon(const double in_latitude, const double in_longitude, const double in_altitude, const bool in_update)
{
if (fabs(in_latitude)>90. || fabs(in_longitude)>360.) {
std::ostringstream ss;
ss << "(" << in_latitude << "," << in_longitude << ")";
throw InvalidArgumentException("Invalid latitude/longitude: "+ss.str(), AT);
}
latitude = in_latitude; latitude = in_latitude;
longitude = in_longitude; longitude = in_longitude;
if (in_altitude!=IOUtils::nodata) { if (in_altitude!=IOUtils::nodata) {
......
...@@ -205,7 +205,7 @@ void NetCDFIO::parseInputOutputSection() ...@@ -205,7 +205,7 @@ void NetCDFIO::parseInputOutputSection()
if (!out_schema.empty()) initAttributesMap(out_schema, out_attributes); if (!out_schema.empty()) initAttributesMap(out_schema, out_attributes);
else initAttributesMap("ECMWF", out_attributes); else initAttributesMap("ECMWF", out_attributes);
const std::string in_meteo = cfg.get("METEO", "Input", IOUtils::nothrow); const std::string in_meteo = cfg.get("GRID2D", "Input", IOUtils::nothrow);
if (in_meteo == "NETCDF") { //keep it synchronized with IOHandler.cc for plugin mapping!! if (in_meteo == "NETCDF") { //keep it synchronized with IOHandler.cc for plugin mapping!!
const string in_grid2d_path = cfg.get("GRID2DPATH", "Input", IOUtils::nothrow); const string in_grid2d_path = cfg.get("GRID2DPATH", "Input", IOUtils::nothrow);
if (!in_grid2d_path.empty()) scanMeteoPath(in_grid2d_path, cache_meteo_files); if (!in_grid2d_path.empty()) scanMeteoPath(in_grid2d_path, cache_meteo_files);
......
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