Skip to content
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

MNT: Change map_projection to projection for Axes creation #1980

Merged
merged 1 commit into from
Aug 23, 2022

Conversation

greglucas
Copy link
Contributor

The GeoAxes class now requires the projection keyword argument rather than map_projection to be more consistent with how a normal Axes is created. In particular, this makes working with AxesGrid and other toolkits easier by enabling a consistent keyword when passing subplot_kw, axes_class, etc...

closes #1979

@greglucas greglucas added this to the 0.21 milestone Jan 5, 2022
@dopplershift
Copy link
Contributor

The change seems sensible. It's unclear to me whether the test failure is related.

@greglucas
Copy link
Contributor Author

Hm... I am pretty sure it isn't related to this because this would have complained about bad "map_projection" or similar errors.

Perhaps the numpy 1.22 floating point difference from AVX512... The difference is just over the tolerance now and only on the Linux runners.

@greglucas
Copy link
Contributor Author

@dopplershift, I think the failing tests were due to the floating point issues with AVX512 after all. I added a commit to increase the floating point dtype size 7c71977, which appears to have fixed the failing CI. I can break that out to another PR if it would help too.

@greglucas
Copy link
Contributor Author

@dopplershift, I think the commit to address that other failed test example is in this PR... Maybe I should have broken it out :)

Copy link
Contributor

@dopplershift dopplershift left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor doc adjustment and this can go in.

lib/cartopy/mpl/geoaxes.py Outdated Show resolved Hide resolved
projection = kwargs.pop("map_projection")

# The :class:`cartopy.crs.Projection` of this GeoAxes.
if not isinstance(projection, ccrs.Projection):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I missed this last time. If projection is left as its default of None, this check fails. Previously, it would have failed on kwargs.pop('map_projection'). Was there any reason you made it "optional"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good catch. I can't say I gave this a ton of thought... I was more hoping for consistency in downstream calls like AxesGrid, rather than looking at the specifics.

I guess this should actually be required above. It was previously required as you say, but gave a different error if it wasn't included... I'm inclined to update the docstring to required and not change it to raising a KeyError.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with me. Just make sure to also remove the default to None.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, I have no idea why I did that way in the first place... Let's just pop the new keyword in the else branch and then the same error will be thrown. But, we also have the additional check later on to see if it is a Projection.

The GeoAxes class now requires the projection keyword argument rather
than map_projection to be more consistent with how a normal Axes/Subplot
is created.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Instantiating from class cartopy.mpl.geoaxes.GeoAxes(*args, **kwargs)[source]
2 participants