Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to testing and lakefix changes #211

Merged
merged 7 commits into from
Oct 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions tests/test_1_fundamental.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@
# Get domain, reference, candidate, and optional output directory from command line arguments
# Setup a domain

#List variabls to ignore in tests, primarily accumulation variables
EXCLUDE_VARS = ['ACMELT',
'ACSNOW',
'SFCRUNOFF',
'UDRUNOFF',
'ACCPRCP',
'ACCECAN',
'ACCEDIR',
'ACCETRAN',
'qstrmvolrt',
'reference_time',
'lake_inflort']
# #################################
# Define tests

Expand Down Expand Up @@ -193,7 +205,8 @@ def test_ncores_candidate(output_dir):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
diffs = wrfhydropy.outputdiffs.OutputDataDiffs(candidate_sim_ncores.output,
candidate_sim_expected.output)
candidate_sim_expected.output,
exclude_vars=EXCLUDE_VARS)

# Assert all diff values are 0 and print diff stats if not
has_diffs = any(value != 0 for value in diffs.diff_counts.values())
Expand Down Expand Up @@ -279,7 +292,8 @@ def test_perfrestart_candidate(output_dir):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
diffs = wrfhydropy.outputdiffs.OutputDataDiffs(candidate_sim_restart.output,
candidate_sim_expected.output)
candidate_sim_expected.output,
exclude_vars=EXCLUDE_VARS)

# Assert all diff values are 0 and print diff stats if not
has_diffs = any(value != 0 for value in diffs.diff_counts.values())
Expand Down
8 changes: 6 additions & 2 deletions tests/test_2_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
sys.path.insert(0, str(pathlib.Path(__file__).parent))
from utilities import print_diffs

# Ignore reference time in regression test because it depends on wall time of model run
EXCLUDE_VARS = ['reference_time']

# regression question
def test_regression_data(output_dir):
Expand All @@ -33,7 +35,8 @@ def test_regression_data(output_dir):
warnings.simplefilter("ignore")
data_diffs = wrfhydropy.outputdiffs.OutputDataDiffs(
candidate_run_expected.output,
reference_run_expected.output
reference_run_expected.output,
exclude_vars=EXCLUDE_VARS
)

# Assert all diff values are 0 and print diff stats if not
Expand Down Expand Up @@ -66,7 +69,8 @@ def test_regression_metadata(output_dir):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
meta_data_diffs = wrfhydropy.outputdiffs.OutputMetaDataDiffs(candidate_run_expected.output,
reference_run_expected.output)
reference_run_expected.output,
exclude_vars=EXCLUDE_VARS)

# Assert all diff values are 0 and print diff stats if not
has_metadata_diffs = any(value != 0 for value in meta_data_diffs.diff_counts.values())
Expand Down
12 changes: 11 additions & 1 deletion trunk/NDHMS/Routing/module_HYDRO_io.F
Original file line number Diff line number Diff line change
Expand Up @@ -5905,6 +5905,7 @@ subroutine RESTART_OUT_nc(outFile,did)
if(rt_domain(did)%nlakes .gt. 0) then
iret = nf_def_var(ncid,"resht",NF_FLOAT,1,(/dimid_lakes/),varid)
iret = nf_def_var(ncid,"qlakeo",NF_FLOAT,1,(/dimid_lakes/),varid)
iret = nf_def_var(ncid,"qlakei",NF_FLOAT,1,(/dimid_lakes/),varid)
endif

if( nlst_rt(did)%channel_only .eq. 0 .and. &
Expand Down Expand Up @@ -6111,7 +6112,13 @@ subroutine RESTART_OUT_nc(outFile,did)
,rt_domain(did)%lake_index &
#endif
)


call w_rst_crt_nc1_lake(ncid,rt_domain(did)%nlakes,rt_domain(did)%qlakei,"qlakei" &
#ifdef MPP_LAND
,rt_domain(did)%lake_index &
#endif
)

if( nlst_rt(did)%channel_only .eq. 0 .and. &
nlst_rt(did)%channelBucket_only .eq. 0 ) &
call w_rst_rt_nc2(ncid,rt_domain(did)%ixrt,rt_domain(did)%jxrt,rt_domain(did)%LAKE_INFLORT,"lake_inflort")
Expand Down Expand Up @@ -6212,6 +6219,7 @@ subroutine RESTART_OUT_bi(outFile,did)
write(iunit,ERR=101) rt_domain(did)%cvol
write(iunit,ERR=101) rt_domain(did)%resht
write(iunit,ERR=101) rt_domain(did)%qlakeo
write(iunit,ERR=101) rt_domain(did)%qlakei
write(iunit,ERR=101) rt_domain(did)%LAKE_INFLORT
end if
if(nlst_rt(did)%GWBASESWCRT.EQ.1) then
Expand Down Expand Up @@ -6305,6 +6313,7 @@ subroutine RESTART_in_bi(inFileTmp,did)
read(iunit,ERR=101) rt_domain(did)%cvol
read(iunit,ERR=101) rt_domain(did)%resht
read(iunit,ERR=101) rt_domain(did)%qlakeo
read(iunit,ERR=101) rt_domain(did)%qlakei
read(iunit,ERR=101) rt_domain(did)%LAKE_INFLORT
end if
if(nlst_rt(did)%GWBASESWCRT.EQ.1) then
Expand Down Expand Up @@ -6815,6 +6824,7 @@ subroutine RESTART_IN_NC(inFile,did)
if(rt_domain(did)%NLAKES .gt. 0) then
call read_rst_crt_nc(ncid,rt_domain(did)%RESHT,rt_domain(did)%NLAKES,"resht")
call read_rst_crt_nc(ncid,rt_domain(did)%QLAKEO,rt_domain(did)%NLAKES,"qlakeo")
call read_rst_crt_nc(ncid,rt_domain(did)%QLAKEI,rt_domain(did)%NLAKES,"qlakei")
endif

if( nlst_rt(did)%channel_only .eq. 0 .and. &
Expand Down
2 changes: 1 addition & 1 deletion trunk/NDHMS/Routing/module_channel_routing.F
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,7 @@ Subroutine drive_CHANNEL(latval,lonval,KT, IXRT,JXRT, SUBRTSWCRT, &
call updateLake_grid(QLLAKE, nlakes,lake_index)
call updateLake_grid(RESHT, nlakes,lake_index)
call updateLake_grid(QLAKEO, nlakes,lake_index)
call updateLake_grid(QLLAKE, nlakes,lake_index)
call updateLake_grid(QLAKEI, nlakes,lake_index)
call updateLake_grid(QLAKEIP,nlakes,lake_index)
endif
#endif
Expand Down