Skip to content

Commit 7cab158

Browse files
BUG: Fix Environment.max_expected_height for custom atmosphere (#707)
* BUG: fix custom atmosphere max_expected_height * BUG: fix custom atmosphere max_expected_height * BUG: fix custom atmosphere max_expected_height * BUG: fix custom atmosphere max_expected_height * MNT: skip setter validation for the environment attribute * DEV: updates CHANGELOG
1 parent 57f1e79 commit 7cab158

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Attention: The newest changes should be on top -->
4040

4141
### Fixed
4242

43+
- BUG: Fix Environment.max_expected_height for custom atmosphere [#707](https://github.com/RocketPy-Team/RocketPy/pull/707)
4344
- BUG: Initialize _Controller Init Parameters [#703](https://github.com/RocketPy-Team/RocketPy/pull/703)
4445
- BUG: Rail Buttons Not Accepted in Add Surfaces [#701](https://github.com/RocketPy-Team/RocketPy/pull/701)
4546
- BUG: Vector encoding breaks MonteCarlo export. [#704](https://github.com/RocketPy-Team/RocketPy/pull/704)

rocketpy/environment/environment.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ def process_standard_atmosphere(self):
13131313
self.__set_wind_speed_function(0)
13141314

13151315
# 80k meters is the limit of the standard atmosphere
1316-
self.max_expected_height = 80000
1316+
self._max_expected_height = 80000
13171317

13181318
def process_custom_atmosphere(
13191319
self, pressure=None, temperature=None, wind_u=0, wind_v=0
@@ -1390,7 +1390,7 @@ def process_custom_atmosphere(
13901390
None
13911391
"""
13921392
# Initialize an estimate of the maximum expected atmospheric model height
1393-
max_expected_height = 1000
1393+
max_expected_height = self.max_expected_height or 1000
13941394

13951395
# Save pressure profile
13961396
if pressure is None:
@@ -1434,7 +1434,7 @@ def wind_heading_func(h): # TODO: create another custom reset for heading
14341434
self.__reset_wind_direction_function()
14351435
self.__reset_wind_speed_function()
14361436

1437-
self.max_expected_height = max_expected_height
1437+
self._max_expected_height = max_expected_height
14381438

14391439
def process_windy_atmosphere(
14401440
self, model="ECMWF"
@@ -1509,7 +1509,7 @@ def process_windy_atmosphere(
15091509
self.__set_wind_speed_function(data_array[:, (1, 7)])
15101510

15111511
# Save maximum expected height
1512-
self.max_expected_height = max(altitude_array[0], altitude_array[-1])
1512+
self._max_expected_height = max(altitude_array[0], altitude_array[-1])
15131513

15141514
# Get elevation data from file
15151515
self.elevation = float(response["header"]["elevation"])
@@ -1647,7 +1647,7 @@ def process_wyoming_sounding(self, file): # pylint: disable=too-many-statements
16471647
)
16481648

16491649
# Save maximum expected height
1650-
self.max_expected_height = data_array[-1, 1]
1650+
self._max_expected_height = data_array[-1, 1]
16511651

16521652
def process_noaaruc_sounding(self, file): # pylint: disable=too-many-statements
16531653
"""Import and process the upper air sounding data from `NOAA
@@ -1899,7 +1899,7 @@ def process_forecast_reanalysis(
18991899
self.__set_wind_speed_function(data_array[:, (1, 7)])
19001900

19011901
# Save maximum expected height
1902-
self.max_expected_height = max(height[0], height[-1])
1902+
self._max_expected_height = max(height[0], height[-1])
19031903

19041904
# Get elevation data from file
19051905
if dictionary["surface_geopotential_height"] is not None:
@@ -2244,7 +2244,7 @@ def select_ensemble_member(self, member=0):
22442244
self.__set_wind_speed_function(data_array[:, (1, 7)])
22452245

22462246
# Save other attributes
2247-
self.max_expected_height = max(height[0], height[-1])
2247+
self._max_expected_height = max(height[0], height[-1])
22482248
self.ensemble_member = member
22492249

22502250
# Update air density, speed of sound and dynamic viscosity

0 commit comments

Comments
 (0)