Closed rburghol closed 8 months ago
Hey @jdkleiner check this out when you get to a place where we want to start loading data.
Testing:
library("rhdf5")
dir()
[1] "hwmA51800.h5" "hwmA51800.uci" "hwmA51800.wdm"
[4] "met_A51800.wdm" "prad_A51800.wdm" "pytables-8ng29y_8.tmp"
h5_file_path = "hwmA51800.h5"
fid = H5Fopen(h5_file_path) # Opens the h5 file, fid is a h5 identifier
data_source_table = "/SPEC_ACTIONS/ACTIONS/table"
did = H5Dopen(fid, data_source_table)
# alternative when conversion errors occur data <- H5Dread(did, bit64conversion = "double")
h5read(fid, "/SPEC_ACTIONS/ACTIONS/table")[1:2,]
index OPERATION RANGE1 RANGE2 DC DS YR MO DA HR MN D T VARI S1 S2 AC
1 0 NaN 1 DY 1984 1 1 12 2 3 FNO3 +=
2 1 NaN 1 DY 1984 2 1 12 2 3 FNO3 +=
VALUE TC TS NUM CURLVL
1 0.000000 1
2 0.090044 1
> h5read(fid, "/CONTROL/EXT_SOURCES/table")[1:2,]
index SVOL SVOLNO SMEMN SMEMSB SSYST SGAPST MFACTOR TRAN TVOL TGRPN TMEMN
1 0 * TS1000 EVAP 31 ENGL 1.082 SAME PERLND PETINP
2 1 * TS1001 DEWP 31 ENGL 1.000 SAME PERLND DTMPG
TMEMSB TVOLNO COMMENT
1 P001
2 P001
HYDR-INIT
RCHRES Initial conditions for HYDR section ***
# - # VOL Initial value of COLIND *** Initial value of OUTDGT
(ac-ft) for each possible exit *** for each possible exit
EX1 EX2 EX3 EX4 EX5 *** EX1 EX2 EX3 EX4 EX5
1 30. 4.0 5.0
2 5 0.0 4.0
END HYDR-INIT
HSPF Manual 12.2
RESPEC issue development here: https://github.com/respec/HSPsquared/issues/99
main.py
the variablespecactions
is populated, and can be viewed as:print(specactions['ACTIONS']['VALUE'])
Testing dataset:
How Parsing is Done in hsp2
HSP2tools/data/ParseTable.csv
has lines for each supported UCI blockname, type_, start, end, default
1479,RCHRES,HYDR-PARM1,HYDR,PARAMETERS,OPNID,C,0,11, 1480,RCHRES,HYDR-PARM1,HYDR,PARAMETERS,VCONFG,I,11,14,0
parseD
(andparseD2
andparseD3
) support different parse styles (hsp2 is not always consistent maybe?)rely on
field = line[start:end].strip(), where
start:endare in standar python array notation where start is the 0-based index and the end is the next non-used number. Ex:
"abcdefg"[0:3] = "abc", which is array entries
0,and 2
-- not including entry 3.