WSL/SLF GitLab Repository

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

Quick fix for a new IMISIO limitation (that stations need to be in some...

Quick fix for a new IMISIO limitation (that stations need to be in some specific tables to be processed, even if this table should not be an absolute necessity).

Better SMET formatting for vw_max, small fix in SNIO (for computing emissivity)
parent a0a74584
......@@ -11,7 +11,7 @@ int main(int argc, char** argv) {
Date now;
now.setFromSys();
now.setTimeZone(TZ);
//now.setTimeZone(TZ);
std::cout << "now=" << now;
now.rnd(1800., Date::DOWN);
std::cout << "Rounded now=" << now;
......
......@@ -296,7 +296,6 @@ void ImisIO::readStationMetaData(oracle::occi::Connection*& conn)
{
vector<string> vecStationID;
readStationIDs(vecStationID);
bool converted=true;
for (unsigned int ii=0; ii<vecStationID.size(); ii++) {
// Retrieve the station IDs - this only needs to be done once per instance
......@@ -306,34 +305,30 @@ void ImisIO::readStationMetaData(oracle::occi::Connection*& conn)
vector<string> stnIDs;
string drift_stat_abk = "", drift_stao_nr = "";
getStationIDs(vecStationID[ii], sqlQueryStationIDs, stnIDs, conn);
converted = IOUtils::convertString(station_name, stnIDs.at(0));
converted = IOUtils::convertString(drift_stat_abk, stnIDs.at(1));
converted = IOUtils::convertString(drift_stao_nr, stnIDs.at(2));
string drift_stationID = "";
drift_stationID += drift_stat_abk + drift_stao_nr;
if(stnIDs.size()<3)
throw ConversionFailedException("Error while converting station IDs for station "+stat_abk+stao_nr, AT);
IOUtils::convertString(station_name, stnIDs.at(0));
IOUtils::convertString(drift_stat_abk, stnIDs.at(1));
IOUtils::convertString(drift_stao_nr, stnIDs.at(2));
const string drift_stationID = drift_stat_abk + drift_stao_nr;
if (drift_stationID != "") {
mapDriftStation[vecStationID[ii]] = drift_stationID;
} else {
throw ConversionFailedException("Error! No drift station for station "+stat_abk+stao_nr, AT);
}
if (!converted) {
throw ConversionFailedException("Error while converting station IDs for station "+stat_abk+stao_nr, AT);
}
}
// Retrieve the station meta data - this only needs to be done once per instance
vector<string> stationMetaData;
double east, north, alt;
string stao_name = "";
converted=true;
getStationMetaData(stat_abk, stao_nr, sqlQueryStationMetaData, stationMetaData, conn);
converted = IOUtils::convertString(stao_name, stationMetaData.at(0));
converted = IOUtils::convertString(east, stationMetaData.at(1), std::dec);
converted = IOUtils::convertString(north, stationMetaData.at(2), std::dec);
converted = IOUtils::convertString(alt, stationMetaData.at(3), std::dec);
if (!converted) {
if(stationMetaData.size()<4)
throw ConversionFailedException("Error while converting station meta data for station "+stat_abk+stao_nr, AT);
}
IOUtils::convertString(stao_name, stationMetaData.at(0));
IOUtils::convertString(east, stationMetaData.at(1), std::dec);
IOUtils::convertString(north, stationMetaData.at(2), std::dec);
IOUtils::convertString(alt, stationMetaData.at(3), std::dec);
// HACK to obtain a valid station_name w/o spaces within
if (station_name == "") {
......
......@@ -786,7 +786,7 @@ void SMETIO::setFormatting(const MeteoData::Parameters& paramindex)
{
if ((paramindex == MeteoData::TA) || (paramindex == MeteoData::TSS) || (paramindex == MeteoData::TSG))
fout << setw(8) << setprecision(2);
else if (paramindex == MeteoData::VW)
else if ((paramindex == MeteoData::VW) || (paramindex == MeteoData::VW_MAX))
fout << setw(6) << setprecision(1);
else if (paramindex == MeteoData::DW)
fout << setw(5) << setprecision(0);
......
......@@ -356,8 +356,8 @@ void SNIO::parseMeteoLine(const std::vector<std::string>& vecLine, const std::st
md.setData(MeteoData::RSWR, tmpdata[9]);
if ((tmpdata[10] <= 1) && (tmpdata[10] != plugin_nodata)){
if ((md.ta == plugin_nodata) || (md.rh == plugin_nodata)){
tmpdata[10] = Atmosphere::Omstedt_ilwr(md.rh, md.ta, tmpdata[10]); //calculate ILWR from cloudiness
if ((md.ta != plugin_nodata) && (md.rh != plugin_nodata)){
tmpdata[10] = Atmosphere::Omstedt_ilwr(md.rh/100., C_TO_K(md.ta), tmpdata[10]); //calculate ILWR from cloudiness
} else {
tmpdata[10] = plugin_nodata;
}
......
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