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

Port to use pyproj v2 #1477

Closed
dopplershift opened this issue Feb 24, 2020 · 12 comments · Fixed by #1808
Closed

Port to use pyproj v2 #1477

dopplershift opened this issue Feb 24, 2020 · 12 comments · Fixed by #1808
Milestone

Comments

@dopplershift
Copy link
Contributor

We should consider replacing our own compiled Cython extension that links directly to libproj with pyproj v2 (as initially mentioned in #1252). Benefits I see:

Cons:

  • Takes work
  • Might require upstream modification (I have no idea what our compiled wrappers do that we can't do through the pyproj python interfaces)

Given that both pyproj and PROJ are active now, it would seem to benefit us to offload this functionality upstream.

@snowman2
Copy link
Contributor

snowman2 commented Feb 25, 2020

Additional benefits:

@snowman2
Copy link
Contributor

snowman2 commented Aug 25, 2020

I have a start here: master...snowman2:pyprojv2

But there are a lot of test failures. I could definitely use some help on that (or feel free to take what I have and continue working on it).

This is the main one that pops up in a lot of places:

@atwilso
Copy link

atwilso commented Feb 2, 2021

@snowman, what's the current state of this work? I'm interested in helping untangle the dependency chain that stands in the way of Cartopy wheels but I don't know whether I should be looking at this or at Shapely first.

@snowman2
Copy link
Contributor

snowman2 commented Feb 2, 2021

#1644 needs to be resolved before the transition to pyproj can be completed.

@atwilso
Copy link

atwilso commented Feb 2, 2021

Thank you! That gives me a place to start investigating.

@greglucas
Copy link
Contributor

Note that this path would allow us to avoid the rewrite within Cartopy for PROJ8 that is being undertaken in #1752 and let pyproj handle the PROJ interfacing instead.

One major downside of all of this that I'm seeing is that somehow the tests are taking significantly longer in both situations (~10x slowdown, going from 2 minutes to 20 minutes on CI). Is there something in the new header that is inherently slower?

@snowman2
Copy link
Contributor

snowman2 commented Jun 23, 2021

Based on what I saw in #1252, cartopy uses the global context. This makes things much faster, but it is not thread-safe.

By default, pyproj creates a context for each object for thread safety reasons. The downside is the performance hit you run into. That said, you can tell pyproj to use the global context ref and see some significant performance improvements.

PROJ 8.1+ will include this change that will significantly speed things up without using the global context.

@snowman2
Copy link
Contributor

This might also impact things: OSGeo/PROJ#2734

@greglucas
Copy link
Contributor

Thanks for the summary, @snowman2! That makes it sound like the slowdown is definitely not a major issue moving forward. I'm still in favor of this solution. Would you be willing to open up a PR with that branch you had before? I'll try and ping others for a review on the celestial body/PlateCarree PR I opened.

@snowman2
Copy link
Contributor

Seems even with the global context it is slower. I wonder if this has anything to do with it: https://pyproj4.github.io/pyproj/stable/advanced_examples.html#optimize-transformations

@snowman2
Copy link
Contributor

Also wondering how the speed can compares with PROJ 8.1 (current master) 🤔

@QuLogic QuLogic added this to the 0.20 milestone Sep 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants