From 973fd8bdd6d29cdf49dc83d22b4dbfae9871c8dd Mon Sep 17 00:00:00 2001 From: Gui-FernandesBR Date: Thu, 23 Jul 2026 09:51:02 -0300 Subject: [PATCH] fix(environment): default missing wind to 0 for custom_atmosphere MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RocketPy's set_atmospheric_model guards pressure/temperature against None but not wind, so a custom_atmosphere environment with wind_u/wind_v left unset raised "'NoneType' object has no attribute 'shape'" and hard-failed the simulation. Default a None wind component to 0.0 (only None is replaced — real 0.0 values and wind-profile lists pass through untouched). Surfaced from the Jarvis beta audit: the web client seeds wind as null and only writes on user edit, so the default Custom-atmosphere path crashed. Jarvis now coerces null->0 on egress too; this is the belt-and-suspenders backend guard. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/services/environment.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/services/environment.py b/src/services/environment.py index 991c865..96477c3 100644 --- a/src/services/environment.py +++ b/src/services/environment.py @@ -28,13 +28,17 @@ def from_env_model(cls, env: EnvironmentModel) -> Self: elevation=env.elevation, date=env.date, ) + # RocketPy guards pressure/temperature against None but NOT wind, so a + # custom_atmosphere with wind_u/wind_v left unset raises + # "'NoneType' object has no attribute 'shape'". Default missing wind to 0 + # (only None is replaced — real 0.0 values and wind profiles pass through). rocketpy_env.set_atmospheric_model( type=env.atmospheric_model_type, file=env.atmospheric_model_file, pressure=env.pressure, temperature=env.temperature, - wind_u=env.wind_u, - wind_v=env.wind_v, + wind_u=env.wind_u if env.wind_u is not None else 0.0, + wind_v=env.wind_v if env.wind_v is not None else 0.0, ) return cls(environment=rocketpy_env)