respec/HSPsquared

mainDoE() KeyError

gcoyle83 opened this issue · 5 comments

I am unable to get the HSP2.mainDoE function working, e.g.:

HSP2.mainDoE(
    output_hdf5_path,
    doe,
    'Sensitivity_LZSN_INFILT'
)

Leads to a KeyError:

KeyError                                  Traceback (most recent call last)
Input In [34], in <cell line: 1>()
----> 1 HSP2.mainDoE(
      2     output_hdf5_path,
      3     doe,
      4     'Sensitivity_LZSN_INFILT'
      5 )

File ~\Anaconda3\envs\hsp2_py38\lib\site-packages\HSP2\mainDoE.py:134, in main(hdfname, doe, doename, saveall)
    131         ui[table].update(ruci[operation, activity, segment][table])
    133 ############ calls activity function like snow() ##############
--> 134 errors, errmessages = function(store, siminfo, ui, ts)
    135 ###############################################################
    137 for errorcnt, errormsg in zip(errors, errmessages):

File ~\Anaconda3\envs\hsp2_py38\lib\site-packages\HSP2\SNOW.py:36, in snow(io_manager, siminfo, uci, ts)
     28 ''' high level driver for SNOW module
     29 CALL: snow(store, general, ui, ts)
     30    store is the Pandas/PyTable open store
     31    siminfo is a dictionary with simulation level infor (OP_SEQUENCE for example)
     32    ui is a dictionary with segment specific HSPF UCI like data
     33    ts is a dictionary with segment specific timeseries'''
     35 steps   = siminfo['steps']                # number of simulation timesteps
---> 36 UUNITS  = siminfo['units']
     38 ts['SVP'] = SVP
     39 ts['SEASONS'] = monthval(siminfo, SEASONS)

KeyError: 'units'

From what I can tell the siminfo dict is created empty and is only assigned start and stop keys before being called again and asked to return the units key, which doesn't exist...

After looking at this a bit further and trying to trace and fix the errors on my local copy, I'm seeing that in addition to this original KeyError there are many, many more of these distributed throughout the calls to various modules from mainDoE. This seems to be related to using the store as opposed to the iomanager used in the main function. Is support for the mainDoE expected to continue?

@gcoyle83 , it looks like you've correctly identified the issue -- mainDoE needs some upgrades to be compatible with the current iomanager. I'm not sure of the best path forward here. Were you involved in the original development of the mainDoE function?

@PaulDudaRESPEC Thanks for the reply. No, not involved - I am just getting familiar with the repo to see if it is useful for my purposes. For now, I'll just avoid using the function and rely on main for conducting new runs. I will keep an eye on this, though, as it seems a very desirable feature.