Skip to content

Commit 3529bda

Browse files
James CraigJames Craig
authored andcommitted
v517 - rounding bug in ForcingGrid.cpp for single time-step simulation; decay in ECCC assimilation
1 parent 327fde6 commit 3529bda

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

src/Assimilate.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,11 @@ void CModel::AssimilationBackPropagate(const optStruct &Options,const time_struc
287287

288288
// Apply time and space correction factors
289289
//----------------------------------------------------------------
290-
double time_fact = _pGlobalParams->GetParams()->assim_time_decay;
291290
double distfact = _pGlobalParams->GetParams()->assim_upstream_decay/M_PER_KM; //[1/km]->[1/m]
292291
double ECCCwt;
293292
for(p=0; p<_nSubBasins; p++)
294293
{
295-
//_aDAQadjust[p] *=exp(-distfact*_aDAlength[p])*exp(-time_fact*_aDAtimesince[p]);
294+
_aDAQadjust[p] *=exp(-distfact*_aDAlength[p]);
296295
ECCCwt=1.0;
297296
if (_aDADrainSum[p]!=0.0){
298297
ECCCwt = (_pSubBasins[p]->GetDrainageArea() - _aDADrainSum[p])/(_aDADownSum[p]-_aDADrainSum[p]);

src/ForcingGrid.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ bool CForcingGrid::ReadData(const optStruct &Options,
680680

681681
// determine chunk size
682682
// -------------------------------
683-
iChunkSize = min(_ChunkSize,int((Options.duration - global_model_time) / _interval));
683+
iChunkSize = min(_ChunkSize,static_cast<int>((Options.duration - global_model_time) / _interval+0.1));//0.1 handles rounding error
684684

685685
// Open NetCDF file, Get the id of the forcing data, varid_f
686686
// -------------------------------

src/GlobalParams.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ void CGlobalParams::AutoCalculateGlobalParams(const global_struct &Gtmp, const g
296296
autocalc=SetCalculableValue(G.assim_upstream_decay,Gtmp.assim_upstream_decay,Gtemplate.assim_upstream_decay);
297297
if(autocalc)
298298
{
299-
G.assim_upstream_decay=0.01; //[1/km]
299+
G.assim_upstream_decay=0.0; //[1/km]
300300
}
301301
autocalc=SetCalculableValue(G.assim_time_decay,Gtmp.assim_time_decay,Gtemplate.assim_time_decay);
302302
if(autocalc)
@@ -382,7 +382,7 @@ void CGlobalParams::InitializeGlobalParameters(global_struct &g, bool is_templat
382382

383383
g.max_reach_seglength =DEFAULT_MAX_REACHLENGTH;//defaults to one segment per reach
384384
g.reservoir_relax =0.4;
385-
g.assim_upstream_decay =0.01;
385+
g.assim_upstream_decay =0.0;
386386
g.assim_time_decay =0.2;
387387
g.assimilation_fact =1.0;
388388
g.reservoir_demand_mult=1.0;

0 commit comments

Comments
 (0)