Skip to content

Commit

Permalink
Merge pull request #45 from NREL/MissingData
Browse files Browse the repository at this point in the history
Handle missing data by replacing with 0 and warning user
  • Loading branch information
evanweaver authored Dec 6, 2017
2 parents d5e332c + bc3d21a commit 16b812b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/dview/dvfilereader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@
#include <wx/tokenzr.h>
#include <wx/txtstrm.h>
#include <wx/wfstream.h>
#include <wx/dialog.h>


#include "wex/dview/dvfilereader.h"
#include "wex/dview/dvplotctrl.h"
#include "wex/dview/dvtimeseriesdataset.h"
#include "wex/utils.h"


vector<tuple<string, string, double> > m_unitConversions;
Expand Down Expand Up @@ -715,6 +718,15 @@ bool wxDVFileReader::FastRead(wxDVPlotCtrl *plotWin, const wxString& filename, i
dataSets[ncol]->Append(wxRealPoint(timeCounters[ncol], atof(dblbuf))); // convert number and add data point.
timeCounters[ncol] += dataSets[ncol]->GetTimeStep();
}
// in event that data is missing, what to do? For now, set to 0
else
{
wxString message;
message.Printf(wxT("Column '%s' contains missing data!\nReplacing missing data with 0's, please correct your file"), dataSets[ncol]->GetSeriesTitle());
wxShowTextMessageDialog(message, wxEmptyString, plotWin, wxSize(400,150));
dataSets[ncol]->Append(wxRealPoint(timeCounters[ncol], 0));
timeCounters[ncol] += dataSets[ncol]->GetTimeStep();
}
if (*p) p++; // skip the comma or delimiter
ncol++;
}
Expand Down

0 comments on commit 16b812b

Please sign in to comment.