Skip to content

Commit 6faf2a6

Browse files
authored
Merge pull request #57 from CSHS-CWRA/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2 parents cd058c1 + 072f606 commit 6faf2a6

25 files changed

+86
-88
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ repos:
2626
# - id: include-what-you-use
2727

2828
- repo: https://github.com/python-jsonschema/check-jsonschema
29-
rev: 0.32.1
29+
rev: 0.33.2
3030
hooks:
3131
- id: check-github-workflows
3232
- repo: meta

src/Assimilate.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void CModel::InitializeDataAssimilation(const optStruct &Options)
5959

6060
}
6161
/////////////////////////////////////////////////////////////////
62-
/// \brief Overrides flows with observations at gauges and propagates adjustments upstream of gauges
62+
/// \brief Overrides flows with observations at gauges and propagates adjustments upstream of gauges
6363
/// \param p [in] global subbasin index
6464
/// \param Options [in] current model options structure
6565
/// \param tt [in] current model time structure
@@ -102,7 +102,7 @@ void CModel::AssimilationOverride(const int p,const optStruct& Options,const tim
102102
}
103103
}
104104

105-
//
105+
//
106106
if(mass_added>0.0){_CumulInput +=mass_added/(_WatershedArea*M2_PER_KM2)*MM_PER_METER;}
107107
else {_CumulOutput-=mass_added/(_WatershedArea*M2_PER_KM2)*MM_PER_METER;}
108108

@@ -151,7 +151,7 @@ void CModel::PrepareAssimilation(const optStruct &Options,const time_struct &tt)
151151
break; //avoids duplicate observations
152152
}
153153
}
154-
}
154+
}
155155

156156
pdown=GetDownstreamBasin(p);
157157

@@ -184,7 +184,7 @@ void CModel::PrepareAssimilation(const optStruct &Options,const time_struct &tt)
184184
_aDAscale [p]= _aDAscale [pdown];
185185
_aDAlength [p]+=_pSubBasins [pdown]->GetReachLength();
186186
_aDAtimesince [p]= _aDAtimesince[pdown];
187-
_aDAoverride [p]=false;
187+
_aDAoverride [p]=false;
188188
}
189189
else{ //Nothing downstream or reservoir present in this basin, no assimilation
190190
_aDAscale [p]=1.0;
@@ -194,7 +194,7 @@ void CModel::PrepareAssimilation(const optStruct &Options,const time_struct &tt)
194194
}
195195
}
196196
}// end downstream to upstream
197-
197+
198198
//Calculate _aDADrainSum, sum of assimilated drainage areas upstream of a subbasin outlet
199199
// and _aDADownSum, drainage of nearest assimilated flow observation
200200
// dynamic because data can disappear mid simulation
@@ -221,7 +221,7 @@ void CModel::PrepareAssimilation(const optStruct &Options,const time_struct &tt)
221221
_aDADrainSum[pdown]+=_aDADrainSum[p];
222222
}
223223
}
224-
for(int pp=_nSubBasins-1;pp>=0; pp--)// downstream to upstream
224+
for(int pp=_nSubBasins-1;pp>=0; pp--)// downstream to upstream
225225
{
226226
p=GetOrderedSubBasinIndex(pp);
227227
pdown=GetDownstreamBasin(p);
@@ -266,7 +266,7 @@ void CModel::AssimilationBackPropagate(const optStruct &Options,const time_struc
266266
if (_pSubBasins[p]->GetDownstreamID()!=DOESNT_EXIST){
267267
pdown = GetSubBasinByID(_pSubBasins[p]->GetDownstreamID())->GetGlobalIndex();
268268
}
269-
269+
270270
// no observations in this basin, get scaling from downstream
271271
//----------------------------------------------------------------
272272
pdown=GetDownstreamBasin(p);
@@ -302,7 +302,7 @@ void CModel::AssimilationBackPropagate(const optStruct &Options,const time_struc
302302
}
303303
}
304304

305-
// Actually update flows
305+
// Actually update flows
306306
//----------------------------------------------------------------
307307
for(p=0; p<_nSubBasins; p++)
308308
{

src/CommonFunctions.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ double GetSaturatedVaporPressure(const double &T)//[C]
935935
const double A3=237.3;
936936
const double A4=21.87456;
937937
const double A5=265.5;
938-
938+
939939
//0.61115*exp(22.452*T/(T+ZERO_CELSIUS)); //MESH
940940

941941
//0.611*exp(17.27*Ta/(Ta+237.3)); //Common simplification of Dingman for T>0
@@ -1749,11 +1749,11 @@ double ADRCumDist(const double &t, const double &L, const double &v, const doubl
17491749
/// \param &L reach length [m]
17501750
/// \param &v celerity [m/d]
17511751
/// \param &D diffusivity [m2/d]
1752-
/// \return Returns integral
1752+
/// \return Returns integral
17531753
//
17541754
//int_0^time L/2/t^(1/2)/sqrt(pi*D)*exp(-(v*t-L)^2/(4*D*t)) dt
17551755
// extreme case (D->0): =1 for v*t<L, 0 otherwise
1756-
double G_integral(const double& t, const double& L, const double& v, const double& D)
1756+
double G_integral(const double& t, const double& L, const double& v, const double& D)
17571757
{
17581758
double G=0;
17591759
if (t<=0){return 0.0;}
@@ -1771,12 +1771,12 @@ double G_integral(const double& t, const double& L, const double& v, const doubl
17711771
/// \param &L reach length [m]
17721772
/// \param &v celerity [m/d]
17731773
/// \param &D diffusivity [m2/d]
1774-
/// \return Returns Unit hydrograph - sums to one
1774+
/// \return Returns Unit hydrograph - sums to one
17751775
//
17761776
double DiffusiveWaveUH(const int n, const double& L, const double& v, const double& D, const double& dt)
17771777
{
17781778
if (n == 0) {
1779-
return 1.0/dt*(G_integral(0.0,L,v,D)-G_integral(dt,L,v,D))+ADRCumDist(dt,L,v,D)-ADRCumDist(0.0,L,v,D);
1779+
return 1.0/dt*(G_integral(0.0,L,v,D)-G_integral(dt,L,v,D))+ADRCumDist(dt,L,v,D)-ADRCumDist(0.0,L,v,D);
17801780
}
17811781
else {
17821782
double UH=1.0/dt*(2*G_integral(n*dt,L,v,D)- G_integral((n-1)*dt,L,v,D)- G_integral((n+1)*dt,L,v,D));

src/CustomOutput.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,4 +1215,4 @@ CCustomOutput *CCustomOutput::ParseCustomOutputCommand(char *s[MAXINPUTITEMS], c
12151215
}
12161216

12171217
return pCustom;
1218-
}
1218+
}

src/DemandExpressionHandling.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,7 @@ void CDemandOptimizer::AddConstraintToLP(const int ii, const int kk, lp_lib::lpr
13311331
retval = lp_lib::set_rowex(pLinProg,lpgoalrow,1,row_val,col_ind);
13321332
ExitGracefullyIf(retval==0,"AddConstraintToLP::Error updating user-specified constraint/goal",RUNTIME_ERR);
13331333
retval = lp_lib::set_rh(pLinProg,lpgoalrow,RHS);
1334-
return;
1334+
return;
13351335
}
13361336

13371337
//bool is_stage;
@@ -1369,7 +1369,7 @@ void CDemandOptimizer::AddConstraintToLP(const int ii, const int kk, lp_lib::lpr
13691369
else {
13701370
coeff *= (pE->pTerms[j][k]->mult) * term;
13711371
}
1372-
1372+
13731373
}
13741374
}
13751375

src/DemandOptimization.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ void CDemandOptimizer::Initialize(CModel* pModel, const optStruct& Options)
572572
}
573573
}
574574
}
575-
// add reservoir delta stage DVs
575+
// add reservoir delta stage DVs
576576
res_count=0;
577577
for (int pp=0;pp<pModel->GetNumSubBasins();pp++)
578578
{
@@ -1325,7 +1325,7 @@ void CDemandOptimizer::IncrementAndSetRowName(lp_lib::lprec *pLinProg,int &rowco
13251325
//
13261326
int CDemandOptimizer::GetDVColumnInd(const dv_type typ, const int counter) const
13271327
{
1328-
int N=5;
1328+
int N=5;
13291329

13301330
if (typ==DV_QOUT ){return counter+1;}
13311331
else if (typ==DV_QOUTRES ){return _nEnabledSubBasins+counter+1;}
@@ -1474,7 +1474,7 @@ void CDemandOptimizer::SolveManagementProblem(CModel *pModel, const optStruct &O
14741474
r++;
14751475
}
14761476
}
1477-
1477+
14781478
// Set lower bounds of stages to min stage -2m
14791479
// ----------------------------------------------------------------
14801480
int res_count=0;
@@ -1710,7 +1710,7 @@ void CDemandOptimizer::SolveManagementProblem(CModel *pModel, const optStruct &O
17101710
// Mass balance equation at reach outlet:
17111711
// Q_p = (Qin +Qin2 )*U0 + sum(Ui*Qn-i) + Runoff - Div_out(Q) + Div_in - Delivered + Qadded + U_0*Qadded2 +Qreturn
17121712
// Q_p-U_0*Qin-U_0*Qin2... +Delivered -Qreturn= sum(Ui*Qn-i) + Runoff - Div_out(Q) + Div_in + Qadded + U_0*Qadded2
1713-
//
1713+
//
17141714
// or, if assimilating flows, use direct insertion:
17151715
// Q_p = Q*_p
17161716
//------------------------------------------------------------------------
@@ -1721,7 +1721,7 @@ void CDemandOptimizer::SolveManagementProblem(CModel *pModel, const optStruct &O
17211721

17221722
i=0;
17231723
Qobs=_pModel->GetObservedFlow(p,nn);
1724-
assimilating = ((Options.assimilate_flow) && (pSB->UseInFlowAssimilation()) && (Qobs!=RAV_BLANK_DATA) && (pSB->GetReservoir()==NULL));
1724+
assimilating = ((Options.assimilate_flow) && (pSB->UseInFlowAssimilation()) && (Qobs!=RAV_BLANK_DATA) && (pSB->GetReservoir()==NULL));
17251725

17261726
// outflow term =============================
17271727
col_ind[i]=GetDVColumnInd(DV_QOUT,_aSBIndices[p]);
@@ -1811,7 +1811,7 @@ void CDemandOptimizer::SolveManagementProblem(CModel *pModel, const optStruct &O
18111811
double Adt,ET,precip,seepage(0);
18121812
double h_old,dQdh,Qout_last,Qin_last,h_obs,h_dry;
18131813
bool assim_stage(false);
1814-
1814+
18151815
for (int pp = 0; pp<pModel->GetNumSubBasins(); pp++)
18161816
{
18171817
p =pModel->GetOrderedSubBasinIndex(pp);
@@ -1822,7 +1822,7 @@ void CDemandOptimizer::SolveManagementProblem(CModel *pModel, const optStruct &O
18221822
{
18231823
Qobs=_pModel->GetObservedFlow(p,nn);
18241824
assimilating = ((Options.assimilate_flow) && (pSB->UseInFlowAssimilation()) && (Qobs!=RAV_BLANK_DATA));
1825-
1825+
18261826
h_obs = pRes->GetObsStage(nn);
18271827
assim_stage = ((Options.assimilate_stage) && (pRes->UseInStageAssimilation()) && (h_obs!=RAV_BLANK_DATA));
18281828

@@ -1867,11 +1867,11 @@ void CDemandOptimizer::SolveManagementProblem(CModel *pModel, const optStruct &O
18671867
row_val[i]=+0.5;
18681868
i++;
18691869

1870-
col_ind[i]=GetDVColumnInd(DV_DSTAGE ,_aResIndices[p]);
1870+
col_ind[i]=GetDVColumnInd(DV_DSTAGE ,_aResIndices[p]);
18711871
row_val[i]=Adt;
18721872
i++;
1873-
1874-
col_ind[i]=GetDVColumnInd(DV_DSTAGE2 ,_aResIndices[p]);
1873+
1874+
col_ind[i]=GetDVColumnInd(DV_DSTAGE2 ,_aResIndices[p]);
18751875
row_val[i]=-Adt;
18761876
i++;
18771877

@@ -1882,7 +1882,7 @@ void CDemandOptimizer::SolveManagementProblem(CModel *pModel, const optStruct &O
18821882
row_val[i]=+1.0;
18831883
i++;
18841884
}
1885-
1885+
18861886
RHS=(precip-ET)-seepage-0.5*Qout_last+0.5*Qin_last;
18871887

18881888
retval = lp_lib::add_constraintex(pLinProg,i,row_val,col_ind,ROWTYPE_EQ,RHS);
@@ -1894,8 +1894,8 @@ void CDemandOptimizer::SolveManagementProblem(CModel *pModel, const optStruct &O
18941894
else //(assim_stage==true)
18951895
{
18961896
// lake assimilation equation - solves for dh
1897-
// dh+-dh- = h_obs-h_old
1898-
1897+
// dh+-dh- = h_obs-h_old
1898+
18991899
col_ind[0]=GetDVColumnInd(DV_DSTAGE ,_aResIndices[p]); row_val[0]=1.0;
19001900
col_ind[1]=GetDVColumnInd(DV_DSTAGE2 ,_aResIndices[p]); row_val[1]=-1.0;
19011901
RHS=h_obs-h_old;
@@ -1905,7 +1905,7 @@ void CDemandOptimizer::SolveManagementProblem(CModel *pModel, const optStruct &O
19051905
IncrementAndSetRowName(pLinProg,rowcount,"reser_MB_"+to_string(pSB->GetID()));
19061906
}
19071907

1908-
// Equation: Definition of delta h
1908+
// Equation: Definition of delta h
19091909
//-------------------------------------------------------
19101910
col_ind[0]=GetDVColumnInd(DV_STAGE,_aResIndices[p]); row_val[0]= 1.0;
19111911
col_ind[1]=GetDVColumnInd(DV_DSTAGE,_aResIndices[p]); row_val[1]=-1.0;
@@ -1948,10 +1948,10 @@ void CDemandOptimizer::SolveManagementProblem(CModel *pModel, const optStruct &O
19481948

19491949
lprow[p]=lp_lib::get_Nrows(pLinProg);
19501950
}
1951-
else if (assimilating)
1951+
else if (assimilating)
19521952
{
19531953
//------------------------------------------------------------------------
1954-
// Assimilating
1954+
// Assimilating
19551955
// Q^n+1 == Qobs
19561956
//------------------------------------------------------------------------
19571957

@@ -2107,7 +2107,7 @@ void CDemandOptimizer::SolveManagementProblem(CModel *pModel, const optStruct &O
21072107
//lp_lib::set_epslevel(pLinProg, EPS_MEDIUM);
21082108

21092109
retval = lp_lib::solve(pLinProg);
2110-
2110+
21112111
if (retval!=OPTIMAL)
21122112
{
21132113
if (_do_debug_level>0){ cout<<"LP instability found."<<endl; }
@@ -2184,7 +2184,7 @@ void CDemandOptimizer::SolveManagementProblem(CModel *pModel, const optStruct &O
21842184
cout << " >h " << SBID << ": "; for (int i = 0; i <= iter; i++) { cout << setprecision(10)<<ahiterHist[p][i] << " "; }cout << endl;
21852185
cout << " >B " << SBID << ": "; for (int i = 0; i <= iter; i++) { cout << aBinHist[p][i] << " "; }cout << endl;
21862186
cout << " >Sill ht "<< SBID<<": "<< sill_ht<< " diff: "<< h_iter[p]-sill_ht<<endl;
2187-
2187+
21882188
if (fabs(h_iter[p] - sill_ht) < 0.001) {
21892189
cout << " > VERY CLOSE TO SILL: PROBLEM LAKE IS "<<SBID<<endl;
21902190
}
@@ -2263,7 +2263,7 @@ void CDemandOptimizer::SolveManagementProblem(CModel *pModel, const optStruct &O
22632263
{
22642264
p =pModel->GetOrderedSubBasinIndex(pp);
22652265
pSB =pModel->GetSubBasin(p);
2266-
2266+
22672267
long long SBID=pSB->GetID();
22682268
if ((pSB->IsEnabled()) && (pSB->GetReservoir() != NULL))
22692269
{
@@ -2427,7 +2427,7 @@ void CDemandOptimizer::SolveManagementProblem(CModel *pModel, const optStruct &O
24272427
else if (typ == DV_QOUTRES)
24282428
{
24292429
if (_aDisableSDCurve[p]){ // no need to report if this is handled properly by Raven default solver
2430-
pModel->GetSubBasin(p)->GetReservoir()->SetOptimizedOutflow(value);
2430+
pModel->GetSubBasin(p)->GetReservoir()->SetOptimizedOutflow(value);
24312431
}
24322432
}
24332433
else if (typ == DV_DELIVERY)

src/EnergyTransport.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ void CEnthalpyModel::Initialize(const optStruct& Options)
546546
for(int p=0;p<_pModel->GetNumSubBasins();p++)
547547
{
548548
pBasin=_pModel->GetSubBasin(p);
549-
549+
550550
for(int i=0; i<pBasin->GetNumSegments(); i++)
551551
{
552552
_aMout[p][i]=pBasin->GetOutflowArray()[_pModel->GetSubBasin(p)->GetNumSegments()-1] * SEC_PER_DAY * hv; //not really - requires outflow rate from all segments in general case. Don't have access to this. assumes nSegs=1

src/ForcingGrid.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ bool CForcingGrid::ReadData(const optStruct &Options,
10031003
}
10041004
}
10051005
}
1006-
// Deaccumulate
1006+
// Deaccumulate
10071007
// -------------------------------
10081008
Deaccumulate();
10091009

src/ForcingGrid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ class CForcingGrid //: public CForcingGridABC
189189
void SetAsPeriodEnding (); ///< set _period_ending
190190
void SetIs3D( const bool is3D); ///< set _is3D of class
191191
void SetIdxNonZeroGridCells( const int nHydroUnits,
192-
const int nGridCells,
192+
const int nGridCells,
193193
const bool *disabledHRUs,
194194
const optStruct &Options);
195195
///< set _IdxNonZeroGridCells of class

src/IsotopeTransport.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ void CIsotopeModel::UpdateInitialConditions(const optStruct& Options)
5555
pBasin=_pModel->GetSubBasin(p);
5656

5757
int nSegments=pBasin->GetNumSegments();
58-
58+
5959
for(int i=0; i<pBasin->GetNumSegments(); i++)
6060
{
6161
_aMout[p][i]=pBasin->GetOutflowArray()[nSegments-1] * SEC_PER_DAY * Cinit; // assumes nSegs=1
6262
}
6363
_aMout_last[p]=_aMout[p][0];
6464

6565
const double *aQin=_pModel->GetSubBasin(p)->GetInflowHistory();
66-
for(int i=0; i<_nMinHist[p]; i++) {
66+
for(int i=0; i<_nMinHist[p]; i++) {
6767
_aMinHist [p][i]=aQin[i]*SEC_PER_DAY*Cinit;
6868
}
6969
const double *aQlat=_pModel->GetSubBasin(p)->GetLatHistory();
@@ -73,7 +73,7 @@ void CIsotopeModel::UpdateInitialConditions(const optStruct& Options)
7373
_aMlat_last[p]=_aMlatHist[p][0];
7474
_aMlocal [p]=_aMlat_last[p];
7575
_aMlocLast [p]=_aMlat_last[p];
76-
76+
7777
//_channel_storage[p]=0.0;
7878
//_rivulet_storage[p]=0.0;
7979

@@ -93,7 +93,7 @@ void CIsotopeModel::UpdateInitialConditions(const optStruct& Options)
9393
//////////////////////////////////////////////////////////////////
9494
/// \brief set initial surface water concentration
9595
//
96-
void CIsotopeModel::SetSurfaceWaterConc(const double& delta)
96+
void CIsotopeModel::SetSurfaceWaterConc(const double& delta)
9797
{
9898
_initSWconc=delta;
9999
}
@@ -137,7 +137,7 @@ double CIsotopeModel::ConvertConcentration(const double &delta) const
137137
/// \param iToWater [in] index of "to" water storage state variable
138138
/// \param mass [in] source mass prior to advection [mg]
139139
/// \param vol [in] source volume prior to advection [mm] or [mm-m2]
140-
/// \param Q [in] flow between source and recipient [mm/d] or [mm-m2]
140+
/// \param Q [in] flow between source and recipient [mm/d] or [mm-m2]
141141
///
142142
double CIsotopeModel::GetAdvectionCorrection(const CHydroUnit* pHRU,const int iFromWater,const int iToWater,const double& mass, const double &vol, const double &Q) const
143143
{
@@ -186,7 +186,7 @@ double CIsotopeModel::GetAdvectionCorrection(const CHydroUnit* pHRU,const int iF
186186
CK0=25.0/TO_PER_MILLE;
187187
}
188188
ep_star =alpha_star-1.0; //[-]
189-
189+
190190
if (fromType==DEPRESSION ) {eta=0.6;}
191191
else if (fromType==SOIL ) {eta=1.0;}
192192
else if (fromType==SURFACE_WATER) {eta=0.5;}
@@ -200,7 +200,7 @@ double CIsotopeModel::GetAdvectionCorrection(const CHydroUnit* pHRU,const int iF
200200
dStar=(h*dA/TO_PER_MILLE+ekin+ep_star/alpha_star)/(h - ekin - ep_star/alpha_star)*TO_PER_MILLE; //[o/oo]
201201

202202
dE =((dL/TO_PER_MILLE-ep_star)/alpha_star - h*dA/TO_PER_MILLE - ekin) / (1.0-h+ekin)*TO_PER_MILLE; //[o/oo]
203-
203+
204204
if (dE>dL){dE=dL;}
205205

206206
double C_E =CompositionToConc(dE);
@@ -225,7 +225,7 @@ double CIsotopeModel::GetAdvectionCorrection(const CHydroUnit* pHRU,const int iF
225225
}
226226
else if ( ((fromType==SNOW_LIQ) || (toType==SNOW)) ) //refreeze - dilutes snow
227227
{
228-
// \todo[funct]
228+
// \todo[funct]
229229
}
230230

231231
return 1.0;

0 commit comments

Comments
 (0)