WikiWatershed/gwlf-e

Divide by zero on 1km AOI

Closed this issue · 3 comments

When running GWLF-E on a 1km AOI in PA via the frontend, I get the following error from debugcelery.sh:

[2016-05-25 12:46:32,709: ERROR/Worker-1] Task 244ebdf5-3aa3-44d0-b876-96293c3dc00c run from job 3257 raised exception: float division by zero
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 240, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 438, in __protected_call__
    return self.run(*args, **kwargs)
  File "/opt/app/apps/modeling/tasks.py", line 356, in run_gwlfe
    return gwlfe.run(z)
  File "/usr/local/lib/python2.7/dist-packages/gwlfe/gwlfe.py", line 42, in run
    PrelimCalculations.InitialCalculations(z)
  File "/usr/local/lib/python2.7/dist-packages/gwlfe/PrelimCalculations.py", line 21, in InitialCalculations
    z.AGSTRM = z.AgLength / z.StreamLength
ZeroDivisionError: float division by zero

There should probably be better validation on the front-end, because I wonder if a dataset without any streams is even valid for GWLF-E.

Let's check the behavior on desktop for that 1km GMS file. We may potentially run with it and zero out stream based values.

@rajadain your inclination was correct, from BME

There should be a restriction on running a model for a watershed without stream segments. As you know, we use stream length to calculate both the LS factor and streambank erosion. Without this info, the model will crash.