respec / HSPsquared

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

possible bug in demand function #21

Closed AtrCheema closed 2 years ago

AtrCheema commented 5 years ago

There is a possible bug in 'demand' function in hrchhyd.py. Try running 'demand' function without jit with following input

vol = 0.0
rowFT = np.array([0.,   0.01, 0.,   0.,  ])
funct = (1,)
nexits = 1
delts = 3600.0
convf = 1.0
colind = [4.2]
outdgt = [2.1]
ODGTF = (0,)

and it will throw the error

  File "E:/debug/test.py", line 51, in demand2
    od[i] = _od1 + diff * (_od1 - rowFT[icol]) * convf                #$2356 

IndexError: index 4 is out of bounds for axis 0 with size 4

The problem with numba is that when we try to access a non-existent value in an array, it just gives a junk value like 1e-313 etc.

aufdenkampe commented 2 years ago

I think this was fully fixed with #40.