Skip to content

Commit c15b27b

Browse files
James CraigJames Craig
authored andcommitted
v493 - minor subtle bug fixes [BENCHMARKED]
fix bug in ParseInput if first line in file is blank (ParseInput.cpp) fix bug in hydrographs.csv if time interval of observations <> time step (TimeSeries.cpp) (found by B. Tolson) benchmarking mode for Raven Version output (RavenMain.cpp)
1 parent c4f291a commit c15b27b

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

src/DemandOptimization.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,7 @@ void CDemandOptimizer::IdentifyUpstreamDemands()
597597
//////////////////////////////////////////////////////////////////
598598
/// \brief Initializes Demand decision variables
599599
/// \notes to be called during .rvm file read, PRIOR to declaring any user-specified DVs, goals, or constraints
600+
/// WHY? because of the expected ordering of decision variables in the GetDVColumnInd() routine
600601
/// \params pModel [in] - pointer to model
601602
/// \params Options [in] - model options structure
602603
//

src/ParseInput.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ bool ParseMainInputFile (CModel *&pModel,
491491
else if (!strcmp(s[0],":rvg_Filename" )){code=512;}//GWMIGRATE -TO REMOVE
492492

493493
if (in_ifmode_statement) {code=-6; }
494+
else if (Len==0) {code=-1; }
494495
else if (!strcmp(s[0],":rvh_Filename" )){code=160;}
495496
else if (!strcmp(s[0],":rvp_Filename" )){code=161;}
496497
else if (!strcmp(s[0],":rvt_Filename" )){code=162;}
@@ -525,6 +526,7 @@ bool ParseMainInputFile (CModel *&pModel,
525526

526527
//--------------------HYDROLOGICAL PROCESSES ---------------
527528
if (in_ifmode_statement) {code=-6; }
529+
else if (Len==0) {code=-1; }
528530
else if (!strcmp(s[0],":HydrologicProcesses" )){code=200;}//REQUIRED
529531
else if (!strcmp(s[0],":HydrologicalProcesses" )){code=200;}//REQUIRED
530532
else if (!strcmp(s[0],":Baseflow" )){code=201;}
@@ -580,6 +582,7 @@ bool ParseMainInputFile (CModel *&pModel,
580582
//...
581583
//--------------------TRANSPORT PROCESSES ---------------
582584
if (in_ifmode_statement) {code=-6; }
585+
else if (Len==0) {code=-1; }
583586
else if (!strcmp(s[0],":Transport" )){code=300;}
584587
else if (!strcmp(s[0],":FixedConcentration" )){code=301; is_temp=false;}//After corresponding DefineHRUGroup(s) command, if used
585588
else if (!strcmp(s[0],":FixedTemperature" )){code=301; is_temp=true;}//After corresponding DefineHRUGroup(s) command, if used

src/RavenMain.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ int main(int argc, char* argv[])
7171
if (WARNINGS.fail()){
7272
ExitGracefully("Main::Unable to open Raven_errors.txt. Bad output directory specified?",RAVEN_OPEN_ERR);
7373
}
74+
if (Options.benchmarking){
7475
WARNINGS<<" Raven v"+Options.version+" Build date: "<<RavenBuildDate<<endl;
7576
WARNINGS<<"----------------------------------------------------------"<<endl;
77+
}
7678
WARNINGS.close();
7779

7880
t0=clock();

src/TimeSeries.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,6 @@ CTimeSeries *CTimeSeries::Parse(CParser *p, bool is_pulse, string name, long lon
969969
else{
970970
tstep =FixTimestep(s_to_d(s[2]));
971971
}
972-
973972
nMeasurements=s_to_i(s[3]);
974973
//units =s[4]
975974
}
@@ -981,9 +980,9 @@ CTimeSeries *CTimeSeries::Parse(CParser *p, bool is_pulse, string name, long lon
981980
tstep =FixTimestep(s_to_d(s[3]));
982981
//units =s[4]
983982
}
984-
if (shift_to_per_ending)
983+
if (shift_to_per_ending) //Just shifting by time step, not data interval (messy and used for HYDROGRAPHS only)
985984
{
986-
start_day+=tstep;
985+
start_day+=Options.timestep;
987986
int leap=0;
988987
if (IsLeapYear(start_yr,Options.calendar)){ leap = 1; }
989988
if (start_day>=365+leap){start_day-=365+leap; start_yr++;}

0 commit comments

Comments
 (0)