jgliss / pyplis

Python toolbox for the analysis of UV SO2 camera data
GNU General Public License v3.0
7 stars 5 forks source link

Add warning when next() overshoots Imglist #2

Closed solvejgdinger closed 5 years ago

solvejgdinger commented 6 years ago

It seems that the Imglist.next() / Imglist.next_img() method is implemted in a circular way, means it will return the first image when called at the last element of Imglist (e.g. when Imglist.cfn==Imglist.nof). Did I notice that correctly? It causes probelms if you loop over the Imglist not by using a range of indices but a conditional clause. A warning when the end of the lmglist is reached would be very beneficial for debugging. Or a solution which does not allow any overshooting as it is not meaningful in time series analysis.

solvejgdinger commented 5 years ago

Commit 8110695 includes warnings when the end of the imglist is reached and the next image should be loaded. It also raises an IndexError when the index should be changed to an invalid index (i.a. after the last index). The IndexError can be caught when the application requires that.