Open rburghol opened 2 years ago
Using wdm_insert_one:
cd ~/working/modeling/hsp2/etm
cp /opt/model/p53/cbp_wsm/config/blank_wdm/river.wdm ./
cp /media/model/p532/out/river/hsp2_2022/OR1_7700_7980_0111.csv ./
echo 'river.wdm OR1_7700_7980_0111.csv 111 0 "/opt/model/p53/cbp_wsm/code/prad_met/message.wdm"' | wdm_insert_one
Inflows to our test wdm (before using ETM):
echo "river.wdm,1984,2020,11" | wdm2text
program to write hourly ascii output from a wdm
wdm name, start year, end year, dsn
hourly average = 0.0000000000000000
annual average = 0.0000000000000000
Outflows from our test wdm:
echo "river.wdm,1984,2020,111" | wdm2text
program to write hourly ascii output from a wdm
wdm name, start year, end year, dsn
hourly average = 0.0000000000000000
annual average = 0.0000000000000000
Name: flow_hspf_format.R
Use: Rscript HARParchive/HARP-2022-Summer/AutomatedScripts/flow_hspf_format.R [riverseg] [folderpath]
Ex: Rscript HARParchive/HARP-2022-Summer/AutomatedScripts/flow_hspf_format.R OR1_7700_7980 /media/model/p532/out/river/hsp2_2022
Location (created a new folder for the files):
/media/model/p532/out/river/hsp2_2022/fortran$ ls
OR1_7700_7980_ovol3.csv OR1_7700_7980_rovol.csv
Contents:
fread("OR1_7700_7980_ovol3.csv")
year month day hour OVOL3
1: 1984, 1, 1, 1, 1.487572
2: 1984, 1, 1, 2, 2.615507
3: 1984, 1, 1, 3, 3.729025
4: 1984, 1, 1, 4, 4.828398
5: 1984, 1, 1, 5, 5.913844
---
324356: 2020, 12, 31, 20, 172.907246
324357: 2020, 12, 31, 21, 172.633483
324358: 2020, 12, 31, 22, 172.362791
324359: 2020, 12, 31, 23, 172.095006
324360: 2021, 1, 1, 0, 171.830014
fread("OR1_7700_7980_rovol.csv")
year month day hour ROVOL
1: 1984, 1, 1, 1, 1.487572
2: 1984, 1, 1, 2, 2.615507
3: 1984, 1, 1, 3, 3.729025
4: 1984, 1, 1, 4, 4.828398
5: 1984, 1, 1, 5, 5.913844
---
324356: 2020, 12, 31, 20, 172.907246
324357: 2020, 12, 31, 21, 172.633483
324358: 2020, 12, 31, 22, 172.362791
324359: 2020, 12, 31, 23, 172.095006
324360: 2021, 1, 1, 0, 171.830014
Is there anything I should change regarding names/locations/arguments? I could just have the river segment as the only argument.
NOTE: This code is used after the conversion script has been run on the csv.
Problem running stream_wdm.exe
in run_river.csh (code/src/etm/stream_wdm/main.f
)
cbp run_river.csh hsp2_2022 JL2_6850_6890
Testing:
# load vars
. hspf_config
# enter csh
csh
# verfiy vars
echo $CBP_ROOT
> /opt/model/p53/p532c-sova
# set seg
set seg = JL1_6770_6850
set ds="/RESULTS/RCHRES_R001/HYDR/table"
set mod="hydr"
set csvfile = ${seg}_hydr'.csv'
set h5file = $seg'.h5'
echo "Notice: Rscript $CBP_ROOT/run/export/export_hsp_h5.R $h5file $csvfile $ds"
Rscript $CBP_ROOT/run/export/export_hsp_h5.R $h5file $csvfile $ds
set wdmcsv = ${seg}_rovol'.csv'
echo "Notice: Rscript $CBP_ROOT/run/export/csv_export_wdm_format.R $csvfile $wdmcsv ROVOL"
Rscript $CBP_ROOT/run/export/csv_export_wdm_format.R $csvfile $wdmcsv ROVOL
# Push ROVOL into wdm
# copy here cause it is hard to send these paths to wdm_insert_one, need escape?
cp /usr/local/lib/hspf/message.wdm ./
echo ${seg}.wdm $wdmcsv 11 1 w message.wdm | wdm_insert_one
OVOL 3
is what is used here? we can verify with Gopal)stream_wdm
routine converts runoff into WDM for river inflow ./code/src/etm/stream_wdm/makefilewdm_insert_one
in fortran andh5_insert_one
in python (or locate those if they are already in existence)wdm_insert_one destination.wdm import.csv DSN has_header[0/1] path_to_message.wdm mode[0=replace,1=add]
h5_insert_one destination.h5 import.csv h5_path has_header[0/1] mode[0=replace,1=add]
hsp2 import_uci
seems to take quite a bit of time).hsp2 import_uci
step only once when usingrun_rug.csh
, and then simply update the upstream inflow data in the h5, we can eliminate approximately 1 minute per river segment run. This can be a huge savings.ETM