Skip to content

Commit eed2e4d

Browse files
committed
OpenSky: replace NaN strings with 0.0 for Go server (strict JSON validation)
1 parent d331433 commit eed2e4d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

publishers/opensky/opensky_publisher.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,13 @@ def _post_observation(self, obs: dict):
256256
"""POST an observation to the server using direct REST (allows NaN serialization)."""
257257
import ssl
258258

259+
# Go server rejects "NaN" strings — replace with 0.0 for numeric fields
260+
if self._is_go_server:
261+
r = obs.get("result", {})
262+
for key, val in r.items():
263+
if val == "NaN":
264+
r[key] = 0.0
265+
259266
url = f"{self._base_url}/datastreams/{self._ds_id}/observations"
260267
body = json.dumps(obs).encode()
261268

0 commit comments

Comments
 (0)