djlampert / PyHSPF

Python extensions to the Hydrological Simulation Program in Fortran (HSPF), including classes for gathering input data, building input files, performing simulations, postprocessing results, calibrating hydrology process parameters, and forecasting climate and land use change effects on water resources
Other
83 stars 51 forks source link

Errors founded in create the WDM file #6

Closed xjlai closed 5 years ago

xjlai commented 6 years ago

Hi Dr. Lampert, Thanks for this useful tools of HSPF.
I try to use it to run HSPF model. I install the binary distributions provided in https://pypi.org/project/pyhspf/#files. Unfortunately, when i want to run the examples in Github. I got errors. For: test01.py I got:

File "D:/workspace/hspf/PyHSPF/examples/tests/test01.py", line 80, in wdm.create_dataset('test.wdm', 134, attributes) File "D:\Softs\WinPython\python-3.6.5.amd64\lib\site-packages\pyhspf\core\wdmutil.py", line 216, in create_dataset raise RuntimeError: No active exception to reraise

For another examples under the folder of TEST, the same errors occured. Any solutions?

Thank you! Xijun Lai from Nanjing, China

mengfeimu commented 6 years ago

Hi Xijun,

The errors related to wdmutil() usually result from wrong path to message file hspfmsg.wdm. Please check the messagepath in your script. The default setting in test01.py should be

messagepath = '{}/pyhspf/core/hspfmsg.wdm'.format(pyhspfdirectory)

This path usually has more than 64 characters and that length of path is not allowed in pyhspf.

My solution is to copy pyhspf/core/hspfmsg.wdm to a short path (less than 64 characters), e.g. C:/temp/hspfmsg.wdm. And you should specify your messagepath by WDMUtil(messagepath=yourpath). Actually, this issue was solved and closed as unable to open message file in this repo.

This should solve your problem.

Mengfei

djlampert commented 5 years ago

Looks like this may have been resolved, so I'm going to close it out.

scalet98 commented 4 years ago

Thank you for good explanation !~ I also solved the problem by designating the messagepath path and using the below line as you explained !~ wdm = WDMUtil(verbose = True, messagepath = messagepath) :)