Open rburghol opened 2 years ago
Debugging error:
problem opening file:
../../../config/control/river/.con
-postproc/river/stats/main.f
rscen(:lenrscen)
fnam = controldir//'river/'//rscen(:lenrscen)//'.con'
lenrscen
variable, which was caused all paths to be goofed up.# load some standard path variables
. hspf_config
cd $CBP_SRC
nano postproc/river/stats/main.f
# recompile
./comp_rstats.csh
cd $CBP_BIN/calibration/PWATER
./run_postproc_flow_calib.csh p532sova_2021 p532sova_2021 MN0_8300_0001
Tried to expand the parms read in the river basin to run only 1 watershed from a custom seglist
echo p532sova_hydro p532sova_2021 MN0 | $CBP_ROOT/code/bin/calib_iter_PWATER_params_p532sova_hydro.exe
MOdify steps:
nano /opt/model/p53/p532c-sova/code/src/calibration_utils/change_param/calib_iter/PWATER/main.f
# recompile
./comp_rstats.csh'
cd $CBP_BIN/calibration/PWATER
./compile_PWATER_opt.csh p532sova_hydro
# test
./test_adjust.csh p532sova_2021 p532sova_hydro MN0_8300_0001
Changed:
basin = calscen(:lencalscen)//'_'//module
to:
read(*,*,IOSTAT=arginfo) calscen,rscen,basin
if (arginfo < 0) then
basin = calscen(:lencalscen)//'_'//module
print*,'Basin auto:',basin
else
print*,'Basin arg:',basin
end if
Working on adapting scripts to recalibrate a single basin only, versus a custom list of all.
# edit this code
cd $CBP_SRC
nano /opt/model/p53/p532c-sova/code/src/calibration_utils/change_param/calib_iter/PWATER/main.f
./comp_rstats.csh
cd $CBP_BIN/calibration/PWATER/
# create the custom copy of the adjust params script
./compile_PWATER_opt.csh p532sova_hydro
# run the final param adjust step (since we've already successfully mae through an iteration)
echo p532sova_hydro p532sova_2021 MN0_8300_0001 | $CBP_ROOT/code/bin/calib_iter_PWATER_params_p532sova_hydro.exe
Fails on "orphans" list, in function getorphans() in nano ./calibration_utils/change_param/calib_iter/PWATER/getall.f
cp /opt/model/p53/p532c-sova/config/control/calib/PWATER/p532hydro/p532hydro_orphans.csv /opt/model/p53/p532c-sova/config/control/calib/PWATER/p532sova_hydro/p532sova_hydro_orphans.csv
echo p532sova_hydro p532sova_2021 MN0_8300_0001 | $CBP_ROOT/code/bin/calib_iter_PWATER_params_p532sova_hydro.exe
nano ../../../output/river/summary/p532sova_2021_sum_stats.csv
DEBUG: getRstats() reading statline MN0_8300_0001, 0.045, 1.053, 0.980, 0.715, 1.319, 0.404, 0.288, 0.826, 0.961, 1.060, -0.215, -0.130, 1.035, 1.162, 46.328, 43.923,
DEBUG: getRstats() reading statline again with nr = 8300
DEBUG: getRstats() uniquindex(nr) = 1
DEBUG: getRstats() returned from read(Tbias...)
DEBUG: getRstats() facLandEvap() Wstat(1): 1.05299997
DEBUG: returned getRstats
all accounting
A51800
Because of above https://github.com/HARPgroup/cbp_wsm/issues/40#issuecomment-1024615552 bad string handling of river segment in stats file must be problem.
./postproc/postutils/sumstats/make1type.f
returns the data and list of river segmentsls ../../output/river/summary/p532sova_2021/
;do echo $i; cat ../../output/river/summary/p532sova_2021/$i; done./test_post_cal.csh p532sova_2021 p532sova_hydro MN0_8300_0001
$CBP_ROOT/output/river/stats/p532sova_2021
./test_sum.csh p532sova_2021 p532sova_hydro MN0_8300_0001
/calibration/PWATER
directory
sumall.csh
uses grep to scrape data from individual files into a single CSVtree/code/bin/summarystats.exe
./test_adjust.csh p532sova_2021 p532sova_hydro MN0_8300_0001
cd $CBP_SRC
nano ./postproc/postutils/sumstats/main.f
./comp_rstats.csh
cd $CBP_BIN/calibration/PWATER
nano ./postproc/postutils/sumstats/make1type.f
*** This file "11" must be opened somewhere else? looking for
*** list of river segments? must find file 11!
*** File 11 is the bias file.
read(11,'(a200)',end=222) longline
ns = ns + 1
*** Check here
do i=1,len(longline)
*** now we go through and extract each river seg, which are
*** delimited by slashes '/', stash in segments
if (longline(i:i).eq.'/') segment(ns)=longline(i+1:i+13)
debug param adjust error
could not open file
../../../output/hspf/land/out/hom/p532cal/homA51063.out
error = 2
p532cal
why?
readcontrol_Lparamscen
in line 67
code
. hspf_config cd $CBP_SRC nano calibration_utils/change_param/calib_iter/PWATER/main.f ./comp_rstats.csh ./compile_PWATER_opt.csh p532sova_hydro
Create new calibration holder:
cbp copy_params.csh p532sova_2021 p532sova_cal
cbp copy_PWATER_params.csh p532sova_2021 p532sova_cal
# created by RWB to duplicate a scenario
cbp copy_river_scenario_params.csh p532cal_062211 p532sova_cal
cbp make_land_directories.csh p532sova_cal
cbp make_river_directories.csh p532sova_cal
cbp copy_calib.csh p532hydro p532sova_cal
# created by RWB to duplicate a scenario
cbp copy_land_control.csh p532sova_2021 p532sova_cal
cbp copy_river_control.csh p532sova_2021 p532sova_cal
# edit land and river con files (see below)
fgrep OR1_8280_8020 output/river/summary/p532sova_cal_sum_stats_*
#Test the model:
cbp run_all.csh p532sova_cal OR2_8130_7900
# Recalibrate:
cbp compile_PWATER_opt.csh p532sova_hydro
cbp run_PWATER_optimization.csh p532sova_cal p532sova_hydro OR2_8130_7900
# follow the recalibration for a single segment:
fgrep OR1_8280_8020 output/river/summary/p532sova_cal_sum_stats_*
Edit land control nano config/control/land/p532sova_cal.con
PARAMETERS
p532sova_cal
END PARAMETERS
...
CALIBSCEN
p532sova_cal
END CALIBSCEN
Edit river control nano config/control/river/p532sova_cal.con
PARAMETERS
p532sova_cal
END PARAMETERS
...
CALIBSCEN
p532sova_cal
END CALIBSCEN
This changes params, but makes things worse and worse (instead of better):
cbp run_PWATER_optimization.csh p532sova_cal p532sova_cal OR2_8130_7900
Run a full basin to see if this eliminates calibration divergence (instead of convergence)
# reset the params
cbp copy_PWATER_params.csh p532sova_2021 p532sova_cal
# run the calibration
cbp run_PWATER_optimization.csh p532sova_cal p532sova_cal OR7_8490_0000
Overview
Functions
copy_params.csh
- copies all input/param/[luname]/*.csvcbp copy_params.csh src_scenario dest_scenario
cbp copy_params.csh p532sova_2021 p532sova_cal
copy_PWATER_params.csh
- copies only input/param/[luname]/PWATER.csv, SNOW.csvand ATEMP.csvcbp copy_PWATER_params.csh src_scenario dest_scenario
cbp copy_PWATER_params.csh p532sova_2021 p532sova_cal
Basic Procedure
cd /opt/model/p53/p532c-sova/
. hspf_config
cd $CBP_ROOT/config/control/calib/PWATER
./copy_calib.csh p532hydro p532sova_hydro
cd config/control/calib/PWATER/
cd $CBP_ROOT/run/standard/
./run_lug.csh p532sova_2021 MN0_8300_0001
cd run/calibration/PWATER/
./compile_PWATER_opt.csh p532sova_hydro
./run_PWATER_optimization.csh p532sova_2021 p532sova_hydro MN0_8300_0001
Test Cases
cbp run_PWATER_optimization.csh p532sova_2021 p532sova_hydro OR2_8460_8271
cbp run_postproc_flow_calib.csh p532sova_2021 p532sova_hydro OR2_8130_7900 $CBP_ROOT
cat $CBP_ROOT/output/river/stats/p532sova_2021/OR2_8020_8130_1985_2005.FLOW
Detailed Modifications/Investigations
cp $CBP_ROOT/config/seglists/p532hydro_PWATER.land $CBP_ROOT/config/seglists/p532sova_hydro_PWATER.land
cp $CBP_ROOT/config/seglists/p532hydro_PWATER.riv $CBP_ROOT/config/seglists/p532sova_hydro_PWATER.riv
./config/seglists/p532hydro_PWATER.land
has all segments, and don't know why if command allows us to pass in a basin, it would run all land segs.Steps Followed
. hspf_config
cp $CBP_ROOT/config/seglists/p532hydro_PWATER.land $CBP_ROOT/config/seglists/p532sova_hydro_PWATER.land
cp $CBP_ROOT/config/seglists/p532hydro_PWATER.riv $CBP_ROOT/config/seglists/p532sova_hydro_PWATER.riv
cd /opt/model/p53/p532c-sova/config/control/calib/PWATER
./copy_calib.csh p532hydro p532sova_hydro
cd config/control/calib/PWATER/
cd run/standard/
./run_lug.csh p532sova_2021 MN0_8300_0001
cd run/calibration/PWATER/
./compile_PWATER_opt.csh p532sova_hydro
./run_PWATER_optimization.csh p532sova_2021 p532sova_hydro MN0_8300_0001
echo p532sova_hydro p532sova_2021 | $CBP_ROOT/code/bin/calib_iter_PWATER_params_p532sova_hydro.exe
./test_adjust.csh p532sova_2021 p532sova_hydro OR2_8130_7900
could not open file
../../../output/hspf/land/out/hom/p532cal/homA51063.out
error = 2
p532cal
tree? is it a problem with the calibscen?