Skip to content

Commit 2672322

Browse files
committed
minor assimilation decay bug fix
bug fix- excessive assimilation decay because downstream length accumulated over time (Assimilate.cpp) [issue found by R.Chlumsky] new warning if :SBGroupOverrideWeights is used for invalid blend (ParsePropertyFile.cpp) [issue found by R. Chlumsky]
1 parent 15c5d44 commit 2672322

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Assimilate.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ void CModel::PrepareAssimilation(const optStruct &Options,const time_struct &tt)
142142

143143
for(p=0; p<_nSubBasins; p++) {
144144
_aDAscale_last[p]=_aDAscale[p];
145-
_aDADrainSum[p]=0.0;
145+
_aDADrainSum [p]=0.0;
146+
_aDAlength [p]=0.0;//reboot every timestep
146147
}
147148

148149
// check for observations in each basin
@@ -192,6 +193,9 @@ void CModel::PrepareAssimilation(const optStruct &Options,const time_struct &tt)
192193
if(pdown!=DOESNT_EXIST) {
193194
_aDAlength [p]+=_pSubBasins [pdown]->GetReachLength(); //length propagates from below
194195
}
196+
else{
197+
_aDAlength[p]=0;
198+
}
195199
_aDAtimesince[p]+=Options.timestep;
196200
_aDAoverride [p]=false;
197201
_aDAobsQ [p]=0.0;

src/ParsePropertyFile.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,10 @@ bool ParseClassPropertiesFile(CModel *&pModel,
13061306
if (Len >= 4) {
13071307
// currently the N is the same for all subbasins. This may change in the future (?)
13081308
int N = pModel->GetBlendedForcingsNumWeights(s[1]);
1309+
if (N==0){
1310+
WriteWarning("ParsePropertyFile: cannot use :SBGroupOverrideWeights if blending is not already in use. Command will be ignored.",Options.noisy);
1311+
break;
1312+
}
13091313
double* uniform_nums = new double[N-1];
13101314
double* wts = new double[N];
13111315
double sum = 0.0;

0 commit comments

Comments
 (0)