Open rburghol opened 1 year ago
Must load code from:
ts_ix = Dict.empty(key_type=types.int64, value_type=types.float32[:])
tsq = f['TIMESERIES/']
ts_ts = np.asarray(tsq['TS011']['table']['index']) # index of timestamps for each timestep. use known TS for this demo
# this code replicates a piece of the function of get_timeseries, and loads the full timeseries into a Dict
# the dict will be keyed by a simple integer, and have values at the time step only. The actual time
# at that step will be contained in ts_ts
ts_tables = list(tsq.keys())
for i in ts_tables:
if i == 'SUMMARY': continue # skip this non-numeric table
var_path = '/TIMESERIES/' + i
ix = set_state(state_ix, state_paths, var_path, 0.0)
ts_ix[ix] = np.asarray(tsq[i]['table']['values'], dtype="float32")
op_tokens, state_paths, state_ix, dict_ix = init_sim_dicts()
river = ModelObject('JU3_8900_0001')
river.state_path = specl_state_path('RCHRES', 1)
river.register_path()
river.add_input("Qin", f'{river.state_path}/HYDR/IVOL')
# alternative, using TIMESERIES:
# river.inputs["Qin"] = ["/TIMESERIES/TS011"]
# river.add_input("ps_mgd", "/TIMESERIES/TS3000")
facility = ModelObject('facility', river)
facility.make_state_path()
facility.register_path()
Qintake = Equation('Qintake', facility, "Qin * 1.21")
Qintake.make_state_path()
Qintake.register_path()
Qintake.tokenize()
Tasks:
ncode_
functions)hdf5 Data Model
Main data storage
/OBJECTS/[name]/
contains all the properties in the model_object class,log_path
,attribute_path
,state_path
,inputs
(a local_name / path array)/OBJECT/RCHRES_001/Qin
:/OBJECT/RCHRES_001/Qin/default_value