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

update gtfs.py script #42

Open
sidetrackedmind opened this issue May 31, 2022 · 6 comments
Open

update gtfs.py script #42

sidetrackedmind opened this issue May 31, 2022 · 6 comments
Labels
backend Issues related to the opentransit-metrics backend. good first issue Good for newcomers

Comments

@sidetrackedmind
Copy link
Collaborator

I saw the following error

/home/runner/work/opentransit-metrics-fork/opentransit-metrics-fork/backend/models/gtfs.py:756: ShapelyDeprecationWarning: The array interface is deprecated and will no longer work in Shapely 2.0. Convert the '.coords' to a numpy array instead.

When running:
python save_routes.py --s3 --timetables --scheduled-stats --agency=trimet

@sidetrackedmind sidetrackedmind added good first issue Good for newcomers backend Issues related to the opentransit-metrics backend. labels May 31, 2022
@nkanderson
Copy link
Member

Hi @sidetrackedmind! I started taking a look at this one, and had a couple of questions for you.

  • Looking at the shapely docs, it seems like there are some coordinates where the call to .coords needs to be wrapped in np.array. Specifically, get_direction_data seems to have a handful of these calls. Does that sound correct to you?
  • Do you know if there are any existing tests that would be helpful in working through this issue? I can indeed replicate the deprecation warning by running the command you provided above, but it also takes a while to run, and produces a lot of output that's not necessarily helpful in troubleshooting this issue. If not, any chance you have any debug config (i.e. a launch.json file) for vscode? :) I can look into creating something like that, but thought I'd see what you might have first.

@sidetrackedmind
Copy link
Collaborator Author

Hey @nkanderson - first off, thanks for taking a look at this!

I think you're on the right track with that shapely doc you referenced. From the doc, it seemed like the .coords call was "okay". I was looking at this line in the shapely doc in particular:

Starting with Shapely 1.8, converting a geometry object to a NumPy array directly will start raising a warning

I see an instance of that in line 842 of get_direction_data.

shape_lon_lat = np.array(geometry).T

Good question about existing tests.

Sorry that's a lot of info. Please add more comments as you have questions :)!

@nkanderson
Copy link
Member

@sidetrackedmind thank you, this is helpful! I think since I'm not yet very familiar with the data being passed around here, it would help me to create some debug config and just poke around a bit. If I get a launch.json file that seems like it could be helpful to others (I know vs code is generally a pretty popular editor), I'll open a PR with it. That all will hopefully help with adding unit tests as well, if I get to that point, or just finding the spots to update np.array calls.

@sidetrackedmind
Copy link
Collaborator Author

@nkanderson - sounds great! Feel free to put questions you have here or in slack.

@GoodGuyGregory
Copy link

Can we close this issue? I ask because it appears to be merged.

@nkanderson
Copy link
Member

@GoodGuyGregory I know we were able to complete the addition of debugging config in PR #48 linked above, but at least while I was working on this project, we hadn't merged a fix for this issue related to the deprecation message. But if you've been able to verify it's been resolved, closing sounds great as far as I'm concerned!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Issues related to the opentransit-metrics backend. good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants