WSL/SLF GitLab Repository

Commit 00926c1b authored by Mathias Bavay's avatar Mathias Bavay
Browse files

The WIND_CURV spatial interpolations algorithm now intelligently checks if the...

The WIND_CURV spatial interpolations algorithm now intelligently checks if the curvatures are available or not and gives a warning if not (and also take a 0 grade so that it would not be used).

The SMET plugin now uses the user provided coordinate system (as a default value for input and as a target coordinate system for output).
parent e39c76f1
Begin3
Begin4
Title: MeteoIO
Version: 1.1
Entered-date:
Description: Meteorological Input/Output preprocessing library: it covers data retrieval, data filtering, data transformations and spatial interpolations.
Entered-date: 2010-07-27
Description: Meteorological data preprocessing library: it covers data retrieval, data filtering, data transformations and statistical spatial interpolations. Convenience classes are also available for related issues.
Keywords: meteorological data access filtering spatial interpolation
Author: point of contact Mathias Bavay <bavay@slf.ch>
Maintained-by: Mathias Bavay <bavay@slf.ch>
Primary-site: http://slfsmm.indefero.net/p/meteoio/
Author: bavay@slf.ch (Mathias Bavay)
Maintained-by: bavay@slf.ch (Mathias Bavay)
Primary-site: http://slfsmm.indefero.net p/meteoio/downloads/14/get/
1.65 M MeteoIO-1.1.0-src.tgz
Home-page: http://slfsmm.indefero.net/p/meteoio/
Original-site:
Platforms: Linux and other Unices, Windows, OsX
Copying-policy: GNU Lesser Public License
Platforms: Linux and other Unices, Windows, OsX
Copying-policy: GNU Lesser Public License version 3
End
......@@ -384,6 +384,14 @@ double SimpleWindInterpolationAlgorithm::getQualityRating(const MeteoData::Param
if (param != MeteoData::VW)
return 0.0;
//This algorithm requires the curvatures
unsigned int nx=0, ny=0;
dem.curvature.size(nx,ny);
if (nx==0 || ny==0) {
std::cerr << "[W] WIND_CURV spatial interpolations algorithm selected but no dem curvature available! Skipping algorithm...\n";
return 0.0;
}
vector<double> vecAltitudes, vecDataVW, vecDataDW;
vector<StationData> vecMeta;
unsigned int nrOfMeasurments = 0;
......
......@@ -144,7 +144,7 @@ int Interpol2D::LinRegression(const std::vector<double>& X, const std::vector<do
//finds the linear regression for points (x,y,z,Value)
const double r_thres=0.7;
double a,b,r;
if ((unsigned int)X.size()==2) {
std::cout << "[W] only two points for linear regression!" << std::endl;
}
......
......@@ -196,6 +196,7 @@ void SMETIO::parseInputOutputSection()
/*
* Parse the [Input] and [Output] sections within Config object cfg
*/
IOUtils::getProjectionParameters(cfg, coordin, coordinparam, coordout, coordoutparam);
//Parse input section: extract number of files to read and store filenames in vecFiles
unsigned int counter = 1;
......@@ -247,6 +248,7 @@ void SMETIO::parseInputOutputSection()
outputIsGzipped = true;
}
}
void SMETIO::readMeteoData(const Date& dateStart, const Date& dateEnd,
......@@ -488,16 +490,19 @@ void SMETIO::readHeader(const char& eoln, const std::string& filename, bool& loc
IOUtils::getValueForKey(mapHeader, "station_id", sd.stationID);
IOUtils::getValueForKey(mapHeader, "station_name", sd.stationName, IOUtils::nothrow);
IOUtils::getValueForKey(mapHeader, "tz", timezone, IOUtils::nothrow);
sd.position.setProj(coordin, coordinparam); //set the default projection from config file
//trying to read easting/northing
double easting=IOUtils::nodata, northing=IOUtils::nodata, alt=IOUtils::nodata;
short int epsg=IOUtils::snodata;
IOUtils::getValueForKey(mapHeader, "epsg", epsg, IOUtils::nothrow);
if(epsg!=IOUtils::snodata) {
sd.position.setEPSG(epsg);
}
IOUtils::getValueForKey(mapHeader, "easting", easting, IOUtils::nothrow);
if (easting != IOUtils::nodata){ //HACK
IOUtils::getValueForKey(mapHeader, "northing", northing);
IOUtils::getValueForKey(mapHeader, "altitude", alt);
IOUtils::getValueForKey(mapHeader, "epsg", epsg);
sd.position.setEPSG(epsg);
sd.position.setXY(easting, northing, alt);
locationInHeader = true;
} else {
......@@ -555,6 +560,7 @@ void SMETIO::writeMeteoData(const std::vector< std::vector<MeteoData> >& vecMete
for (unsigned int ii=0; ii<vecMeteo.size(); ii++){
//1. check consitency of station data position -> write location in header or data section
StationData sd;
sd.position.setProj(coordout, coordoutparam);
bool isConsistent = checkConsistency(vecStation.at(ii), sd);
if (sd.stationID == ""){
......@@ -688,8 +694,8 @@ void SMETIO::writeHeaderSection(const bool& writeLocationInHeader, const Station
fout << "station_id = " << sd.getStationID() << endl;
if (sd.getStationName() != "")
fout << "station_name = " << sd.getStationName() << endl;
if (writeLocationInHeader){
if (writeLocationInHeader){ //TODO: only write if != nodata
fout << fixed;
fout << "latitude = " << setw(14) << setprecision(6) << sd.position.getLat() << "\n";
fout << "longitude = " << setw(14) << setprecision(6) << sd.position.getLon() << "\n";
......
......@@ -101,7 +101,7 @@ class SMETIO : public IOInterface {
Config cfg;
std::ifstream fin; //Input file streams
std::ofstream fout; //Output file streams
std::string coordin, coordinparam, coordout, coordoutparam; //default projection parameters
};
} //namespace
......
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