ITSLeeds / UK2GTFS

Convert UK transport data (TransXchange / ATOC CIF) to GTFS format in R
https://itsleeds.github.io/UK2GTFS/
GNU General Public License v3.0
37 stars 13 forks source link

TxC - Error converting GwynforCoachesS1 #37

Closed stupidpupil closed 2 years ago

stupidpupil commented 3 years ago

Trying to convert GwynforCoachesS1-Llanberis-Pen-y-Pass1_TXC_2021825-0748_GCAS001.xml.zip results in the following error:

GwynforCoachesS1-Llanberis-Pen-y-Pass1_TXC_2021825-0748_GCAS001.xml with error Error in `$<-.data.frame`(`*tmp*`, "exception_type", value = 1) :
  replacement has 1 row, data has 0

I've not yet had any luck working out what the underlying issue is.

mem48 commented 2 years ago

Is this from the Coaches dataset, these sometimes seem to have missing data that causes problems.

stupidpupil commented 2 years ago

I'll double-check but I think it's from the W(ales) zip.

stupidpupil commented 2 years ago

I confirm it's "Wales" rather than NCSD. (It's one of the Snowdon Sherpa branded services.)

mem48 commented 2 years ago

I've found the problem. Its a edge case where the serviced organsiation has both working day and holiday service patterns. I'm working on a fix.

mem48 commented 2 years ago

Current solution may have hidden a bug that this has revealed. The current code assumes that a servied organisation includes services during workdays and excludes them during holidays. But it could be the otherway round. The new method makes and explicit check for inclusion/exclusion and workday/holiday.

mem48 commented 2 years ago

I've committed a fix. Seems to work in a few different regions. Let me know if you have any trouble.

stupidpupil commented 2 years ago

Seems to have fixed S1!

However, I'm getting the following error on a few files: if (ExEndTime >= ExStartTime) { : missing value where TRUE/FALSE needed which I think might be a new and related problem. Will try to investigate when I can.

Examples of such files.

mem48 commented 2 years ago

Fixing one bug has revealed a few knock-on errors. I've made a few commits already and have some more to do.

mem48 commented 2 years ago

I think they are all fixed now. I've added your examples to the set of files used in automated testing https://github.com/ITSLeeds/UK2GTFS/releases/tag/0.002