respec / HSPsquared

Hydrologic Simulation Program Python (HSPsquared)
GNU Affero General Public License v3.0
43 stars 17 forks source link

HSP2_CLI.py Parsing UCIs with WDM files indicated as "WDM1", "WDM2", ... #82

Closed rburghol closed 2 years ago

rburghol commented 2 years ago

Maybe this is only relevant to the branch that was created by @timcera to allow Linux command line execution, but also appears related to #53 .

Summary: WDM files described in the FILES block and EXT SOURCES/TARGETS with a numerical suffix are not added to the hdf5 file. Example:

FILES
<FILE>  <UN#>***<----FILE NAME------------------------------------------------->
WDM1       21   ../../../input/scenario/climate/met/nldas1121/met_A51800.wdm
WDM2       22   ../../../input/scenario/climate/prad/p20211221/prad_A51800.wdm
WDM4       24   forA51800.wdm
MESSU      25   forA51800.ech
           26   forA51800.out
END FILES

My sense is that this may simply be a convention, not an actual part of the definition that HSPF expects, but nevertheless it appears to be somewhat common (I have seen it in the CBP files, as well as TMDL uci's from 2 different modeling groups).

The error arises in the code in HSP2_CLI.py which skips these elements, as the string test expects an exact match on "WDM", not "WDMn":

        if nline[:10].strip() == "WDM":

This ends up skipping the WDM in question, then, later when running the model, it fails because it can not find the DSN (error: ). By isolating only the first 3 characters of the stripped string, the test for

By changing the conditional tothe below allows things to proceed (and my CBP UCI executes and appears to produce reasonable output, more on that later):

        if (nline[:10].strip())[:3] == "WDM":

Pull request submitted in #81

aufdenkampe commented 2 years ago

Has this issue now been resolved with this merge?

PaulDudaRESPEC commented 2 years ago

Yes, I'll close this issue now.