fmemuir / COASTGUARD

Coastal Observation + Analysis using Satellite-derived Timeseries, Generated Using AI + Real-time Data
38 stars 5 forks source link

Plot breaks in adjust_detection() when no adjustments to NDVI threshold are made #15

Closed fmemuir closed 4 months ago

fmemuir commented 4 months ago

Bug appears when adjust_detection() is called to adjust the NDVI threshold used for veg edge extraction. If a point is clicked, the plot updates with the new veg edge position relating to that updated NDVI threshold. If no point is clicked however, and the user hits 'Enter' without clicking anything, the plot breaks with the error: vegline_latlon referenced before assignment

Investigating to see where vegline might have been defined but not vegline_latlon or vegline_proj

fmemuir commented 4 months ago

Issue was related to the parameters going into adjust_detection(), vegline is defined from the outset but not vegline_latlon or vegline_proj. When the condition on line 1994 is not satisfied (if len(pt) > 0:), thenProcessShoreline() is not called in order to define vegline_latlon or vegline_proj and the variables don't exist to be passed back upon return of the function.