HARPgroup / cbp_wsm

1 stars 0 forks source link

Update ETM / stream_wdm routine to to handle hsp2 land hdf5 files #74

Open rburghol opened 2 years ago

rburghol commented 2 years ago

ETM

rburghol commented 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
juliabruneau commented 2 years ago

New Rscript to create CSVs with OVOL3 and ROVOL

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.

rburghol commented 2 years ago

Problem running stream_wdm.exe in run_river.csh (code/src/etm/stream_wdm/main.f)

rburghol commented 2 years ago

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