@@ -93,9 +93,9 @@ class Environment:
9393 Environment.topographic_profile_activated : bool
9494 True if the user already set a topographic profile. False otherwise.
9595 Environment.max_expected_height : float
96- Maximum altitude in meters to keep weather data.
97- Used especially for plotting range .
98- Can be altered as desired.
96+ Maximum altitude in meters to keep weather data. The altitude must be
97+ above sea level (ASL). Especially useful for controlling plottings .
98+ Can be altered as desired by doing `max_expected_height = number` .
9999 Environment.pressure_ISA : Function
100100 Air pressure in Pa as a function of altitude as defined by the
101101 `International Standard Atmosphere ISO 2533`. Only defined after load
@@ -270,6 +270,7 @@ def __init__(
270270 elevation = 0 ,
271271 datum = "SIRGAS2000" ,
272272 timezone = "UTC" ,
273+ max_expected_height = 80000.0 ,
273274 ):
274275 """Initialize Environment class, saving launch rail length,
275276 launch date, location coordinates and elevation. Note that
@@ -308,7 +309,12 @@ def __init__(
308309 timezone : string, optional
309310 Name of the time zone. To see all time zones, import pytz and run
310311 print(pytz.all_timezones). Default time zone is "UTC".
311-
312+ max_expected_height : float, optional
313+ Maximum altitude in meters to keep weather data. The altitude must
314+ be above sea level (ASL). Especially useful for visualization.
315+ Can be altered as desired by doing `max_expected_height = number`.
316+ Depending on the atmospheric model, this value may be automatically
317+ mofified.
312318
313319 Returns
314320 -------
@@ -319,15 +325,18 @@ def __init__(
319325 self .air_gas_constant = 287.05287 # in J/K/Kg
320326 self .standard_g = 9.80665
321327
328+ # Initialize launch site details
329+ self .elevation = elevation
330+ self .set_elevation (elevation )
331+ self ._max_expected_height = max_expected_height
332+
333+ # Initialize plots and prints objects
334+ self .prints = _EnvironmentPrints (self )
335+ self .plots = _EnvironmentPlots (self )
336+
322337 # Initialize atmosphere
323338 self .set_atmospheric_model ("standard_atmosphere" )
324339
325- # Save latitude and longitude
326- if latitude != None and longitude != None :
327- self .set_location (latitude , longitude )
328- else :
329- self .latitude , self .longitude = None , None
330-
331340 # Save date
332341 if date != None :
333342 self .set_date (date , timezone )
@@ -341,15 +350,6 @@ def __init__(
341350 self .datum = datum
342351 self .ellipsoid = self .set_earth_geometry (datum )
343352
344- # Set gravity model
345- self .gravity = self .set_gravity_model (gravity )
346-
347- # Initialize plots and prints objects
348- self .prints = _EnvironmentPrints (self )
349-
350- # Initialize atmosphere
351- self .set_atmospheric_model ("standard_atmosphere" )
352-
353353 # Save latitude and longitude
354354 self .latitude = latitude
355355 self .longitude = longitude
@@ -374,9 +374,8 @@ def __init__(
374374 self .initial_hemisphere = convert [4 ]
375375 self .initial_ew = convert [5 ]
376376
377- # Save elevation
378- self .elevation = elevation
379- self .set_elevation (elevation )
377+ # Set gravity model
378+ self .gravity = self .set_gravity_model (gravity )
380379
381380 # Recalculate Earth Radius (meters)
382381 self .earth_radius = self .calculate_earth_radius (
@@ -385,9 +384,6 @@ def __init__(
385384 flattening = self .ellipsoid .flattening ,
386385 )
387386
388- # Initialize plots and prints object
389- self .plots = _EnvironmentPlots (self )
390-
391387 return None
392388
393389 def set_date (self , date , timezone = "UTC" ):
@@ -485,6 +481,19 @@ def set_gravity_model(self, gravity):
485481 0 , self .max_expected_height , 100
486482 )
487483
484+ @property
485+ def max_expected_height (self ):
486+ return self ._max_expected_height
487+
488+ @max_expected_height .setter
489+ def max_expected_height (self , value ):
490+ if value < self .elevation :
491+ raise ValueError (
492+ "Max expected height cannot be lower than the surface elevation"
493+ )
494+ self ._max_expected_height = value
495+ self .plots .grid = np .linspace (self .elevation , self .max_expected_height )
496+
488497 @funcify_method ("height (m)" , "gravity (m/s²)" )
489498 def somigliana_gravity (self , height ):
490499 """Computes the gravity acceleration with the Somigliana formula.
0 commit comments