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
PyHSPF fails when source directory is greater than 64 chars #10
This issue is similar to #4 but a little nuanced. The package fails when it is installed from source if the source directory is longer than 64 chars. For example, I've installed from my source directory at '/mnt/c/Users/lnguyen/Documents/GitHub/pyHSPF/' but when you add the location of the message wdm file ('src/pyhspf/core/hspfmsg.wdm') we get pasted 64 chars pretty easily.
The message file directory is hard coded into WDMUtil class at line 106.
I propose that the messagepath be an optional kwarg, such as:
class WDMUtil:
"""Class to open and read from WDM files."""
def __init__(self,
verbose = True,
messagepath = None,
):
"""
Initialize WDM environment.
...
self.messagepath = messagepath
...
if not self.messagepath:
directory = os.path.dirname(hspf.__file__)
self.messagepath = '{}/pyhspf/core/hspfmsg.wdm'.format(directory)
"""
Which would allow for a user defined location in e.g. './hspfmsg.wdm'
A PR is a click away if this API change is okay by you.
Another thought - hspfmsg.wdm could be a package resource file that is copied into a temporary dir during __init__ which would not affect the current API behavior.
This issue is similar to #4 but a little nuanced. The package fails when it is installed from source if the source directory is longer than 64 chars. For example, I've installed from my source directory at '/mnt/c/Users/lnguyen/Documents/GitHub/pyHSPF/' but when you add the location of the message wdm file ('src/pyhspf/core/hspfmsg.wdm') we get pasted 64 chars pretty easily.
The message file directory is hard coded into WDMUtil class at line 106.
I propose that the
messagepath
be an optional kwarg, such as:Which would allow for a user defined location in e.g. './hspfmsg.wdm' A PR is a click away if this API change is okay by you.