-
Notifications
You must be signed in to change notification settings - Fork 17
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
Data Model for Shared STATE (supports model modularity) RFC #112
Milestone
Comments
Performance test. Integer-keyed versus character-keyed
Set Up State and Time Series Dicts
Timeseries Variable Setting Only
State Variable Setting Only
|
This was referenced Jun 21, 2023
Done. Need to move to documentation. See module #126 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently,
hsp2
features domain-specific (i.e. a singleRCHERS
,PERLND
, etc) simulation and data access, with with only the current segment data, i.e. thets
Dict, parameters, and internal calculation state loaded, passed to the functional routine. To support the legacy SPEC-ACTIONS (#90) and potential new enhanced model modularity features, a robust data model is needed to facilitate passingSTATE
across multiple domains (segments) and amongst the various functions. This issue attempts to outline a proposed data structure schema to facilitate this, including performance considerations, and functional considerations. (see also: #126 )Goals
STATE
should allow calculations to be done on any publicly modifiable state variable (individual code/model domains must opt-in toSTATE
sharing).numba/@njit
STATE
data structure does not guarantee that it modifies model behavior.Benefits
Draft Data Model
Integer keyed STATE
state_paths
is 1-d, string keyed, paths based on the hierarchical paths stored in thehdf5
. Its keys are full path to hdf5STATE
, and its values point to the integer key for use in all other runtime Dicts. The key is generated automatically at the beginning of model loading and is static throughout the simulation.STATE
forRCHRES 1
,IVOL
has an hdf5 path of/STATE/RCHRES_R001/IVOL
/STATE/RCHRES_R001/IVOL
is the 25th item added to theSTATE
during model loading, and thus it's integer index is25
/STATE/RCHRES_R001/IVOL
is found in state_paths, such thatstate_paths['/STATE/RCHRES_R001/IVOL'] = 25
state_ix
: Dict that holds scalar numeric state values. It is an integer keyed, version ofhdf5
.RCHRES 1
,IVOL
state value is1803.5
IVOL
inRCHRES 1
variable is 25state_ix[25] = 1803.5
dict_ix
is integer keyed Dict to store values of array/matrix objects.ts_ix
- Dict of timeseries data (TBD: may be redundant todict_ix
, given that all ts data can be keyed via an hdf5 path)Concepts
hsp2
adoption of hdf5/STATE/RCHRES_R001/IVOL
/STATE/RCHRES_R002/IVOL
hsp2
model structure executes all timesteps for each spatial domain at one timehsp2
routines, however, base functions are fairly amenable to extracting timestep loop code.STATE
Dict showed a large performance hit over using integer-keyedSTATE
Dict. This may be due to the way in which the character-keyed Dict was set up. Testing code to be included in this issue soon.Implementation
numba
compatibility requires separate storage forDict
may perform faster than Character indexedDict
, therefore, this should be optimized. (see example below).Data Structure Option 1 - Character keyed STATE
state_ix
: Holds numeric state values. It is a single-dimension, hdf5 path keyed Dict.dict_ix
Holds values of array/matrix objects. It is multi-dimensional hdf5 path keyed Dict.ts_ix
- Holds values of timeseries dat, a (TBD: may be redundant todict_ix
, given that all ts data can be keyed via an hdf5 path)Data Structure Option 2
See above Draft Data Model
The text was updated successfully, but these errors were encountered: