Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: The reference shoreline buffer is not being applied correctly in zoo #221

Closed
2320sharon opened this issue Jan 26, 2024 · 2 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@2320sharon
Copy link
Collaborator

In Zoo the reference shoreline buffer is not being applied correctly. Shorelines are being extracted even when they are outside the reference shoreline buffer as shown in the figure below. I have verified via the example below that the reference shoreline buffer is being plotted correctly, but it doesn't appear to be applied correctly.

What's weird though is that if I increase the size of the buffer more shorelines are being extracted as seen in the second figure.

1984-11-01-15-03-39_L5
1984-07-03-15-08-24_L5

@2320sharon 2320sharon added the bug Something isn't working label Jan 26, 2024
@2320sharon 2320sharon self-assigned this Jan 26, 2024
@2320sharon
Copy link
Collaborator Author

2320sharon commented Feb 26, 2024

I figured out the cause of this bug at last!
When shorelines are extracted from the image the reference shoreline buffer is dilated by 5 pixels in both the coastsat_package workflow and the zoo workflow. The issue is the reference shoreline buffer shown in the plots was not dilated at all meaning that the reference shoreline buffer shown on the plots did not reflect the actual reference shoreline buffer used to extract the shoreline.

    # dilate the reference shoreline buffer by 5 pixels to mask out anything outside the reference shoreline buffer
    se = morphology.disk(5)
    im_ref_buffer_extra = morphology.binary_dilation(im_ref_buffer, se)

Without Dilating Shoreline Buffer on Plot

  • Reference Shoreline Buffer 24m
  • last figure has the shoreline vector set to markersize 3
  • second figure has the shoreline vector set to markersize 1
    2023-12-16-18-46-24_L9

With Dilating Shoreline Buffer on Plot

  • Reference Shoreline Buffer 24m
  • Dilated by 5 pixels to match what's done in the shoreline extraction functions
    2024-01-01-18-46-21_L9

Solution

  • Plot the shoreline vector with a markersize set 1 so its more accurate
  • Plot the reference shoreline buffer dilated by 5 pixels

Tasks

  • update zoo workflow's plot_image_with_legend with markersize =1
  • update zoo workflow's shoreline_detection_figures to plot the reference shoreline buffer dilated by 5 pixels
  • update coastsat_package to plot shorelines with markersize =1

Update

The reference shoreline buffer plotted by the coastsat workflow is correct because it uses the dilated buffer to plot the shorelines unlike the zoo workflow.

@2320sharon
Copy link
Collaborator Author

So this issue was bit more complicated than I previously thought. Here is what actually ended up being the solution.
I found out within coastsat_package find_wl_contours2 and find_wl_contours1 that both of these functions were dilating the reference shoreline buffer by 5 pixels and keeping only the data within that region. The same was happening in the zoo workflows simplified_find_contours function. This would normally be fine except the SDS_shoreline.create_shoreline_buffer had already dilated the shoreline reference buffer by 5 pixels meaning that the buffer was being dilated by a total of 10 pixels, but the plot only reflected the 5 pixel dilation. I modified coastsat_package and simplified_find_contours to no longer dilate the reference shoreline buffer after it was dilated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant