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

Dsn10 #12

Merged
merged 3 commits into from
Jan 26, 2023
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
2 changes: 1 addition & 1 deletion models/hsp2_cbp6/river/analyze/01_hydr
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ if (! $?MODEL_VERSION_CODE) then
endif

# todo: add the call to run the river hsp2 summary script here
echo "Notice(analyze): Rscript $MODEL_ROOT/run/export/hsp_hydr_analysis.R $seg $scenario $CBP_EXPORT_DIR/river/$scenario/hydr/ $CBP_EXPORT_DIR/river/$scenario/hydr/images/ $MODEL_VERSION_CODE"
echo "Notice(analyse): Rscript $MODEL_ROOT/run/export/hsp_hydr_analysis.R $seg $scenario $CBP_EXPORT_DIR/river/$scenario/hydr/${segment}_hydr.csv $CBP_EXPORT_DIR/river/$scenario/hydr/images/ $MODEL_VERSION_CODE "
Rscript $MODEL_ROOT/run/export/hsp_hydr_analysis.R $seg $scenario $CBP_EXPORT_DIR/river/$scenario/hydr/${segment}_hydr.csv $CBP_EXPORT_DIR/river/$scenario/hydr/images/ $MODEL_VERSION_CODE

4 changes: 2 additions & 2 deletions models/hsp2_cbp6/river/link/99_cleanup
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ cd $tempdir
# move all files to the model data archive
set mod="hydr"
set h5file = $seg'.h5'
mv *.csv $CBP_EXPORT_DIR/river/$scenario/$mod/ -f
cp *.csv $CBP_EXPORT_DIR/river/$scenario/$mod/ -f
chgrp $MODEL_FILES_GROUP $CBP_EXPORT_DIR/river/$scenario/$mod/$wdmcsv
chmod 664 $CBP_EXPORT_DIR/river/$scenario/$mod/*.csv
# Remove message and h5 file to save space
echo "Cleaning up $h5file -- disabled for testing!!!!!"
#rm $h5file
rm message.wdm
# todo: add the call to run the river hsp2 summary script here
mv $seg'.wdm' $tree/tmp/wdm/river/$scenario/stream/ -f
cp $seg'.wdm' $tree/tmp/wdm/river/$scenario/stream/ -f
40 changes: 40 additions & 0 deletions models/hsp2_cbp6/river/prep/09_runoff_dsn
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/csh
# Push data back into WDM file for the sediment routine to use it in the next step of run
# also this satisfies the export for the next downstream WDM
set scenario=$1
set segment=$2
set seg = $segment
set tempdir=$3
#source $MODEL_ROOT/config/control/script/${scenario}.con
source $META_MODEL_ROOT/models/$MODEL/model_config
set tree = $MODEL_ROOT
cd $tempdir

# export the flow data from DSN11 which should only be runoff since the ETM just ran
# but stream_wdm.exe doesn't add the upstream flow until later in the "run" portion of this flow
if ( $?LOCAL_TRIBS ) then
# grab the eos WDM
cp $tree/tmp/wdm/river/$scenario/eos/${seg}.wdm ./

set wdmcsv = ${seg}_0011.csv
echo "echo ${seg}.wdm,$START_YEAR,$END_YEAR,11 | wdm2text"
echo "${seg}.wdm,$START_YEAR,$END_YEAR,11" | wdm2text
cp $wdmcsv $CBP_EXPORT_DIR/river/$scenario/stream/$seg'_0010.csv' -f
echo "echo ${seg}.wdm,$START_YEAR,$END_YEAR,11 | wdm2text"
echo "${seg}.wdm,$START_YEAR,$END_YEAR,11" | wdm2text
cp $wdmcsv $CBP_EXPORT_DIR/river/$scenario/stream/$seg'_0010.csv' -f
echo "Adding DSN 11 to WDM as DSN 10"
cp /usr/local/lib/hspf/messa echo "Adding DSN 11 to WDM as DSN 10"
cp /usr/local/lib/hspf/message.wdm ./
echo "echo ${seg}.wdm $wdmcsv 10 1 w message.wdm | wdm_insert_one"
echo ${seg}.wdm $wdmcsv 10 1 w message.wdm | wdm_insert_one

# now copy the eos wdm back
cp ${seg}.wdm $tree/tmp/wdm/river/$scenario/eos/

echo "Finished Adding runoff data to DSN 10"

else
echo "LOCAL_TRIBS not enabled. All upstream and local inflow are in DSN 11"
endif

4 changes: 3 additions & 1 deletion run_model
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ if (${#argv} < 3) then
echo "Use: run_model model_name scenario_name segment_id [module=all,land,river] [step=all,prep,run,link,analyze] [plugin=all,01_...]"
echo "Environment Variables:"
echo " - MODEL_ROOT (required): the full path to the model executable."
echo " - IGNORE_ERRORS (0/1 optional): Proceed regardless of errors, i.e. ignore 'problem' file creation."
echo " - IGNORE_PROBLEMS (0/1 optional): Proceed regardless of errors, i.e. ignore 'problem' file creation."
exit
endif

# @todo: dynamically find meta_model_root, i.e., this code base
set META_MODEL_ROOT="/opt/model/meta_model"
set IGNORE_PROBLEMS = 0

# Get params from command arguments
# and set up list of modules and steps to run
Expand Down Expand Up @@ -61,6 +62,7 @@ if ( -d $model_plugins ) then
if ( ! ( $IGNORE_PROBLEMS ) ) then
echo "Error: Problem found in step $model => $module / $step / $plugin "
echo " See $work_path/problem "
exit
else
mv $work_path/problem $work_path/problem.${step}.${plugin}
echo "Warning: Problem found in step $model => $module / $step / $plugin "
Expand Down