rainymotion icon indicating copy to clipboard operation
rainymotion copied to clipboard

trf.estimate gives error due to empty pts_target array

Open RubenImhoff opened this issue 6 years ago • 5 comments

Hi Georgy,

With a small test for a local event, I got the following error when running the Sparse model:

<C:\Anaconda\lib\site-packages\numpy\core\fromnumeric.py:2909: RuntimeWarning: Mean of empty slice. out=out, **kwargs) C:\Anaconda\lib\site-packages\numpy\core_methods.py:73: RuntimeWarning: invalid value encountered in true_divide ret, rcount, out=ret, casting='unsafe', subok=False) C:\Anaconda\lib\site-packages\skimage\transform_geometric.py:53: RuntimeWarning: invalid value encountered in double_scalars rms = math.sqrt(np.sum((points - centroid) ** 2) / points.shape[0]) Traceback (most recent call last):

File "", line 1, in runfile('C:/Users/imhof_rn/Documents/Scripts/RainyMotion_Catchment.py', wdir='C:/Users/imhof_rn/Documents/Scripts')

File "C:\Anaconda\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile execfile(filename, namespace)

File "C:\Anaconda\lib\site-packages\spyder\utils\site\sitecustomize.py", line 87, in execfile exec(compile(scripttext, filename, 'exec'), glob, loc)

File "C:/Users/imhof_rn/Documents/Scripts/RainyMotion_Catchment.py", line 276, in optical_flow(data, eval_idx, results, "Sparse")

File "C:/Users/imhof_rn/Documents/Scripts/RainyMotion_Catchment.py", line 191, in optical_flow nowcast = model.run()

File "build\bdist.win-amd64\egg\rainymotion\models.py", line 215, in run trf.estimate(pts_source, pts_target)

File "C:\Anaconda\lib\site-packages\skimage\transform_geometric.py", line 679, in estimate _, _, V = np.linalg.svd(A)

File "C:\Anaconda\lib\site-packages\numpy\linalg\linalg.py", line 1368, in svd _assertNoEmpty2d(a)

File "C:\Anaconda\lib\site-packages\numpy\linalg\linalg.py", line 226, in _assertNoEmpty2d raise LinAlgError("Arrays cannot be empty")

LinAlgError: Arrays cannot be empty>

It seems that pts_target is an empty array for that time step, even though all data files seems okay and contain data. Are you familiar with this error?

To make it reproducible, I have added the data in a zip-file. It's a case with data from the Dutch KNMI (rows = 765, cols = 700, temp interval = 5 min.) and I use a lead time of 6 hours (72 steps).

If you need any more information, let me know!

Thanks!

Ruben

RubenImhoff avatar Feb 13 '19 23:02 RubenImhoff

Odd, github seems to have a bad day. The code did not show up as code and I believe no zip-file attached..

RubenImhoff avatar Feb 13 '19 23:02 RubenImhoff

Hi Ruben,

Could you, please, send me an email with your code and data? ayzel AT uni-potsdam.de

I will try to reproduce the problem.

At first glance, the problem is in corners identification -- probably, no corners were identified, so it is impossible to calculate transformation matrix (at least four corners are needed).

hydrogo avatar Feb 14 '19 13:02 hydrogo

Hi Georgy,

I tried this case again with the same data, but minus the first two hours (I seemed to go wrong after 50 minutes or so) and that worked perfectly. Hence, I think the problem is in the data. Possibly something is indeed wrong with one of the corners..

I'll study the data and I will let you know if I can't find any issues there. For now, I think we can close this issue.

Thanks!

RubenImhoff avatar Feb 14 '19 18:02 RubenImhoff

By the way, we have substantially improved the Dense group of 'rainymotion' models -- at the moment they are both efficient and fast. You can try them too.

And thank you for your reports!

hydrogo avatar Feb 14 '19 18:02 hydrogo

That's great news, I'll try it out!

RubenImhoff avatar Feb 14 '19 19:02 RubenImhoff