Skip to content

Commit

Permalink
Merge pull request usgs#295 from jtwhite79/hotfix_moupopsave
Browse files Browse the repository at this point in the history
Hotfix moupopsave
  • Loading branch information
jtwhite79 authored Jun 9, 2024
2 parents e0553d7 + 887e54b commit deff757
Show file tree
Hide file tree
Showing 21 changed files with 209 additions and 1,540 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
python-version: [3.9] # , 3.7, 3.6]
python-version: [3.10] # , 3.7, 3.6]
run-type: [std]
# test_repo: [""]
# test_dir: [""]
Expand Down Expand Up @@ -46,7 +46,7 @@ jobs:

steps:

- uses: actions/checkout@v2.3.4
- uses: actions/checkout@v4
# - name: Setup Ninja
# if: ${{ runner.os == 'Windows' }}
- uses: seanmiddleditch/gha-setup-ninja@master
Expand Down Expand Up @@ -179,9 +179,15 @@ jobs:
ls -l
cd ${{ env.test_dir }}
nosetests --nocapture -v ${{ env.test_script }}
cd
nosetests -v ${{ env.test_script }}
status=$?
echo $status
if [ $status -eq 0 ]; then
exit 0
else
exit 127
fi
9 changes: 6 additions & 3 deletions benchmarks/basic_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,7 @@ def ext_stdcol_test():
par.loc[pst.adj_par_names,"standard_deviation"] = (par.loc[pst.adj_par_names,"parubnd_trans"] - par.loc[pst.adj_par_names,"parlbnd_trans"]) / 4.0
#par.loc[pst.adj_par_names[0],"mean"] = par.loc[pst.adj_par_names[0],"parubnd"]
pst.pestpp_options["ies_num_reals"] = 10
pst.pestpp_options["ies_no_noise"] = False
pst.control_data.noptmax = -1
pst.write(os.path.join(m_d,"pest_base.pst"))
pyemu.os_utils.run("{0} pest_base.pst".format(exe_path),cwd=m_d)
Expand Down Expand Up @@ -1481,14 +1482,16 @@ def sweep_bin_test():
print(np.abs(diff).max())
assert np.abs(diff).max() < 1e-7


#def fail_test():
# raise Exception("fail please")

if __name__ == "__main__":
#run()
#mf6_v5_ies_test()
#prep_ends()
sweep_bin_test()
#sweep_bin_test()
#mf6_v5_sen_test()
#ext_stdcol_test()
#shutil.copy2(os.path.join("..","exe","windows","x64","Debug","pestpp-glm.exe"),os.path.join("..","bin","win","pestpp-glm.exe"))
#shutil.copy2(os.path.join("..", "exe", "windows", "x64", "Debug", "pestpp-ies.exe"),
# os.path.join("..", "bin", "win", "pestpp-ies.exe"))
Expand Down Expand Up @@ -1526,7 +1529,7 @@ def sweep_bin_test():
#shutil.copy2(os.path.join("..","exe","windows","x64","Debug","pestpp-ies.exe"),os.path.join("..","bin","win","pestpp-ies.exe"))
#tplins1_test()

#fr_timeout_test()
fr_timeout_test()
#mf6_v5_ies_test()
#mf6_v5_sen_test()

Expand Down
2 changes: 1 addition & 1 deletion src/libs/common/config_os.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define CONFIG_OS_H_


#define PESTPP_VERSION "5.2.10";
#define PESTPP_VERSION "5.2.11";

#if defined(_WIN32) || defined(_WIN64)
#define OS_WIN
Expand Down
2 changes: 1 addition & 1 deletion src/libs/common/system_variables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ int start(string &cmd_string)
// argv[icmd] = cmds[icmd].data();
//}
//argv[cmds.size() + 1] = NULL; //last arg must be NULL

arg_v.push_back(NULL);
pid_t pid = fork();
if (pid == 0)
Expand Down
4 changes: 3 additions & 1 deletion src/libs/common/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1127,12 +1127,14 @@ void read_dense_binary(const string& filename, vector<string>& row_names, vector
cout << "reading 'dense' format matrix with " << n_obs_and_pi << " columns" << endl;
//first read the names of the columns and the rows
col_names = read_dense_binary_col_names(in,n_obs_and_pi);
streampos first_record = in.tellg();
row_names = read_dense_binary_remaining_row_names(in,col_names);


in.close();
in.open(filename.c_str(), ifstream::binary);

in.open(filename.c_str(), ifstream::binary);
in.seekg(first_record);
//resize the matrix now that we know big it should be
matrix.resize(row_names.size(), col_names.size());

Expand Down
12 changes: 10 additions & 2 deletions src/libs/pestpp_common/Ensemble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2166,10 +2166,18 @@ ParameterEnsemble ParameterEnsemble::zeros_like(int nrows)
if (nrows < 0)
nrows = real_names.size();
Eigen::MatrixXd new_reals = Eigen::MatrixXd::Zero(nrows, var_names.size());

stringstream ss;
vector<string> new_real_names;
for (int i = 0; i < nrows; i++)
new_real_names.push_back(real_names[i]);
if (i < real_names.size())
new_real_names.push_back(real_names[i]);
else
{
ss.str("");
ss << "zeros_like_real_" << i;
new_real_names.push_back(ss.str());
}


ParameterEnsemble new_en(pest_scenario_ptr, rand_gen_ptr);
new_en.from_eigen_mat(new_reals, new_real_names, var_names);
Expand Down
Loading

0 comments on commit deff757

Please sign in to comment.