Skip to content

Commit

Permalink
linting fix
Browse files Browse the repository at this point in the history
  • Loading branch information
RobHanna-NOAA committed Aug 1, 2024
1 parent fa68aea commit d8e3588
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 20 deletions.
5 changes: 2 additions & 3 deletions fim_pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ fi
echo
echo "---- Unit (HUC) processing is complete"
date -u
Calc_Duration $pipeline_start_time
Calc_Duration "Duration : " $pipeline_start_time
echo "---------------------------------------------------"

## POST PROCESSING
Expand All @@ -130,8 +130,7 @@ echo

echo "======================== End of fim_pipeline for $runName =========="
date -u
echo "Total Duration is ..."
Calc_Duration $pipeline_start_time
Calc_Duration "Total Duration is ... " $pipeline_start_time
echo

# Exit the script
Expand Down
13 changes: 5 additions & 8 deletions fim_post_processing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ l_echo ""
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
l_echo "---- Start of fim_post_processing"
l_echo "---- Started: `date -u`"
echo ""
T_total_start
post_proc_start_time=`date +%s`

Expand Down Expand Up @@ -134,10 +135,10 @@ if [ "$COUNTER" -gt 1 ]; then
# Execute the Python file
l_echo "Updating hydroTable & scr_full_crosswalked for branches"
python3 $srcDir/update_htable_src.py -d $outputDestDir
Tcount
else
l_echo "Execution count is $COUNTER, not executing the update_htable_src.py file."
fi
Tcount


## AGGREGATE BRANCH LISTS INTO ONE ##
Expand Down Expand Up @@ -207,7 +208,6 @@ if [ "$src_adjust_usgs" = "True" ] && [ "$src_subdiv_toggle" = "True" ] && [ "$s
-nwm_recur $nwm_recur_file \
-j $jobLimit
Tcount
date -u
fi

## RUN SYNTHETIC RATING CURVE CALIBRATION W/ RAS2FIM CROSS SECTION RATING CURVES ##
Expand All @@ -221,7 +221,6 @@ if [ "$src_adjust_ras2fim" = "True" ] && [ "$src_subdiv_toggle" = "True" ] && [
-nwm_recur $nwm_recur_file \
-j $jobLimit
Tcount
date -u
fi

## RUN SYNTHETIC RATING CURVE CALIBRATION W/ BENCHMARK POINTS (.parquet files) ##
Expand All @@ -230,11 +229,11 @@ if [ "$src_adjust_spatial" = "True" ] && [ "$src_subdiv_toggle" = "True" ] && [
l_echo $startDiv"Performing SRC adjustments using benchmark point .parquet files"
python3 $srcDir/src_adjust_spatial_obs.py -fim_dir $outputDestDir -j $jobLimit
Tcount
date -u
fi

## AGGREGATE BRANCH TABLES ##
l_echo $startDiv"Aggregating branch hydrotables"

Tstart
python3 $srcDir/aggregate_by_huc.py \
-fim $outputDestDir \
Expand All @@ -243,7 +242,7 @@ python3 $srcDir/aggregate_by_huc.py \
-bridge \
-j $jobLimit
Tcount
date -u


## PERFORM MANUAL CALIBRATION
if [ "$manual_calb_toggle" = "True" ] && [ -f $man_calb_file ]; then
Expand All @@ -253,7 +252,6 @@ if [ "$manual_calb_toggle" = "True" ] && [ -f $man_calb_file ]; then
-fim_dir $outputDestDir \
-calb_file $man_calb_file
Tcount
date -u
fi


Expand All @@ -263,7 +261,6 @@ python3 $toolsDir/combine_crosswalk_tables.py \
-d $outputDestDir \
-o $outputDestDir/crosswalk_table.csv
Tcount
date -u


l_echo $startDiv"Resetting Permissions"
Expand Down Expand Up @@ -292,5 +289,5 @@ echo
l_echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
l_echo "---- End of fim_post_processing"
l_echo "---- Ended: `date -u`"
Calc_Duration $post_proc_start_time
Calc_Duration "Post Processing Duration:" $post_proc_start_time
echo
21 changes: 16 additions & 5 deletions src/bash_functions.env
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,26 @@ Tcount () {
}

# This expects a start time submitted as an arg and assumes the end time as now
Calc_Duration() {
local start_time=$1
Calc_Duration( ) {
local duration_msg_prefix=$1
local start_time=$2
local end_time=`date +%s`

local total_sec=$(( $end_time - $start_time ))
local dur_min=$((total_sec / 60))
local dur_remainder_sec=$((total_sec % 60))
local dur_hrs=$((total_sec / 3600 ))
local dur_min=$((total_sec %3600 / 60))
local dur_remainder_sec=$((total_sec %60))

if [[ "$dur_hrs" = "0" ]]; then
dur_hrs=""
else
dur_hrs="${dur_hrs} hrs"
fi

# local msg="${duration_msg_prefix} $dur_min min(s) and $dur_remainder_sec sec"
local msg="${duration_msg_prefix} ${dur_hrs} $dur_min min(s) and $dur_remainder_sec seconds"


local msg="Duration : $dur_min min(s) and $dur_remainder_sec sec"
# if an arg comes in and is a file path, we can display and record to a file
if [[ $log_file_path != "" ]]; then
echo -e $msg ; echo -e $msg >> $log_file_path
Expand Down
2 changes: 1 addition & 1 deletion src/run_by_branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,5 @@ fi

echo -e $startDiv"End Branch Processing $hucNumber $current_branch_id ..."
date -u
Calc_Duration $branch_start_time
Calc_Duration "Duration : " $branch_start_time
echo
6 changes: 3 additions & 3 deletions src/run_unit_wb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,14 @@ if [ -f $deny_unit_list ]; then
fi

echo "---- HUC $hucNumber - branches have now been processed"
Calc_Duration $branch_processing_start_time
echo
Calc_Duration "Duration for processing branches : " $branch_processing_start_time
#echo

# WRITE TO LOG FILE CONTAINING ALL HUC PROCESSING TIMES
total_duration_display="$hucNumber,$(Calc_Time $huc_start_time),$(Calc_Time_Minutes_in_Percent $huc_start_time)"
echo "$total_duration_display" >> "$outputDestDir/logs/unit/total_duration_run_by_unit_all_HUCs.csv"

date -u
echo "---- HUC processing for $hucNumber is complete"
Calc_Duration $huc_start_time
Calc_Duration "Duration for huc processing: " $huc_start_time
echo

0 comments on commit d8e3588

Please sign in to comment.