codeforpdx / opentransit-metrics

Prototype of public transit data visualization system
https://opentransit-pdx.herokuapp.com/
MIT License
7 stars 8 forks source link

update gtfs.py script #42

Open sidetrackedmind opened 2 years ago

sidetrackedmind commented 2 years ago

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

nkanderson commented 2 years ago

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

sidetrackedmind commented 2 years ago

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 commented 2 years ago

@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 commented 2 years ago

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

GoodGuyGregory commented 1 year ago

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

nkanderson commented 1 year ago

@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!