ydoherty / CoastSat.PlanetScope

Batch shoreline extraction toolkit for PlanetScope Dove satellite imagery
GNU General Public License v3.0
48 stars 13 forks source link

Cannot extract shoreline (IndexError: IndexError: index 9218868437227405312 is out of bounds for axis 0 with size 150) #13

Closed jimpaulobautista closed 6 months ago

jimpaulobautista commented 1 year ago

Hello, @ydoherty @kvos .

I have been trying the code you developed for CoastSat.PlanetScope automatic shoreline extraction using Planet satellite images. I have encountered some issues/errors which I brought up in the previous discussions, but I still manage to overcome them by tweaking and experimenting the code.

Right now I am nearing towards the shoreline extraction step but I am stuck for several days in this IndexError IndexError: index 9218868437227405312 is out of bounds for axis 0 with size 150. image image

Also, I noticed that when I ran that code, I was able to come up with a NmB classified image of the satellite image I fed. This may signal that I am close to completing the shoreline extraction. Based on the attached photo, though, there is no shoreline plotted. 20230311_021326_48_240c_3B_A shoreline plot

I have read all the resources online, attempted to modify the code, and tried all the suggested solutions but all of them did not work and solve my problem. Can you please help me figure out what's going on?

Thank you and I appreciate your effort to allot extra time in maintaining this github repository.

Best,

Jim Paulo Bautista

ydoherty commented 1 year ago

Hi Jim,

Apologies, I’ve had a very busy few weeks and I only maintain this in my spare time.

Where are you attempting to extract shorelines? Debugging the changes you have made will likely take a lot longer than me just attempting the site for myself. I’ll try run a few images from my end and if it doesn’t work then it may be a bug.

As a side note, that screenshot looks like a very large area of interest. Having a smaller image cropped to the coast means more sand pixels relative to water pixels so the histogram will be more bi-modal and better suited to find an appropriate threshold. That may be the issues you’re having in the thresholding step.

To make sure the issue isn’t from your end (environment issues, inputs etc) you could try run for Narrabeen on Sydney Australia with a freshly downloaded set of codes. It should work first go there if you’ve set up the site correctly as that was where the toolbox was developed and tested.

Cheers, Yarran

On Fri, 28 Jul 2023 at 16:38, Jim Paulo Bautista @.***> wrote:

Hello, @ydoherty https://github.com/ydoherty .

I have been trying the code you developed for CoastSat.PlanetScope automatic shoreline extraction using Planet satellite images. I have encountered some issues/errors which I brought up in the previous discussions, but I still manage to overcome them by tweaking and experimenting the code.

Right now I am nearing towards the shoreline extraction step but I am stuck for several days in this IndexError IndexError: index 9218868437227405312 is out of bounds for axis 0 with size 150. [image: image] https://user-images.githubusercontent.com/108282093/256743193-a9594843-f4db-432e-baed-4090e37401dc.png [image: image] https://user-images.githubusercontent.com/108282093/256743221-e7b692be-a382-4af1-9907-397b9b84847a.png

Also, I noticed that when I ran that code, I was able to come up with a NmB classified image of the satellite image I fed. This may signal that I am close to completing the shoreline extraction. Based on the attached photo, though, there is no shoreline plotted. [image: 20230311_021326_48_240c_3B_A shoreline plot] https://user-images.githubusercontent.com/108282093/256743525-5ab16126-94b6-4b89-a388-241ab4ef606b.png

I have read all the resources online, attempted to modify the code, and tried all the suggested solutions but all of them did not work and solve my problem. Can you please help me figure out what's going on?

Thank you and I appreciate your effort to allot extra time in maintaining this github repository.

Best,

Jim Paulo Bautista

— Reply to this email directly, view it on GitHub https://github.com/ydoherty/CoastSat.PlanetScope/issues/13, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKZTRQ5US4KG7BWJT3Z23LXSNNABANCNFSM6AAAAAA23CDM2U . You are receiving this because you were mentioned.Message ID: @.***>

jimpaulobautista commented 1 year ago

Hello @ydoherty ,

The site I selected is in Calauag, Quezon, Philippines. Its area is not that large in extent. The polygon/ROI is just small too, not exceeding the 100 km^2 limitation of CoastSat.

I also tried your recommendation of using satellite images of the test area (Narrabeen Beach, Australia). When I ran the code, I encountered again the popen/kwargs File Not Found Error during the TOA/mask processing step, which was the problem I also saw in executing the co-registration step.

My suspect would be that there may be bugs that should be fixed to use the CoastSat PlanetScope seamlessly.

That's all.

Thanks.

ydoherty commented 1 year ago

Hi @jimpaulobautista,

I have updated the readme to mention this, but 100km2 is very large. CoastSat uses 30m pixels, while PlanetScope is 3m. For the same area, there are 100 times as many pixels when using Planet data. I've only tested it on sites where my aoi is ~5km2 for reference. The out of bounds error is likely due to a very large number of pixels being processed. Try testing using a cropped image of 5km2 and see if that fixes anything.

RE the File Not Found Error, I haven't come across that issue when running the toolbox at Narrabeen during testing (5+ computers on windows and mac). Ensure you're using a small cropped image for Narrabeen and a newly downloaded set of code with minimal changes. I would also suggest attempting to create a new conda environment from fresh to rule out any package installation issues. Aside from that, unfortunately if I can't replicate the issue from my end, I'm not sure I can help much further.

Regards, Yarran