Skip to content

Commit 2ea50fb

Browse files
committed
Merge remote-tracking branch 'origin/develop' into enh/add-coriolis-force
2 parents 5ca314d + 780f724 commit 2ea50fb

16 files changed

Lines changed: 42 additions & 301 deletions

File tree

.github/workflows/test_pytest.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,11 @@ jobs:
2929
uses: actions/setup-python@main
3030
with:
3131
python-version: ${{ matrix.python-version }}
32-
33-
- name: Cache Python dependencies
34-
uses: actions/cache@main
35-
with:
36-
path: ~/.cache/pip
37-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-tests.txt') }}
38-
restore-keys: |
39-
${{ runner.os }}-pip-
32+
cache: 'pip'
33+
cache-dependency-path: |
34+
requirements.txt
35+
requirements-tests.txt
36+
requirements-optional.txt
4037
4138
- name: Install rocketpy
4239
run: pip install .

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ Attention: The newest changes should be on top -->
3535

3636
### Changed
3737

38+
- ENH: _MotorPrints inheritance - issue #460 [#828](https://github.com/RocketPy-Team/RocketPy/pull/828)
39+
40+
- MNT: fix deprecations and warnings [#829](https://github.com/RocketPy-Team/RocketPy/pull/829)
3841

3942
### Fixed
4043

@@ -44,7 +47,7 @@ Attention: The newest changes should be on top -->
4447
### Added
4548
- ENH: Support for ND arithmetic in Function class. [#810] (https://github.com/RocketPy-Team/RocketPy/pull/810)
4649
- ENH: allow users to provide custom samplers [#803](https://github.com/RocketPy-Team/RocketPy/pull/803)
47-
- ENH: Implement Multivariate Rejection Sampling (MRS) [#738] (https://github.com/RocketPy-Team/RocketPy/pull/738)
50+
- ENH: Implement Multivariate Rejection Sampling (MRS) [#738] (https://github.com/RocketPy-Team/RocketPy/pull/738)
4851
- ENH: Create a rocketpy file to store flight simulations [#800](https://github.com/RocketPy-Team/RocketPy/pull/800)
4952
- ENH: Support for the RSE file format has been added to the library [#798](https://github.com/RocketPy-Team/RocketPy/pull/798)
5053
- ENH: Introduce Net Thrust with pressure corrections [#789](https://github.com/RocketPy-Team/RocketPy/pull/789)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
numpy>=1.13
22
scipy>=1.0
3-
matplotlib>=3.0
3+
matplotlib>=3.9.0 # Released May 15th 2024
44
netCDF4>=1.6.4
55
requests
66
pytz

rocketpy/environment/environment.py

Lines changed: 3 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,14 @@
2727
find_latitude_index,
2828
find_longitude_index,
2929
find_time_index,
30+
geodesic_to_utm,
3031
get_elevation_data_from_dataset,
3132
get_final_date_from_time_array,
3233
get_initial_date_from_time_array,
3334
get_interval_date_from_time_array,
3435
get_pressure_levels_from_file,
3536
mask_and_clean_dataset,
3637
)
37-
from rocketpy.environment.tools import geodesic_to_utm as geodesic_to_utm_tools
38-
from rocketpy.environment.tools import utm_to_geodesic as utm_to_geodesic_tools
3938
from rocketpy.environment.weather_model_mapping import WeatherModelMapping
4039
from rocketpy.mathutils.function import NUMERICAL_TYPES, Function, funcify_method
4140
from rocketpy.plots.environment_plots import _EnvironmentPlots
@@ -454,7 +453,7 @@ def __initialize_utm_coordinates(self):
454453
self.initial_utm_letter,
455454
self.initial_hemisphere,
456455
self.initial_ew,
457-
) = self.geodesic_to_utm(
456+
) = geodesic_to_utm(
458457
lat=self.latitude,
459458
lon=self.longitude,
460459
flattening=self.ellipsoid.flattening,
@@ -2543,98 +2542,7 @@ def set_earth_geometry(self, datum):
25432542
f"the following recognized datum: {available_datums}"
25442543
) from e
25452544

2546-
# Auxiliary functions - Geodesic Coordinates
2547-
2548-
@staticmethod
2549-
def geodesic_to_utm(
2550-
lat, lon, semi_major_axis=6378137.0, flattening=1 / 298.257223563
2551-
):
2552-
"""Function which converts geodetic coordinates, i.e. lat/lon, to UTM
2553-
projection coordinates. Can be used only for latitudes between -80.00°
2554-
and 84.00°
2555-
2556-
Parameters
2557-
----------
2558-
lat : float
2559-
The latitude coordinates of the point of analysis, must be contained
2560-
between -80.00° and 84.00°
2561-
lon : float
2562-
The longitude coordinates of the point of analysis, must be
2563-
contained between -180.00° and 180.00°
2564-
semi_major_axis : float
2565-
The semi-major axis of the ellipsoid used to represent the Earth,
2566-
must be given in meters (default is 6,378,137.0 m, which corresponds
2567-
to the WGS84 ellipsoid)
2568-
flattening : float
2569-
The flattening of the ellipsoid used to represent the Earth, usually
2570-
between 1/250 and 1/150 (default is 1/298.257223563, which
2571-
corresponds to the WGS84 ellipsoid)
2572-
2573-
Returns
2574-
-------
2575-
x : float
2576-
East coordinate, always positive
2577-
y : float
2578-
North coordinate, always positive
2579-
utm_zone : int
2580-
The number of the UTM zone of the point of analysis, can vary
2581-
between 1 and 60
2582-
utm_letter : string
2583-
The letter of the UTM zone of the point of analysis, can vary
2584-
between C and X, omitting the letters "I" and "O"
2585-
hemis : string
2586-
Returns "S" for southern hemisphere and "N" for Northern hemisphere
2587-
EW : string
2588-
Returns "W" for western hemisphere and "E" for eastern hemisphere
2589-
"""
2590-
warnings.warn(
2591-
"This function is deprecated and will be removed in v1.10.0. "
2592-
"Please use the new method `tools.geodesic_to_utm` instead.",
2593-
DeprecationWarning,
2594-
)
2595-
return geodesic_to_utm_tools(lat, lon, semi_major_axis, flattening)
2596-
2597-
@staticmethod
2598-
def utm_to_geodesic(
2599-
x, y, utm_zone, hemis, semi_major_axis=6378137.0, flattening=1 / 298.257223563
2600-
):
2601-
"""Function to convert UTM coordinates to geodesic coordinates
2602-
(i.e. latitude and longitude).
2603-
2604-
Parameters
2605-
----------
2606-
x : float
2607-
East UTM coordinate in meters
2608-
y : float
2609-
North UTM coordinate in meters
2610-
utm_zone : int
2611-
The number of the UTM zone of the point of analysis, can vary
2612-
between 1 and 60
2613-
hemis : string
2614-
Equals to "S" for southern hemisphere and "N" for Northern
2615-
hemisphere
2616-
semi_major_axis : float
2617-
The semi-major axis of the ellipsoid used to represent the Earth,
2618-
must be given in meters (default is 6,378,137.0 m, which corresponds
2619-
to the WGS84 ellipsoid)
2620-
flattening : float
2621-
The flattening of the ellipsoid used to represent the Earth, usually
2622-
between 1/250 and 1/150 (default is 1/298.257223563, which
2623-
corresponds to the WGS84 ellipsoid)
2624-
2625-
Returns
2626-
-------
2627-
lat : float
2628-
latitude of the analyzed point
2629-
lon : float
2630-
latitude of the analyzed point
2631-
"""
2632-
warnings.warn(
2633-
"This function is deprecated and will be removed in v1.10.0. "
2634-
"Please use the new method `tools.utm_to_geodesic` instead.",
2635-
DeprecationWarning,
2636-
)
2637-
return utm_to_geodesic_tools(x, y, utm_zone, hemis, semi_major_axis, flattening)
2545+
# Auxiliary functions
26382546

26392547
@staticmethod
26402548
def calculate_earth_radius(

rocketpy/mathutils/function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
from bisect import bisect_left
1111
from collections.abc import Iterable
1212
from copy import deepcopy
13+
from enum import Enum
1314
from functools import cached_property
1415
from inspect import signature
1516
from pathlib import Path
16-
from enum import Enum
1717

1818
import matplotlib.pyplot as plt
1919
import numpy as np

rocketpy/motors/motor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,7 @@ def vacuum_thrust(self):
11511151
Returns
11521152
-------
11531153
vacuum_thrust : Function
1154-
The rocket's thrust in a vaccum.
1154+
The rocket's thrust in a vacuum.
11551155
"""
11561156
if self.reference_pressure is None:
11571157
warnings.warn(

rocketpy/plots/monte_carlo_plots.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ def all(self, keys=None):
183183
ax2 = fig.add_subplot(gs[1])
184184

185185
# Plot boxplot
186+
# TODO: changes vert to orientation="horizontal" when support for Py3.9 ends
186187
ax1.boxplot(self.monte_carlo.results[key], vert=False)
187188
ax1.set_title(f"Box Plot of {key}")
188189
ax1.set_yticks([])

rocketpy/prints/hybrid_motor_prints.py

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import numpy as np
22

3+
from .motor_prints import _MotorPrints
34

4-
class _HybridMotorPrints:
5+
6+
class _HybridMotorPrints(_MotorPrints):
57
"""Class that holds prints methods for HybridMotor class.
68
79
Attributes
@@ -26,6 +28,7 @@ def __init__(
2628
-------
2729
None
2830
"""
31+
super().__init__(hybrid_motor)
2932
self.hybrid_motor = hybrid_motor
3033

3134
def nozzle_details(self):
@@ -63,28 +66,6 @@ def grain_details(self):
6366
print(f"Grain Volume: {self.hybrid_motor.solid.grain_initial_volume:.3f} m3")
6467
print(f"Grain Mass: {self.hybrid_motor.solid.grain_initial_mass:.3f} kg\n")
6568

66-
def motor_details(self):
67-
"""Prints out all data available about the HybridMotor.
68-
69-
Returns
70-
-------
71-
None
72-
"""
73-
print("Motor Details")
74-
print(f"Total Burning Time: {self.hybrid_motor.burn_duration} s")
75-
print(
76-
f"Total Propellant Mass: {self.hybrid_motor.propellant_initial_mass:.3f} kg"
77-
)
78-
print(f"Structural Mass Ratio: {self.hybrid_motor.structural_mass_ratio:.3f}")
79-
avg = self.hybrid_motor.exhaust_velocity.average(*self.hybrid_motor.burn_time)
80-
print(f"Average Propellant Exhaust Velocity: {avg:.3f} m/s")
81-
print(f"Average Thrust: {self.hybrid_motor.average_thrust:.3f} N")
82-
print(
83-
f"Maximum Thrust: {self.hybrid_motor.max_thrust} N at "
84-
f"{self.hybrid_motor.max_thrust_time} s after ignition."
85-
)
86-
print(f"Total Impulse: {self.hybrid_motor.total_impulse:.3f} Ns\n")
87-
8869
def all(self):
8970
"""Prints out all data available about the HybridMotor.
9071

rocketpy/prints/liquid_motor_prints.py

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
class _LiquidMotorPrints:
1+
from .motor_prints import _MotorPrints
2+
3+
4+
class _LiquidMotorPrints(_MotorPrints):
25
"""Class that holds prints methods for LiquidMotor class.
36
47
Attributes
@@ -23,6 +26,7 @@ def __init__(
2326
-------
2427
None
2528
"""
29+
super().__init__(liquid_motor)
2630
self.liquid_motor = liquid_motor
2731

2832
def nozzle_details(self):
@@ -35,28 +39,6 @@ def nozzle_details(self):
3539
print("Nozzle Details")
3640
print("Nozzle Radius: " + str(self.liquid_motor.nozzle_radius) + " m\n")
3741

38-
def motor_details(self):
39-
"""Prints out all data available about the motor.
40-
41-
Returns
42-
-------
43-
None
44-
"""
45-
print("Motor Details")
46-
print(f"Total Burning Time: {self.liquid_motor.burn_duration} s")
47-
print(
48-
f"Total Propellant Mass: {self.liquid_motor.propellant_initial_mass:.3f} kg"
49-
)
50-
print(f"Structural Mass Ratio: {self.liquid_motor.structural_mass_ratio:.3f}")
51-
avg = self.liquid_motor.exhaust_velocity.average(*self.liquid_motor.burn_time)
52-
print(f"Average Propellant Exhaust Velocity: {avg:.3f} m/s")
53-
print(f"Average Thrust: {self.liquid_motor.average_thrust:.3f} N")
54-
print(
55-
f"Maximum Thrust: {self.liquid_motor.max_thrust} N at "
56-
f"{self.liquid_motor.max_thrust_time} s after ignition."
57-
)
58-
print(f"Total Impulse: {self.liquid_motor.total_impulse:.3f} Ns\n")
59-
6042
def all(self):
6143
"""Prints out all data available about the LiquidMotor.
6244

rocketpy/prints/solid_motor_prints.py

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
class _SolidMotorPrints:
1+
from .motor_prints import _MotorPrints
2+
3+
4+
class _SolidMotorPrints(_MotorPrints):
25
"""Class that holds prints methods for SolidMotor class.
36
47
Attributes
@@ -23,6 +26,7 @@ def __init__(
2326
-------
2427
None
2528
"""
29+
super().__init__(solid_motor)
2630
self.solid_motor = solid_motor
2731

2832
def nozzle_details(self):
@@ -53,28 +57,6 @@ def grain_details(self):
5357
print(f"Grain Volume: {self.solid_motor.grain_initial_volume:.3f} m3")
5458
print(f"Grain Mass: {self.solid_motor.grain_initial_mass:.3f} kg\n")
5559

56-
def motor_details(self):
57-
"""Prints out all data available about the SolidMotor.
58-
59-
Returns
60-
-------
61-
None
62-
"""
63-
print("Motor Details")
64-
print("Total Burning Time: " + str(self.solid_motor.burn_duration) + " s")
65-
print(
66-
f"Total Propellant Mass: {self.solid_motor.propellant_initial_mass:.3f} kg"
67-
)
68-
print(f"Structural Mass Ratio: {self.solid_motor.structural_mass_ratio:.3f}")
69-
average = self.solid_motor.exhaust_velocity.average(*self.solid_motor.burn_time)
70-
print(f"Average Propellant Exhaust Velocity: {average:.3f} m/s")
71-
print(f"Average Thrust: {self.solid_motor.average_thrust:.3f} N")
72-
print(
73-
f"Maximum Thrust: {self.solid_motor.max_thrust} N "
74-
f"at {self.solid_motor.max_thrust_time} s after ignition."
75-
)
76-
print(f"Total Impulse: {self.solid_motor.total_impulse:.3f} Ns\n")
77-
7860
def all(self):
7961
"""Prints out all data available about the SolidMotor.
8062

0 commit comments

Comments
 (0)