-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5dcbc04
commit 384ccda
Showing
5 changed files
with
75 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from pprint import pprint | ||
|
||
from numpy.testing import assert_equal | ||
|
||
from pywatershed.parameters import Parameters, PrmsParameters | ||
from pywatershed.base.parameters import _set_dict_read_write | ||
|
||
from utils import assert_dicts_equal | ||
|
||
|
||
def test_param_dd_param(domain): | ||
# round trip from read-only to read-write to read-only | ||
# use a PRMS Parameter file for now | ||
domain_dir = domain["param_file"].parent | ||
params = Parameters.from_netcdf( | ||
domain_dir / "parameters_PRMSGroundwater.nc" | ||
) | ||
# These both copy by default | ||
param_dd = params.to_dd() | ||
params2 = Parameters(**param_dd.data) | ||
|
||
assert_dicts_equal(params.data, params2.data) | ||
|
||
param_dd.data_vars["gwflow_coef"] *= 4 | ||
params3 = Parameters(**param_dd.data) | ||
|
||
try: | ||
assert_dicts_equal(params.data, params3.data) | ||
assert False | ||
except AssertionError: | ||
pass | ||
|
||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters