Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix #2452 main_v11.0 airnow #2453

Merged
merged 1 commit into from
Feb 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 16 additions & 23 deletions src/tools/other/ascii2nc/airnow_locations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
// ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA
// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*


////////////////////////////////////////////////////////////////////////


using namespace std;

#include <iostream>
Expand All @@ -26,15 +24,12 @@ using namespace std;

////////////////////////////////////////////////////////////////////////


//
// Code for class AirnowLocations
//


////////////////////////////////////////////////////////////////////////


AirnowLocations::AirnowLocations()
{
//
Expand All @@ -43,27 +38,24 @@ AirnowLocations::AirnowLocations()
monitoringSiteFileName = "Monitoring_Site_Locations_V2.dat";
}


////////////////////////////////////////////////////////////////////////


AirnowLocations::~AirnowLocations()
{
}


////////////////////////////////////////////////////////////////////////

bool AirnowLocations::initialize(const string &fileName)
{
string method_name = "AirnowLocations::initialize() ";
string method_name = "AirnowLocations::initialize()";

monitoringSiteFileName = fileName;
LineDataFile locFile;
if (!locFile.open(monitoringSiteFileName.c_str())) {
mlog << Error << method_name << "->"
<< "can't open input ASCII file \"" << monitoringSiteFileName
<< "\" for reading\n\n";
mlog << Warning << "\n" << method_name << " -> "
<< "can't open input ASCII file \"" << monitoringSiteFileName
<< "\" for reading\n\n";
return false;
}
DataLine data_line;
Expand Down Expand Up @@ -119,12 +111,12 @@ bool AirnowLocations::initialize(const string &fileName)
double lon2 = monitoringSiteLon[index];
double elev2 = monitoringSiteElev[index];
if (lat != lat2 || lon != lon2 || elev != elev2 || aqsid2 != aqsid || stationid2 != stationid) {
mlog << Warning << "AirnowLocations" << method_name << "-> "
<< "Multiple values seen for a single FullAQSID (" << fullaqsid << ")"
<< "Values used: StationId:" << stationid << " Aqsid:" << aqsid << " Lat,Lon,Elev:"
<< lat << "," << lon << "," << elev
<< "Not used StationId:" << stationid2 << " Aqsid:" << aqsid2 << " Lat,Lon,Elev:"
<< lat2 << "," << lon2 << "," << elev2 << "\n\n";
mlog << Warning << "\n" << method_name << " -> "
<< "Multiple values seen for a single FullAQSID (" << fullaqsid << ")"
<< "Values used: StationId:" << stationid << " Aqsid:" << aqsid << " Lat,Lon,Elev:"
<< lat << "," << lon << "," << elev
<< "Not used StationId:" << stationid2 << " Aqsid:" << aqsid2 << " Lat,Lon,Elev:"
<< lat2 << "," << lon2 << "," << elev2 << "\n\n";
}
}
}
Expand Down Expand Up @@ -157,12 +149,12 @@ bool AirnowLocations::lookupLatLonElev(const string aqsid, double &lat, double &
if (it == monitoringSiteStationId.end()) {
it = find(monitoringSiteFullAqsid.begin(), monitoringSiteFullAqsid.end(), aqsid);
if (it == monitoringSiteFullAqsid.end()) {
return false;
return false;
} else {
index = (int)(it - monitoringSiteStationId.begin());
index = (int)(it - monitoringSiteFullAqsid.begin());
}
} else {
index = (int)(it - monitoringSiteFullAqsid.begin());
index = (int)(it - monitoringSiteStationId.begin());
}
} else {
index = (int)(it - monitoringSiteAqsid.begin());
Expand All @@ -188,9 +180,10 @@ bool AirnowLocations::_setPtr(DataLine &data_line, const string &headerName, int
return true;
}
}
mlog << Error << "AirnowLocations::_setPtr() ->"
mlog << Warning << "\nAirnowLocations::_setPtr() -> "
<< "Did not see '" << headerName << "' in the header line of file "
<< monitoringSiteFileName << "\n";
<< monitoringSiteFileName << "\n\n";
return false;
}

////////////////////////////////////////////////////////////////////////