traffic
traffic copied to clipboard
Wind example not functioning
Hi, I'm trying out the wind field example here and cannot get it to work, as presumably I'm missing a step.
Here's what I do:
from datetime import datetime, timedelta, timezone
from traffic.core import Traffic
from traffic.data import opensky
st_time = datetime(2019, 2, 23, 14, 0, 0).replace(tzinfo=timezone.utc)
en_time = datetime(2019, 2, 23, 16, 30, 0).replace(tzinfo=timezone.utc)
bounds = [0., 40., 5., 45.]
flights = opensky.history(start=st_time,
stop=en_time,
bounds=bounds,
other_params=" and baroaltitude>6000 ")
ehs_flights = flights.query_ehs().resample("1s").eval()
wind = ehs_flights.compute_wind.eval()
The query_ehs() line returns lots of warnings like this:
WARNING:root:No data on Impala for flight RAM950X.
The compute_wind line then gives this error:
RuntimeError: No wind data in trajectory. Consider Flight.query_ehs()
I have also tried:
flights = opensky.history(start=st_time,
stop=en_time,
bounds=bounds,
other_params=" and baroaltitude>6000 ")
df = opensky.extended(st_time, en_time, icao24=flights.icao24)
ehs_flights = flights.query_ehs(df).resample("1s").eval()
ehs_flights = compute_wind.eval()
But in this case df is NoneType.
Any ideas what is wrong here?
(edit) To add, I have emptied my cache directory and the problem persists. This is with the latest version of traffic from github master.
(second edit) The example for extended() also doesn't work for me:
df = opensky.extended(
belevingsvlucht.start,
belevingsvlucht.stop,
icao24=belevingsvlucht.icao24
)
print(type(df))
Results in: <class 'NoneType'>
Hello @simonrp84,
I don't have much time in August to investigate the issue but I think OpenSky needed some space in the past and removed some of the data which are used in the examples of the documentation...
I will come back to it ASAP.
Thanks @xoolive. Unfortunately recent data does not work either:
from datetime import datetime, timedelta, timezone
from traffic.core import Traffic
from traffic.data import opensky
st_time = datetime(2020, 8, 13, 14, 0, 0).replace(tzinfo=timezone.utc)
en_time = datetime(2020, 8, 13, 14, 30, 0).replace(tzinfo=timezone.utc)
bounds = [10., 30., 20., 40.]
flights = opensky.history(start=st_time,
stop=en_time,
bounds=bounds,
other_params=" and baroaltitude>6000 ")
( flights
.query_ehs()
.resample("1s")
.compute_wind()
.filter(wind_u=53, wind_v=53)
.resample("1T")
.eval(desc="preprocessing")
)
Gives this error:
d:\miniconda3\lib\site-packages\traffic\core\flight.py in compute_wind(self)
1236 if any(w not in self.data.columns for w in ["heading", "TAS"]):
1237 raise RuntimeError(
-> 1238 "No wind data in trajectory. Consider Flight.query_ehs()"
1239 )
1240
RuntimeError: No wind data in trajectory. Consider Flight.query_ehs()
Just as a reminder for myself (and for information @simonrp84), I will (soon 🤔) make a dataset of one day of fully decoded data over Europe so as to illustrate such examples without being subject to data expiring/disappearing on OpenSky database. It should serve for the turbulence paper as well.