The Wayback Machine - https://web.archive.org/web/20201112182857/https://github.com/xoolive/traffic/issues/103
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

Retrieving extended data doesn't work with serials argument. #103

Open
simonrp84 opened this issue Sep 21, 2020 · 1 comment
Open

Retrieving extended data doesn't work with serials argument. #103

simonrp84 opened this issue Sep 21, 2020 · 1 comment
Assignees

Comments

@simonrp84
Copy link
Contributor

@simonrp84 simonrp84 commented Sep 21, 2020

Hello,
Just to make sure you're keeping busy, a new issue ;-)

I'm trying to retrieve raw messages for particular receivers. As an example:

from datetime import datetime, timedelta
from traffic.data import opensky

data = opensky.extended(start=start_time,
                        stop=start_time + timedelta(seconds=1),
                        serials=[80391799, 1806596070] )

This produces an error saying that mintime is ambiguous. I guess this is because both the rollcall_replies_data4 table and the rollcall_replies_data4.sensors.item array contain mintime.

On my local copy of traffic I have resolved this by changing line 1073 of opensky_impala.py to this:

columns = (table_name + ".mintime, " +
           table_name + ".maxtime, " +
           table_name + ".rawmsg, " + 
           table_name + ".msgcount, " +
           table_name + ".icao24, " +
           table_name + ".hour")
orig_columns = columns

And then adding the following on line 1023 (just before df = self_format_dataframe(df)):

colnames = {}
ocols = orig_columns.split(',')
for col in ocols:
   tcol = col.lstrip().rstrip()
   pos = tcol.find('.')
   colnames[tcol] = tcol[pos+1:]
df.rename(columns=colnames, inplace=True)

This works for my particular case, but I do not know if this will break some other use of traffic, and it is also maybe not so elegant. Therefore I raise an issue rather than making a PR.
If the above changes are OK to you then I'll make a PR instead, otherwise I can leave it to you to determine the best solution :-)

@xoolive
Copy link
Owner

@xoolive xoolive commented Sep 21, 2020

I tried (almost) your changes but it breaks the tests indeed (see tests/test_impala.py with pytest). I don't have much time these days to investigate though, but I'll come to it when I get a spare minute... 🕙

@xoolive xoolive self-assigned this Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.