Has anyone had an error like this before while plotting?
| IllegalArgumentException: Points of LinearRing do not form a closed linestring
...
| ValueError: GEOSGeom_createLinearRing_r returned a NULL pointer
The error happens when I'm trying to plot and seems to be related to my np array for the contouring. But I've looked it through front and back and can't figure out what's going on. Internet searches suggest it's related to the geometry/polygons, but that doesn't make sense in the context of the error. If anyone has insight into an error like this please reach out. :)
There's a hard to nail down bug somewhere in Cartopy's contour where it converts the contours to proper geometry objects (in order to e.g. clip the contours to the map boundary). See for example: https://github.com/SciTools/cartopy/issues/1711
The best workaround is to tweak your contour interval or map boundaries to try to avoid the problematic contours.
Great, thanks for the advice
Last updated: May 16 2025 at 17:14 UTC