oceanspy icon indicating copy to clipboard operation
oceanspy copied to clipboard

Cartopy>=0.20 breaks tests

Open asiddi24 opened this issue 3 years ago • 3 comments

  • OceanSpy version: 0.2.0

Description

Seems like the tests for animate were failing and it points to shapely as the culprit. They made some changes recently which I'm guessing would have triggered this. https://shapely.readthedocs.io/en/latest/migration.html

Not yet. Let me see if I can do that.

Did you try to pin shapely to the previous version and see if tests pass?

Found this Toblerity/Shapely#1180

Did you find tickets about this in the matplolib/shapely issue tracker?

asiddi24 avatar Sep 20 '21 15:09 asiddi24

We are still having this problem. I'm pinning to cartopy<0.20, but eventually we need to take a look at this issue. At this point I think we need to change something in OceanSpy, the problem is not upstream

malmans2 avatar Feb 14 '22 23:02 malmans2

I just realized the issue we have been discussing with the plot.horizontal_section is not the same issue as this one. We have not change the version of cartopy we have been using since Feb 2021. It could not have caused the recent test failing.

But if it was not cartopy, what could it be...

MaceKuailv avatar Oct 24 '22 03:10 MaceKuailv

Which issue are you referring to with "plot.horizontal_section"? Why can't the cartopy pin be responsible for the recent test failure?

ThomasHaine avatar Oct 24 '22 12:10 ThomasHaine

I figured out what part of the code causes the error.

######################This is the line of the bug I think ############################
add_labels = kwargs.pop("add_labels", False)
############################################################################
# This use to be add_labels = kwargs.pop("add_labels", None)
############################################################################
    if len(dims) == 0:
        ax = _plt.gca()
        if od.projection is None:
            _plt.tight_layout()
        else:
            if add_labels is not False:
                try:
                    gl = ax.gridlines(crs=transform, draw_labels=True)
                    gl.xlabels_top = False
                    gl.ylabels_right = False
                except TypeError:
                    # Gridlines don't work with all projections
                    pass
        return ax
    else:
        return p

the test on animation is invoking the gridlines function by mistake. I have fixed this in the pull request. And I think it will work. The only caveat is that if someone really want to add gridline to the animation, it would still fail. But I guess that's not a huge concern on out side.

MaceKuailv avatar Nov 14 '22 20:11 MaceKuailv

closed with PR #278

MaceKuailv avatar Nov 14 '22 20:11 MaceKuailv