-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
white water border in pixel classification #470
Comments
Hi @krd57 Thanks for reporting this bug! |
If you change lines 264-267 in SDS_preprocess.py to: im_zeros = np.zeros(im_nodata.shape).astype(bool) it should fix it. I have not encountered any issues with this change in subsequent processes but have not tested everything. Let me know if that works for you! |
Thank you so much @krd57 |
Hey @krd57 Thank you for your solution |
hi @krd57, thanks for looking into this, it's definitely a good idea to fix that.
You can try this as well see if it works. |
Hey @kvos |
looks good thanks @2320sharon , nicely written code. Feel free to make a pull request, just add it in SDS_preprocess.preprocess_single() inside an |
I'll submit a PR with this fix later today after I test this solution a bit more. |
UpdateI found out why the code wasn't working correctly for all S2 imagery. If the S2 imagery didn't have any 0's at the bottom or right side of the image, the The solution is to check for if the bottom or right side padding is greater than 0, then the code works great. New Codedef pad_edges(im_swir, im_nodata) -> np.ndarray:
top_pad, bottom_pad, left_pad, right_pad = find_edge_padding(im_swir)
# Apply this padding to your masks or other arrays as needed
# if bottom pad is 0 the entire image gets set to True
if bottom_pad >0:
im_nodata[-bottom_pad:, :] = True
# if right pad is 0 the entire image gets set to True
if right_pad >0:
im_nodata[:, -right_pad:] = True
im_nodata[:, :left_pad] = True
im_nodata[:top_pad, :] = True
return im_nodata |
great Sharon, feel free to PR directly to master. Thanks. |
When running SDS_shoreline.extract_shorelines the images have a white water/water border over the entire image. I believe this is due to the way the 0 values at the shore are being masked out in SDS_preprocess.preprocess_single. I have figured out a fix that switches the order of the logic to remove the 0s at the border.
Here is the detection image with the border:
vs with the border masked out:
The text was updated successfully, but these errors were encountered: