Skip to content

Commit 973fd8b

Browse files
fix(environment): default missing wind to 0 for custom_atmosphere
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) <noreply@anthropic.com>
1 parent cf325e4 commit 973fd8b

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/services/environment.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,17 @@ def from_env_model(cls, env: EnvironmentModel) -> Self:
2828
elevation=env.elevation,
2929
date=env.date,
3030
)
31+
# RocketPy guards pressure/temperature against None but NOT wind, so a
32+
# custom_atmosphere with wind_u/wind_v left unset raises
33+
# "'NoneType' object has no attribute 'shape'". Default missing wind to 0
34+
# (only None is replaced — real 0.0 values and wind profiles pass through).
3135
rocketpy_env.set_atmospheric_model(
3236
type=env.atmospheric_model_type,
3337
file=env.atmospheric_model_file,
3438
pressure=env.pressure,
3539
temperature=env.temperature,
36-
wind_u=env.wind_u,
37-
wind_v=env.wind_v,
40+
wind_u=env.wind_u if env.wind_u is not None else 0.0,
41+
wind_v=env.wind_v if env.wind_v is not None else 0.0,
3842
)
3943
return cls(environment=rocketpy_env)
4044

0 commit comments

Comments
 (0)