GithubHelp home page GithubHelp logo

bug: not skipping about gtfs2gps HOT 5 CLOSED

ipeagit avatar ipeagit commented on July 28, 2024
bug: not skipping

from gtfs2gps.

Comments (5)

pedro-andrade-inpe avatar pedro-andrade-inpe commented on July 28, 2024

The problem occurs in filter_day_period, as it works properly for the whole saopaulo data. There are two bugs:

  1. In filter_day_period(), line 31, it is
  gtfs$stops <- gtfs$stops[ stop_id %in% stop_id ]

and should be

  gtfs$stops <- gtfs$stops[ stop_id %in% unique_stops ]

isn´t it?

  1. Filtering stop_times by time can create trips that have only one stop_time, which is inconsistent as a trip must have at least two stop_times. The implemented algorithm for gtfs2gps supposes each trip has at least two stop_times. Should such trips be removed by filter_day_period? Do you know an easy way to do that using data.table?

from gtfs2gps.

rafapereirabr avatar rafapereirabr commented on July 28, 2024

You're right. I've just fixed issue (1).

regarding issue (2), we should be able to discard trips with a single valid departure_time just as we already deal with 'invalid' trips with no valid departure_time.

from gtfs2gps.

rafapereirabr avatar rafapereirabr commented on July 28, 2024

note. the problem is in shape_id "52896", which has only one trip_id "8700-21-0"

from gtfs2gps.

rafapereirabr avatar rafapereirabr commented on July 28, 2024

I think I've fixed issue (2) with commit 34662d9.

The the number of stops (nstop) is smaller than 2, the gtfs2gps function should ignore that shape_id. There are probably better ways to go around this problem and report the shape_ids that are being ignored, but this should do the work for now.

    # Get the stops sequence with lat long linked to that route
    # each shape_id only has one stop sequence
    nstop <- gtfs_data$stop_times[trip_id %in% all_tripids, .N, by ="trip_id"]$N
    
    # If there is less than two valid stops/departure times, jump this shape_id
    if ( nstop < 2) {   return(NULL) }

from gtfs2gps.

rafapereirabr avatar rafapereirabr commented on July 28, 2024

Now fully fixed with

    # If there is less than two valid stops, jump this shape_id
    if( min(nstop) < 2){ return(NULL) } # nocov

from gtfs2gps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.