diff --git a/src/determinist/evald.cpp b/src/determinist/evald.cpp index 67355301ed0e6aac252800ab1aeea550ba266412..0ce84b6f9d6649c0f95b0ff8ac978552cc3c2df1 100644 --- a/src/determinist/evald.cpp +++ b/src/determinist/evald.cpp @@ -153,7 +153,7 @@ namespace evalhyd std::vector<xt::xkeep_slice<int>> exp; auto n_samples = bootstrap.find("n_samples")->second; auto len_sample = bootstrap.find("len_sample")->second; - if ((n_samples != -9) and (len_sample != -9)) + if ((n_samples != -9) && (len_sample != -9)) { if (dts.empty()) throw std::runtime_error( diff --git a/src/masks.hpp b/src/masks.hpp index d3ce0e696bce233c694bdae3833aa5be5497a55b..d4a1c6bd8c9e09013bb4c23b15165f3ea67ee5a1 100644 --- a/src/masks.hpp +++ b/src/masks.hpp @@ -68,8 +68,8 @@ namespace evalhyd else if (supported_op.find(mt[1]) != supported_op.end()) { if ((mt[2].str() == "median") - or (mt[2].str() == "mean") - or (mt[2].str() == "quantile")) + || (mt[2].str() == "mean") + || (mt[2].str() == "quantile")) conditions.push_back({mt[1].str(), mt[2].str(), mt[3].str()}); else // it is a simple numerical value, swap last two @@ -174,8 +174,8 @@ namespace evalhyd auto cond = var_cond.second; // condition on streamflow - if ((var == "q_obs") or (var == "q_prd_median") - or (var == "q_prd_mean")) + if ((var == "q_obs") || (var == "q_prd_median") + || (var == "q_prd_mean")) { // preprocess streamflow depending on kind auto get_q = [&]() { @@ -233,18 +233,18 @@ namespace evalhyd opr2 = cond[1][0]; val2 = get_val(cond[1][1], cond[1][2]); - if ((opr1 == "<") or (opr1 == "<=")) + if ((opr1 == "<") || (opr1 == "<=")) { - if ((opr2 == ">") or (opr2 == ">=")) + if ((opr2 == ">") || (opr2 == ">=")) { if (val2 > val1) without = true; else { within = true; } } } - else if ((opr1 == ">") or (opr1 == ">=")) + else if ((opr1 == ">") || (opr1 == ">=")) { - if ((opr2 == "<") or (opr2 == "<=")) + if ((opr2 == "<") || (opr2 == "<=")) { if (val2 > val1) within = true; @@ -257,57 +257,57 @@ namespace evalhyd // within/without if (within) { - if ((opr1 == "<") and (opr2 == ">")) + if ((opr1 == "<") && (opr2 == ">")) t_msk = xt::where((q < val1) & (q > val2), 1, t_msk); - else if ((opr1 == "<=") and (opr2 == ">")) + else if ((opr1 == "<=") && (opr2 == ">")) t_msk = xt::where((q <= val1) & (q > val2), 1, t_msk); - else if ((opr1 == "<") and (opr2 == ">=")) + else if ((opr1 == "<") && (opr2 == ">=")) t_msk = xt::where((q < val1) & (q >= val2), 1, t_msk); - else if ((opr1 == "<=") and (opr2 == ">=")) + else if ((opr1 == "<=") && (opr2 == ">=")) t_msk = xt::where((q <= val1) & (q >= val2), 1, t_msk); - if ((opr2 == "<") and (opr1 == ">")) + if ((opr2 == "<") && (opr1 == ">")) t_msk = xt::where((q < val2) & (q > val1), 1, t_msk); - else if ((opr2 == "<=") and (opr1 == ">")) + else if ((opr2 == "<=") && (opr1 == ">")) t_msk = xt::where((q <= val2) & (q > val1), 1, t_msk); - else if ((opr2 == "<") and (opr1 == ">=")) + else if ((opr2 == "<") && (opr1 == ">=")) t_msk = xt::where((q < val2) & (q >= val1), 1, t_msk); - else if ((opr2 == "<=") and (opr1 == ">=")) + else if ((opr2 == "<=") && (opr1 == ">=")) t_msk = xt::where((q <= val2) & (q >= val1), 1, t_msk); } else if (without) { - if ((opr1 == "<") and (opr2 == ">")) + if ((opr1 == "<") && (opr2 == ">")) t_msk = xt::where((q < val1) | (q > val2), 1, t_msk); - else if ((opr1 == "<=") and (opr2 == ">")) + else if ((opr1 == "<=") && (opr2 == ">")) t_msk = xt::where((q <= val1) | (q > val2), 1, t_msk); - else if ((opr1 == "<") and (opr2 == ">=")) + else if ((opr1 == "<") && (opr2 == ">=")) t_msk = xt::where((q < val1) | (q >= val2), 1, t_msk); - else if ((opr1 == "<=") and (opr2 == ">=")) + else if ((opr1 == "<=") && (opr2 == ">=")) t_msk = xt::where((q <= val1) & (q >= val2), 1, t_msk); - if ((opr2 == "<") and (opr1 == ">")) + if ((opr2 == "<") && (opr1 == ">")) t_msk = xt::where((q < val2) | (q > val1), 1, t_msk); - else if ((opr2 == "<=") and (opr1 == ">")) + else if ((opr2 == "<=") && (opr1 == ">")) t_msk = xt::where((q <= val2) | (q > val1), 1, t_msk); - else if ((opr2 == "<") and (opr1 == ">=")) + else if ((opr2 == "<") && (opr1 == ">=")) t_msk = xt::where((q < val2) | (q >= val1), 1, t_msk); - else if ((opr2 == "<=") and (opr1 == ">=")) + else if ((opr2 == "<=") && (opr1 == ">=")) t_msk = xt::where((q <= val2) | (q >= val1), 1, t_msk); } diff --git a/src/probabilist/evalp.cpp b/src/probabilist/evalp.cpp index 3e0ae7f6bec29e0cbda50c3e183db2b552ff04ce..48f709d6feef3bfd83b848b726ab1154d48c030d 100644 --- a/src/probabilist/evalp.cpp +++ b/src/probabilist/evalp.cpp @@ -149,7 +149,7 @@ namespace evalhyd std::vector<xt::xkeep_slice<int>> b_exp; auto n_samples = bootstrap.find("n_samples")->second; auto len_sample = bootstrap.find("len_sample")->second; - if ((n_samples != -9) and (len_sample != -9)) + if ((n_samples != -9) && (len_sample != -9)) { if (dts.empty()) throw std::runtime_error( diff --git a/src/uncertainty.hpp b/src/uncertainty.hpp index 168f5a1886d231ec04c98105f6556ee0f9e5cc87..fd26b45e17c868d9ad49b0498862a283522a5aa1 100644 --- a/src/uncertainty.hpp +++ b/src/uncertainty.hpp @@ -89,7 +89,7 @@ namespace evalhyd // check that year is complete (without a rigorous leap year check) int n_days = xt::sum(wdw)(); - if ((n_days != 365) and (n_days != 366)) { + if ((n_days != 365) && (n_days != 366)) { throw std::runtime_error( "year starting in " + std::to_string(y) + " is incomplete" diff --git a/src/utils.hpp b/src/utils.hpp index 60761d26e1e694d7cfde6483d6bb93788573df6c..7cc02a56f2a43732d098064eddc825042bdae24e 100644 --- a/src/utils.hpp +++ b/src/utils.hpp @@ -119,7 +119,7 @@ namespace evalhyd ); auto s = bootstrap.find("summary")->second; // TODO: change upper bound when mean+stddev and quantiles implemented - if ((s < 0) or (s > 0)) + if ((s < 0) || (s > 0)) throw std::runtime_error( "invalid value for bootstrap summary" );