OpenDrift / opendrift

Open source framework for ocean trajectory modelling
https://opendrift.github.io
GNU General Public License v2.0
249 stars 120 forks source link

Issues with seed_from_shapefile #417

Closed OakesHolland closed 3 years ago

OakesHolland commented 4 years ago

Hi!

I am using opendrift to backtrack particles from Antarctic/subantarctic coastal sites with the OceanDrift module. I have run the code fine when using o.seed_elements with a 5km radius from a lat/lon location. However I would like to run these models again by seeding from some shapefiles I have created.

So I tried this:

o.seed_from_shapefile('D:/Data/GEBCO/AAT_Locations/macca_100_clip.shp', number = 10000, time=datetime(2020, 4, 15, 0, 0))

And this is the output from that.....

13:47:45 INFO: Seeding for layer: macca_100_clip (1 features) 13:47:45 INFO: Total area of all polygons: 317191276.3961414 m2 13:47:45 INFO: Seeding 10000 elements within polygon number 1 13:47:45 INFO: At least three points needed to make a polygon

I'm not sure why it is saying that last line, the shapefiles I'm using are polygons? It's not coming up with an error per se, but if I try to o.run() it says I haven't seeded anything.

Would you have any ideas of why this is happening or any tips on how to fix it?

Thank you, Oakes Holland PhD Candidate Queensland University of Technology

knutfrode commented 4 years ago

Hi. If you can make available this shapefile, then I can have a look.

OakesHolland commented 4 years ago

Thanks for the quick reply, I have attached.

macca_100_clip.zip

Cheers, Oakes

knutfrode commented 4 years ago

I get the same error. Attached is a plot of your shapefile (from QGIS). shapefile I don't think this shapefile will work, as it is not clear which contour to seed within. Also there is a small "doughnut" to the south, which could make a problem.

If you are not able to fix this shapefile, an alternative is to use seed_from_polygondirectly (seed_from_shapefile is a wrapper around this one).

OakesHolland commented 4 years ago

Thank you - I appreciate your help! I'll look into it.

knutfrode commented 3 years ago

Closing this issue. Please re-open if still relevant.