rocketpy 1.4.2__tar.gz → 1.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. {rocketpy-1.4.2/rocketpy.egg-info → rocketpy-1.5.0}/PKG-INFO +3 -1
  2. {rocketpy-1.4.2 → rocketpy-1.5.0}/pyproject.toml +3 -1
  3. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/__init__.py +2 -0
  4. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/control/controller.py +52 -2
  5. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/environment/environment.py +71 -80
  6. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/environment/tools.py +1 -1
  7. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/mathutils/function.py +171 -40
  8. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/mathutils/vector_matrix.py +119 -12
  9. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/motors/hybrid_motor.py +14 -19
  10. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/motors/liquid_motor.py +18 -18
  11. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/motors/motor.py +217 -49
  12. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/motors/solid_motor.py +19 -19
  13. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/motors/tank.py +1 -1
  14. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/motors/tank_geometry.py +6 -6
  15. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/plots/compare/compare_flights.py +5 -6
  16. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/plots/flight_plots.py +13 -12
  17. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/plots/rocket_plots.py +77 -25
  18. rocketpy-1.5.0/rocketpy/plots/sensitivity_plots.py +74 -0
  19. rocketpy-1.5.0/rocketpy/prints/sensitivity_prints.py +119 -0
  20. rocketpy-1.5.0/rocketpy/prints/sensors_prints.py +121 -0
  21. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/rocket/aero_surface/fins/elliptical_fins.py +5 -3
  22. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/rocket/aero_surface/fins/fins.py +5 -3
  23. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/rocket/aero_surface/fins/trapezoidal_fins.py +5 -3
  24. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/rocket/aero_surface/nose_cone.py +4 -4
  25. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/rocket/aero_surface/rail_buttons.py +8 -5
  26. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/rocket/aero_surface/tail.py +3 -4
  27. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/rocket/components.py +10 -3
  28. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/rocket/parachute.py +58 -48
  29. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/rocket/rocket.py +152 -94
  30. rocketpy-1.5.0/rocketpy/sensitivity/__init__.py +1 -0
  31. rocketpy-1.5.0/rocketpy/sensitivity/sensitivity_model.py +368 -0
  32. rocketpy-1.5.0/rocketpy/sensors/__init__.py +5 -0
  33. rocketpy-1.5.0/rocketpy/sensors/accelerometer.py +273 -0
  34. rocketpy-1.5.0/rocketpy/sensors/barometer.py +191 -0
  35. rocketpy-1.5.0/rocketpy/sensors/gnss_receiver.py +125 -0
  36. rocketpy-1.5.0/rocketpy/sensors/gyroscope.py +304 -0
  37. rocketpy-1.5.0/rocketpy/sensors/sensor.py +779 -0
  38. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/simulation/flight.py +168 -45
  39. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/tools.py +197 -11
  40. {rocketpy-1.4.2 → rocketpy-1.5.0/rocketpy.egg-info}/PKG-INFO +3 -1
  41. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy.egg-info/SOURCES.txt +11 -0
  42. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy.egg-info/requires.txt +2 -0
  43. {rocketpy-1.4.2 → rocketpy-1.5.0}/LICENSE +0 -0
  44. {rocketpy-1.4.2 → rocketpy-1.5.0}/README.md +0 -0
  45. {rocketpy-1.4.2 → rocketpy-1.5.0}/requirements.txt +0 -0
  46. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/_encoders.py +0 -0
  47. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/control/__init__.py +0 -0
  48. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/environment/__init__.py +0 -0
  49. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/environment/environment_analysis.py +0 -0
  50. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/environment/fetchers.py +0 -0
  51. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/environment/weather_model_mapping.py +0 -0
  52. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/mathutils/__init__.py +0 -0
  53. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/motors/__init__.py +0 -0
  54. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/motors/fluid.py +0 -0
  55. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/plots/__init__.py +0 -0
  56. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/plots/aero_surface_plots.py +0 -0
  57. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/plots/compare/__init__.py +0 -0
  58. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/plots/compare/compare.py +0 -0
  59. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/plots/environment_analysis_plots.py +0 -0
  60. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/plots/environment_plots.py +0 -0
  61. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/plots/fluid_plots.py +0 -0
  62. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/plots/hybrid_motor_plots.py +0 -0
  63. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/plots/liquid_motor_plots.py +0 -0
  64. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/plots/monte_carlo_plots.py +0 -0
  65. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/plots/motor_plots.py +0 -0
  66. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/plots/solid_motor_plots.py +0 -0
  67. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/plots/tank_geometry_plots.py +0 -0
  68. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/plots/tank_plots.py +0 -0
  69. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/prints/__init__.py +0 -0
  70. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/prints/aero_surface_prints.py +0 -0
  71. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/prints/compare_prints.py +0 -0
  72. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/prints/controller_prints.py +0 -0
  73. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/prints/environment_analysis_prints.py +0 -0
  74. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/prints/environment_prints.py +0 -0
  75. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/prints/flight_prints.py +0 -0
  76. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/prints/fluid_prints.py +0 -0
  77. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/prints/hybrid_motor_prints.py +0 -0
  78. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/prints/liquid_motor_prints.py +0 -0
  79. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/prints/monte_carlo_prints.py +0 -0
  80. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/prints/motor_prints.py +0 -0
  81. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/prints/parachute_prints.py +0 -0
  82. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/prints/rocket_prints.py +0 -0
  83. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/prints/solid_motor_prints.py +0 -0
  84. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/prints/tank_geometry_prints.py +0 -0
  85. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/prints/tank_prints.py +0 -0
  86. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/rocket/__init__.py +0 -0
  87. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/rocket/aero_surface/__init__.py +0 -0
  88. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/rocket/aero_surface/aero_surface.py +0 -0
  89. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/rocket/aero_surface/air_brakes.py +0 -0
  90. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/rocket/aero_surface/fins/__init__.py +0 -0
  91. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/simulation/__init__.py +0 -0
  92. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/simulation/flight_data_importer.py +0 -0
  93. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/simulation/monte_carlo.py +0 -0
  94. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/stochastic/__init__.py +0 -0
  95. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/stochastic/stochastic_aero_surfaces.py +0 -0
  96. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/stochastic/stochastic_environment.py +0 -0
  97. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/stochastic/stochastic_flight.py +0 -0
  98. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/stochastic/stochastic_generic_motor.py +0 -0
  99. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/stochastic/stochastic_model.py +0 -0
  100. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/stochastic/stochastic_motor_model.py +0 -0
  101. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/stochastic/stochastic_parachute.py +0 -0
  102. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/stochastic/stochastic_rocket.py +0 -0
  103. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/stochastic/stochastic_solid_motor.py +0 -0
  104. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/units.py +0 -0
  105. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy/utilities.py +0 -0
  106. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy.egg-info/dependency_links.txt +0 -0
  107. {rocketpy-1.4.2 → rocketpy-1.5.0}/rocketpy.egg-info/top_level.txt +0 -0
  108. {rocketpy-1.4.2 → rocketpy-1.5.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rocketpy
3
- Version: 1.4.2
3
+ Version: 1.5.0
4
4
  Summary: Advanced 6-DOF trajectory simulation for High-Power Rocketry.
5
5
  Author-email: Giovani Hidalgo Ceotto <ghceotto@gmail.com>
6
6
  Project-URL: homepage, https://rocketpy.org/
@@ -37,6 +37,8 @@ Requires-Dist: ipython; extra == "env-analysis"
37
37
  Requires-Dist: ipywidgets>=7.6.3; extra == "env-analysis"
38
38
  Provides-Extra: monte-carlo
39
39
  Requires-Dist: imageio; extra == "monte-carlo"
40
+ Requires-Dist: statsmodels; extra == "monte-carlo"
41
+ Requires-Dist: prettytable; extra == "monte-carlo"
40
42
  Provides-Extra: all
41
43
  Requires-Dist: rocketpy[env-analysis]; extra == "all"
42
44
  Requires-Dist: rocketpy[monte-carlo]; extra == "all"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "rocketpy"
3
- version = "1.4.2"
3
+ version = "1.5.0"
4
4
  description="Advanced 6-DOF trajectory simulation for High-Power Rocketry."
5
5
  dynamic = ["dependencies"]
6
6
  readme = "README.md"
@@ -52,6 +52,8 @@ env-analysis = [
52
52
 
53
53
  monte-carlo = [
54
54
  "imageio",
55
+ "statsmodels",
56
+ "prettytable",
55
57
  ]
56
58
 
57
59
  all = ["rocketpy[env-analysis]", "rocketpy[monte-carlo]"]
@@ -37,6 +37,8 @@ from .rocket import (
37
37
  Tail,
38
38
  TrapezoidalFins,
39
39
  )
40
+ from .sensitivity import SensitivityModel
41
+ from .sensors import Accelerometer, Barometer, GnssReceiver, Gyroscope
40
42
  from .simulation import Flight, MonteCarlo
41
43
  from .stochastic import (
42
44
  StochasticEllipticalFins,
@@ -1,3 +1,5 @@
1
+ from inspect import signature
2
+
1
3
  from ..prints.controller_prints import _ControllerPrints
2
4
 
3
5
 
@@ -52,6 +54,10 @@ class _Controller:
52
54
  the controller function can interact with. The objects are
53
55
  listed in the same order as they are provided in the
54
56
  `interactive_objects`.
57
+ 7. `sensors` (list): A list of sensors that are attached to the
58
+ rocket. The most recent measurements of the sensors are provided
59
+ with the ``sensor.measurement`` attribute. The sensors are
60
+ listed in the same order as they are added to the rocket
55
61
 
56
62
  This function will be called during the simulation at the specified
57
63
  sampling rate. The function should evaluate and change the interactive
@@ -78,7 +84,7 @@ class _Controller:
78
84
  None
79
85
  """
80
86
  self.interactive_objects = interactive_objects
81
- self.controller_function = controller_function
87
+ self.controller_function = self.__init_controller_function(controller_function)
82
88
  self.sampling_rate = sampling_rate
83
89
  self.name = name
84
90
  self.prints = _ControllerPrints(self)
@@ -88,7 +94,45 @@ class _Controller:
88
94
  else:
89
95
  self.observed_variables = []
90
96
 
91
- def __call__(self, time, state_vector, state_history):
97
+ def __init_controller_function(self, controller_function):
98
+ """Checks number of arguments of the controller function and initializes
99
+ it with the correct number of arguments. This is a workaround to allow
100
+ the controller function to receive sensors without breaking changes"""
101
+ sig = signature(controller_function)
102
+ if len(sig.parameters) == 6:
103
+
104
+ # pylint: disable=unused-argument
105
+ def new_controller_function(
106
+ time,
107
+ sampling_rate,
108
+ state_vector,
109
+ state_history,
110
+ observed_variables,
111
+ interactive_objects,
112
+ sensors,
113
+ ):
114
+ return controller_function(
115
+ time,
116
+ sampling_rate,
117
+ state_vector,
118
+ state_history,
119
+ observed_variables,
120
+ interactive_objects,
121
+ )
122
+
123
+ elif len(sig.parameters) == 7:
124
+ new_controller_function = controller_function
125
+ else:
126
+ raise ValueError(
127
+ "The controller function must have 6 or 7 arguments. "
128
+ "The arguments must be in the following order: "
129
+ "(time, sampling_rate, state_vector, state_history, "
130
+ "observed_variables, interactive_objects, sensors)."
131
+ "Sensors argument is optional."
132
+ )
133
+ return new_controller_function
134
+
135
+ def __call__(self, time, state_vector, state_history, sensors):
92
136
  """Call the controller function. This is used by the simulation class.
93
137
 
94
138
  Parameters
@@ -104,6 +148,11 @@ class _Controller:
104
148
  history is a list of every state vector of every step of the
105
149
  simulation. The state history is a list of lists, where each
106
150
  sublist is a state vector and is ordered from oldest to newest.
151
+ sensors : list
152
+ A list of sensors that are attached to the rocket. The most recent
153
+ measurements of the sensors are provided with the
154
+ ``sensor.measurement`` attribute. The sensors are listed in the same
155
+ order as they are added to the rocket.
107
156
 
108
157
  Returns
109
158
  -------
@@ -116,6 +165,7 @@ class _Controller:
116
165
  state_history,
117
166
  self.observed_variables,
118
167
  self.interactive_objects,
168
+ sensors,
119
169
  )
120
170
  if observed_variables is not None:
121
171
  self.observed_variables.append(observed_variables)
@@ -59,15 +59,17 @@ class Environment:
59
59
  Value of Earth's Radius as 6.3781e6 m.
60
60
  Environment.air_gas_constant : float
61
61
  Value of Air's Gas Constant as 287.05287 J/K/Kg
62
- Environment.gravity : float
63
- Positive value of gravitational acceleration in m/s^2.
62
+ Environment.gravity : Function
63
+ Gravitational acceleration. Positive values point the
64
+ acceleration down. See :meth:`Environment.set_gravity_model` for more
65
+ information.
64
66
  Environment.latitude : float
65
67
  Launch site latitude.
66
68
  Environment.longitude : float
67
69
  Launch site longitude.
68
70
  Environment.datum : string
69
71
  The desired reference ellipsoid model, the following options are
70
- available: "SAD69", "WGS84", "NAD83", and "SIRGAS2000".
72
+ available: ``SAD69``, ``WGS84``, ``NAD83``, and ``SIRGAS2000``.
71
73
  Environment.initial_east : float
72
74
  Launch site East UTM coordinate
73
75
  Environment.initial_north : float
@@ -78,16 +80,16 @@ class Environment:
78
80
  Launch site UTM letter, to keep the latitude band and describe the
79
81
  UTM Zone
80
82
  Environment.initial_hemisphere : string
81
- Launch site S/N hemisphere
83
+ Launch site South/North hemisphere
82
84
  Environment.initial_ew : string
83
- Launch site E/W hemisphere
85
+ Launch site East/West hemisphere
84
86
  Environment.elevation : float
85
87
  Launch site elevation.
86
88
  Environment.datetime_date : datetime
87
- Date time of launch in UTC.
89
+ Date time of launch in UTC time zone using the ``datetime`` object.
88
90
  Environment.local_date : datetime
89
- Date time of launch in the local time zone, defined by
90
- ``Environment.timezone``.
91
+ Date time of launch in the local time zone, defined by the
92
+ ``Environment.timezone`` parameter.
91
93
  Environment.timezone : string
92
94
  Local time zone specification. See `pytz`_. for time zone information.
93
95
 
@@ -103,63 +105,40 @@ class Environment:
103
105
  True if the user already set a topographic profile. False otherwise.
104
106
  Environment.max_expected_height : float
105
107
  Maximum altitude in meters to keep weather data. The altitude must be
106
- above sea level (ASL). Especially useful for controlling plots.
107
- Can be altered as desired by doing `max_expected_height = number`.
108
+ Above Sea Level (ASL). Especially useful for controlling plots.
109
+ Can be altered as desired by running ``max_expected_height = number``.
108
110
  Environment.pressure_ISA : Function
109
111
  Air pressure in Pa as a function of altitude as defined by the
110
- `International Standard Atmosphere ISO 2533`. Only defined after load
111
- ``Environment.load_international_standard_atmosphere`` has been called.
112
- Can be accessed as regular array, or called as a Function. See Function
113
- for more information.
112
+ International Standard Atmosphere ISO 2533.
114
113
  Environment.temperature_ISA : Function
115
114
  Air temperature in K as a function of altitude as defined by the
116
- `International Standard Atmosphere ISO 2533`. Only defined after load
117
- ``Environment.load_international_standard_atmosphere`` has been called.
118
- Can be accessed as regular array, or called as a Function. See Function
119
- for more information.
115
+ International Standard Atmosphere ISO 2533
120
116
  Environment.pressure : Function
121
- Air pressure in Pa as a function of altitude. Can be accessed as regular
122
- array, or called as a Function. See Function for more information.
117
+ Air pressure in Pa as a function of altitude.
123
118
  Environment.barometric_height : Function
124
- Geometric height above sea level in m as a function of pressure. Can be
125
- accessed as regular array, or called as a Function. See Function for
126
- more information.
119
+ Geometric height above sea level in m as a function of pressure.
127
120
  Environment.temperature : Function
128
- Air temperature in K as a function of altitude. Can be accessed as
129
- regular array, or called as a Function. See Function for more
130
- information.
121
+ Air temperature in K as a function of altitude.
131
122
  Environment.speed_of_sound : Function
132
- Speed of sound in air in m/s as a function of altitude. Can be accessed
133
- as regular array, or called as a Function. See Function for more
134
- information.
123
+ Speed of sound in air in m/s as a function of altitude.
135
124
  Environment.density : Function
136
- Air density in kg/m³ as a function of altitude. Can be accessed as
137
- regular array, or called as a Function. See Function for more
138
- information.
125
+ Air density in kg/m³ as a function of altitude.
139
126
  Environment.dynamic_viscosity : Function
140
- Air dynamic viscosity in Pa*s as a function of altitude. Can be accessed
141
- as regular array, or called as a Function. See Function for more
142
- information.
127
+ Air dynamic viscosity in Pa*s as a function of altitude.
143
128
  Environment.wind_speed : Function
144
- Wind speed in m/s as a function of altitude. Can be accessed as regular
145
- array, or called as a Function. See Function for more information.
129
+ Wind speed in m/s as a function of altitude.
146
130
  Environment.wind_direction : Function
147
131
  Wind direction (from which the wind blows) in degrees relative to north
148
- (positive clockwise) as a function of altitude. Can be accessed as an
149
- array, or called as a Function. See Function for more information.
132
+ (positive clockwise) as a function of altitude.
150
133
  Environment.wind_heading : Function
151
134
  Wind heading (direction towards which the wind blows) in degrees
152
135
  relative to north (positive clockwise) as a function of altitude.
153
- Can be accessed as an array, or called as a Function.
154
- See Function for more information.
155
136
  Environment.wind_velocity_x : Function
156
137
  Wind U, or X (east) component of wind velocity in m/s as a function of
157
- altitude. Can be accessed as an array, or called as a Function. See
158
- Function for more information.
138
+ altitude.
159
139
  Environment.wind_velocity_y : Function
160
140
  Wind V, or Y (north) component of wind velocity in m/s as a function of
161
- altitude. Can be accessed as an array, or called as a Function. See
162
- Function for more information.
141
+ altitude.
163
142
  Environment.atmospheric_model_type : string
164
143
  Describes the atmospheric model which is being used. Can only assume the
165
144
  following values: ``standard_atmosphere``, ``custom_atmosphere``,
@@ -272,6 +251,12 @@ class Environment:
272
251
  Number of ensemble members. Only defined when using Ensembles.
273
252
  Environment.ensemble_member : int
274
253
  Current selected ensemble member. Only defined when using Ensembles.
254
+
255
+ Notes
256
+ -----
257
+ All the attributes listed as Function objects can be accessed as
258
+ regular arrays, or called as a Function. See :class:`rocketpy.Function`
259
+ for more information.
275
260
  """
276
261
 
277
262
  def __init__(
@@ -333,7 +318,7 @@ class Environment:
333
318
  elevation : float, optional
334
319
  Elevation of launch site measured as height above sea
335
320
  level in meters. Alternatively, can be set as
336
- 'Open-Elevation' which uses the Open-Elevation API to
321
+ ``Open-Elevation`` which uses the Open-Elevation API to
337
322
  find elevation data. For this option, latitude and
338
323
  longitude must also be specified. Default value is 0.
339
324
  datum : string, optional
@@ -345,8 +330,8 @@ class Environment:
345
330
  ``print(pytz.all_timezones)``. Default time zone is "UTC".
346
331
  max_expected_height : float, optional
347
332
  Maximum altitude in meters to keep weather data. The altitude must
348
- be above sea level (ASL). Especially useful for visualization.
349
- Can be altered as desired by doing `max_expected_height = number`.
333
+ be above sea level (ASL). Especially useful for visualization. Can
334
+ be altered as desired by running ``max_expected_height = number``.
350
335
  Depending on the atmospheric model, this value may be automatically
351
336
  modified.
352
337
 
@@ -382,12 +367,12 @@ class Environment:
382
367
  self.standard_g = 9.80665
383
368
  self.__weather_model_map = WeatherModelMapping()
384
369
  self.__atm_type_file_to_function_map = {
385
- ("Forecast", "GFS"): fetch_gfs_file_return_dataset,
386
- ("Forecast", "NAM"): fetch_nam_file_return_dataset,
387
- ("Forecast", "RAP"): fetch_rap_file_return_dataset,
388
- ("Forecast", "HIRESW"): fetch_hiresw_file_return_dataset,
389
- ("Ensemble", "GEFS"): fetch_gefs_ensemble,
390
- # ("Ensemble", "CMC"): fetch_cmc_ensemble,
370
+ ("forecast", "GFS"): fetch_gfs_file_return_dataset,
371
+ ("forecast", "NAM"): fetch_nam_file_return_dataset,
372
+ ("forecast", "RAP"): fetch_rap_file_return_dataset,
373
+ ("forecast", "HIRESW"): fetch_hiresw_file_return_dataset,
374
+ ("ensemble", "GEFS"): fetch_gefs_ensemble,
375
+ # ("ensemble", "CMC"): fetch_cmc_ensemble,
391
376
  }
392
377
  self.__standard_atmosphere_layers = {
393
378
  "geopotential_height": [ # in geopotential m
@@ -635,9 +620,8 @@ class Environment:
635
620
  date : list, tuple, datetime
636
621
  List or tuple of length 4, stating (year, month, day, hour) in the
637
622
  time zone of the parameter ``timezone``. See Notes for more
638
- information.
639
- Alternatively, can be a ``datetime`` object specifying launch
640
- date and time.
623
+ information. Alternatively, can be a ``datetime`` object specifying
624
+ launch date and time.
641
625
  timezone : string, optional
642
626
  Name of the time zone. To see all time zones, import pytz and run
643
627
  ``print(pytz.all_timezones)``. Default time zone is "UTC".
@@ -879,13 +863,13 @@ class Environment:
879
863
  ----------
880
864
  elevation : float, string, optional
881
865
  Elevation of launch site measured as height above sea level in
882
- meters. Alternatively, can be set as 'Open-Elevation' which uses
866
+ meters. Alternatively, can be set as ``Open-Elevation`` which uses
883
867
  the Open-Elevation API to find elevation data. For this option,
884
868
  latitude and longitude must have already been specified.
885
869
 
886
870
  See Also
887
871
  --------
888
- Environment.set_location
872
+ :meth:`rocketpy.Environment.set_location`
889
873
 
890
874
  Returns
891
875
  -------
@@ -896,7 +880,7 @@ class Environment:
896
880
  self.elevation = elevation
897
881
  else:
898
882
  self.elevation = fetch_open_elevation(self.latitude, self.longitude)
899
- print("Elevation received: ", self.elevation)
883
+ print(f"Elevation received: {self.elevation} m")
900
884
 
901
885
  def set_topographic_profile( # pylint: disable=redefined-builtin, unused-argument
902
886
  self, type, file, dictionary="netCDF4", crs=None
@@ -928,11 +912,11 @@ class Environment:
928
912
 
929
913
  if type == "NASADEM_HGT":
930
914
  if dictionary == "netCDF4":
931
- rootgrp = netCDF4.Dataset(file, "r", format="NETCDF4")
932
- self.elev_lon_array = rootgrp.variables["lon"][:].tolist()
933
- self.elev_lat_array = rootgrp.variables["lat"][:].tolist()
934
- self.elev_array = rootgrp.variables["NASADEM_HGT"][:].tolist()
935
- # crsArray = rootgrp.variables['crs'][:].tolist().
915
+ nasa_dem = netCDF4.Dataset(file, "r", format="NETCDF4")
916
+ self.elev_lon_array = nasa_dem.variables["lon"][:].tolist()
917
+ self.elev_lat_array = nasa_dem.variables["lat"][:].tolist()
918
+ self.elev_array = nasa_dem.variables["NASADEM_HGT"][:].tolist()
919
+ # crsArray = nasa_dem.variables['crs'][:].tolist().
936
920
  self.topographic_profile_activated = True
937
921
 
938
922
  print("Region covered by the Topographical file: ")
@@ -1150,7 +1134,7 @@ class Environment:
1150
1134
  .. seealso::
1151
1135
 
1152
1136
  To activate other ensemble forecasts see
1153
- ``Environment.select_ensemble_member``.
1137
+ :meth:`rocketpy.Environment.select_ensemble_member`.
1154
1138
 
1155
1139
  - ``custom_atmosphere``: sets pressure, temperature, wind-u and
1156
1140
  wind-v profiles given though the pressure, temperature, wind-u and
@@ -1288,33 +1272,34 @@ class Environment:
1288
1272
  """
1289
1273
  # Save atmospheric model type
1290
1274
  self.atmospheric_model_type = type
1275
+ type = type.lower()
1291
1276
 
1292
1277
  # Handle each case # TODO: use match case when python 3.9 is no longer supported
1293
1278
  if type == "standard_atmosphere":
1294
1279
  self.process_standard_atmosphere()
1295
1280
  elif type == "wyoming_sounding":
1296
1281
  self.process_wyoming_sounding(file)
1297
- elif type == "NOAARucSounding":
1282
+ elif type == "noaarucsounding":
1298
1283
  self.process_noaaruc_sounding(file)
1299
1284
  elif type == "custom_atmosphere":
1300
1285
  self.process_custom_atmosphere(pressure, temperature, wind_u, wind_v)
1301
- elif type == "Windy":
1286
+ elif type == "windy":
1302
1287
  self.process_windy_atmosphere(file)
1303
- elif type in ["Forecast", "Reanalysis", "Ensemble"]:
1288
+ elif type in ["forecast", "reanalysis", "ensemble"]:
1304
1289
  dictionary = self.__validate_dictionary(file, dictionary)
1305
1290
  fetch_function = self.__atm_type_file_to_function_map.get((type, file))
1306
1291
 
1307
1292
  # Fetches the dataset using OpenDAP protocol or uses the file path
1308
1293
  dataset = fetch_function() if fetch_function is not None else file
1309
1294
 
1310
- if type in ["Forecast", "Reanalysis"]:
1295
+ if type in ["forecast", "reanalysis"]:
1311
1296
  self.process_forecast_reanalysis(dataset, dictionary)
1312
1297
  else:
1313
1298
  self.process_ensemble(dataset, dictionary)
1314
1299
  else:
1315
1300
  raise ValueError(f"Unknown model type '{type}'.") # pragma: no cover
1316
1301
 
1317
- if type not in ["Ensemble"]:
1302
+ if type not in ["ensemble"]:
1318
1303
  # Ensemble already computed these values
1319
1304
  self.calculate_density_profile()
1320
1305
  self.calculate_speed_of_sound_profile()
@@ -1619,7 +1604,9 @@ class Environment:
1619
1604
 
1620
1605
  http://weather.uwyo.edu/cgi-bin/sounding?region=samer&TYPE=TEXT%3ALIST&YEAR=2019&MONTH=02&FROM=0200&TO=0200&STNM=82599
1621
1606
 
1622
- More can be found at: http://weather.uwyo.edu/upperair/sounding.html.
1607
+ Notes
1608
+ -----
1609
+ More can be found at: http://weather.uwyo.edu/upperair/sounding.html.
1623
1610
 
1624
1611
  Returns
1625
1612
  -------
@@ -1699,7 +1686,10 @@ class Environment:
1699
1686
 
1700
1687
  https://rucsoundings.noaa.gov/get_raobs.cgi?data_source=RAOB&latest=latest&start_year=2019&start_month_name=Feb&start_mday=5&start_hour=12&start_min=0&n_hrs=1.0&fcst_len=shortest&airport=83779&text=Ascii%20text%20%28GSD%20format%29&hydrometeors=false&start=latest
1701
1688
 
1702
- More can be found at: https://rucsoundings.noaa.gov/.
1689
+
1690
+ See also
1691
+ --------
1692
+ More details can be found at: https://rucsoundings.noaa.gov/.
1703
1693
 
1704
1694
  Returns
1705
1695
  -------
@@ -2073,7 +2063,7 @@ class Environment:
2073
2063
  rectangular grid sorted in either ascending or descending order of
2074
2064
  latitude and longitude. By default the first ensemble forecast is
2075
2065
  activated. To activate other ensemble forecasts see
2076
- ``Environment.select_ensemble_member()``.
2066
+ :meth:`Environment.select_ensemble_member()`.
2077
2067
 
2078
2068
  Parameters
2079
2069
  ----------
@@ -2106,9 +2096,9 @@ class Environment:
2106
2096
  "v_wind": "vgrdprs",
2107
2097
  }
2108
2098
 
2109
- Notes
2110
- -----
2111
- See the ``rocketpy.environment.weather_model_mapping`` for some
2099
+ See also
2100
+ --------
2101
+ See the :class:``rocketpy.environment.weather_model_mapping`` for some
2112
2102
  dictionary examples.
2113
2103
  """
2114
2104
  # Check if date, lat and lon are known
@@ -2380,8 +2370,9 @@ class Environment:
2380
2370
  Notes
2381
2371
  -----
2382
2372
  This method is **deprecated** and will be removed in version 1.6.0. You
2383
- can access `Environment.pressure_ISA` and `Environment.temperature_ISA`
2384
- directly without the need to call this method.
2373
+ can access :meth:`rocketpy.Environment.pressure_ISA` and
2374
+ :meth:`rocketpy.Environment.temperature_ISA` directly without the need
2375
+ to call this method.
2385
2376
  """
2386
2377
  warnings.warn(
2387
2378
  "load_international_standard_atmosphere() is deprecated in version "
@@ -2391,7 +2382,7 @@ class Environment:
2391
2382
  DeprecationWarning,
2392
2383
  )
2393
2384
 
2394
- @funcify_method("Height Above Sea Level (m)", "Pressure (Pa)", "spline", "linear")
2385
+ @funcify_method("Height Above Sea Level (m)", "Pressure (Pa)", "spline", "natural")
2395
2386
  def pressure_ISA(self):
2396
2387
  """Pressure, in Pa, as a function of height above sea level as defined
2397
2388
  by the `International Standard Atmosphere ISO 2533`."""
@@ -532,7 +532,7 @@ def utm_to_geodesic( # pylint: disable=too-many-locals,too-many-statements
532
532
  x, y, utm_zone, hemis, semi_major_axis=6378137.0, flattening=1 / 298.257223563
533
533
  ):
534
534
  # NOTE: already documented in the Environment class.
535
- # TODO: deprecated the static method from the environment class, use only this one.
535
+ # TODO: deprecate the static method from the environment class, use only this one.
536
536
 
537
537
  if hemis == "N":
538
538
  y = y + 10000000