Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SimTimer #51

Open
9 of 11 tasks
rburghol opened this issue Dec 23, 2022 · 1 comment
Open
9 of 11 tasks

SimTimer #51

rburghol opened this issue Dec 23, 2022 · 1 comment

Comments

@rburghol
Copy link

rburghol commented Dec 23, 2022

Data Model

  • timestamp
  • year
  • month
  • day
  • hr
  • min
  • sec
  • yearmo
  • jday
  • weekday
  • modays (number of days in the month)
@rburghol
Copy link
Author

rburghol commented Dec 23, 2022

Testing

import os
os.chdir("c:/usr/local/home/git/HSPsquared")

import HSP2.HYDR
import HSP2.utilities
from pandas.tseries.offsets import Minute
from HSP2.utilities_specl import *
from HSP2.SPECL import specl, _specl_
from HSP2.om_model_object import ModelObject
from HSP2.om_equation import *
from HSP2.om_data_matrix import *
from HSP2.om_sim_timer import *
from HSP2.om_model_linkage import ModelLinkage, step_model_link
from pandas import DataFrame, date_range

domain = "/STATE/RCHRES_R001/HYDR" # any objects that are connected to this object should be loaded 
op_tokens, state_paths, state_ix, dict_ix, ts_ix = init_sim_dicts()
hydr_ix = hydr_get_ix(state_ix, state_paths, domain)
print(hydr_ix)
siminfo = {}
siminfo['delt'] =3600
siminfo['tindex'] = date_range("2001-01-01", "2001-12-31", freq=Minute(siminfo['delt']))[1:]
steps = siminfo['steps'] = len(siminfo['tindex'])

ModelObject.op_tokens, ModelObject.state_paths, ModelObject.state_ix, ModelObject.dict_ix, ModelObject.ts_ix = (op_tokens, state_paths, state_ix, dict_ix, ts_ix)
timer = SimTimer('timer', False, siminfo)
timer.add_op_tokens()
river = ModelObject('RCHRES_R001')
river.state_path = specl_state_path('RCHRES', 1)
river.add_op_tokens()

mx_mon_wd = np.asarray([ [1,1.0], [2,1.0], [3,1.1], [4,1.2], [5,1.3], [6,1.4], [7,1.5], [8,1.5], [9,1.5], [10,1.4], [11,1.2], [12,1.1] ] , dtype= "float32")
mon_wd_mgd = DataMatrix('mon_wd_mgd', river, mx_mon_wd )
mon_wd_mgd.add_op_tokens()

step = 1
step_model(op_tokens, state_ix, dict_ix, ts_ix, step)
iterate_models(op_tokens, state_ix, dict_ix, ts_ix, steps)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant