-
Notifications
You must be signed in to change notification settings - Fork 6
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
Using a negative longitude in DemoEnv.py throws an error. #54
Comments
Hi David, did you solve your problem? For me I can generate the aircraft at Concord using your setting.
|
Good morning, I copied your code verbatim and it produced the same error:
I am using the 0.1.0 conda version. Is there a more recent version that doesn't have this behavior? |
As I checked your error, I believe you install the conda "airtrafficsim" package in your "base" environment of conda, which creates conflicts between packages. You should follow the readme in our mainpage (https://github.com/HKUST-OCTAD-LAB/AirTrafficSim), which you could try to create an individual environment for "airtrafficsim". Then you need to put the demo_2 script under the correct directory. The directory for new demos should be
|
Good morning, Your example works when I save it to a new file. It does not work when I add it to my existing file. So, the error is on my end and not in the code. Thank you for helping me sort through this. |
Try setting:
in your code. When I do this, it throws the reported error. Changing "ERA5" back to "" fixes the problem. |
If I modify DemoEnv.py as follows:
self.aircraft_head = Aircraft(self.traffic, call_sign="GHOST", aircraft_type="C25C", flight_phase=FlightPhase.CRUISE, configuration=Config.CLEAN, lat=43.223267, long=71.631273, alt=5000.0, heading=175.0, cas=250.0, fuel_weight=10000.0, payload_weight=12000.0)
Then the simulation runs as expected.
If I try to place the aircraft at Concord, NH, USA using the following code:
self.aircraft_head = Aircraft(self.traffic, call_sign="GHOST", aircraft_type="C25C", flight_phase=FlightPhase.CRUISE, configuration=Config.CLEAN, lat=43.223267, long=-71.631273, alt=5000.0, heading=175.0, cas=250.0, fuel_weight=10000.0, payload_weight=12000.0)
Then the simulation fails with the following:
emitting event "loadingMsg" to all [/] ERA5 data exists. Traffic.py - add_aircraft() GHOST Type: C25C Traffic.py - add_aircraft() FOLLOW Type: A20N emitting event "simulationEnvironment" to all [/] Exception in thread Thread-7 (_handle_event_internal): Traceback (most recent call last): File "/opt/homebrew/Caskroom/miniforge/base/envs/airtrafficsim/lib/python3.11/threading.py", line 1038, in _bootstrap_inner self.run() File "/opt/homebrew/Caskroom/miniforge/base/envs/airtrafficsim/lib/python3.11/threading.py", line 975, in run self._target(*self._args, **self._kwargs) File "/opt/homebrew/Caskroom/miniforge/base/envs/airtrafficsim/lib/python3.11/site-packages/socketio/server.py", line 733, in _handle_event_internal r = server._trigger_event(data[0], namespace, sid, *data[1:]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Caskroom/miniforge/base/envs/airtrafficsim/lib/python3.11/site-packages/socketio/server.py", line 758, in _trigger_event return self.handlers[namespace][event](*args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Caskroom/miniforge/base/envs/airtrafficsim/lib/python3.11/site-packages/flask_socketio/__init__.py", line 282, in _handler return self._handle_event(handler, message, namespace, sid, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Caskroom/miniforge/base/envs/airtrafficsim/lib/python3.11/site-packages/flask_socketio/__init__.py", line 828, in _handle_event ret = handler(*args) ^^^^^^^^^^^^^^ File "/opt/homebrew/Caskroom/miniforge/base/envs/airtrafficsim/lib/python3.11/site-packages/airtrafficsim/server/server.py", line 153, in run_simulation env.run(socketio) File "/opt/homebrew/Caskroom/miniforge/base/envs/airtrafficsim/lib/python3.11/site-packages/airtrafficsim/core/environment.py", line 134, in run self.step(socketio) File "/opt/homebrew/Caskroom/miniforge/base/envs/airtrafficsim/lib/python3.11/site-packages/airtrafficsim/core/environment.py", line 81, in step self.traffic.update(self.global_time) File "/opt/homebrew/Caskroom/miniforge/base/envs/airtrafficsim/lib/python3.11/site-packages/airtrafficsim/core/traffic.py", line 262, in update self.weather.update(self.lat, self.long, self.alt, File "/opt/homebrew/Caskroom/miniforge/base/envs/airtrafficsim/lib/python3.11/site-packages/airtrafficsim/core/weather/weather.py", line 124, in update ds = self.weather_data.sel(longitude=xr.DataArray(long, dims="points"), latitude=xr.DataArray(lat, dims="points"), time=np.datetime64( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Caskroom/miniforge/base/envs/airtrafficsim/lib/python3.11/site-packages/xarray/core/dataset.py", line 2642, in sel query_results = map_index_queries( ^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Caskroom/miniforge/base/envs/airtrafficsim/lib/python3.11/site-packages/xarray/core/indexing.py", line 190, in map_index_queries results.append(index.sel(labels, **options)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Caskroom/miniforge/base/envs/airtrafficsim/lib/python3.11/site-packages/xarray/core/indexes.py", line 498, in sel raise KeyError(f"not all values found in index {coord_name!r}") KeyError: "not all values found in index 'longitude'"
The only difference between the two is the negative sign on the longitude.
The text was updated successfully, but these errors were encountered: