Skip to content

Commit 465f526

Browse files
authored
Merge branch 'develop' into enh/improve-parachute-geometric-parametrization
2 parents 7defc38 + 71e2b3a commit 465f526

25 files changed

+1106
-662
lines changed

.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: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,27 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3131
Attention: The newest changes should be on top -->
3232

3333
### Added
34+
35+
- ENH: Add the Coriolis Force to the Flight class [#799](https://github.com/RocketPy-Team/RocketPy/pull/799)
36+
37+
### Changed
38+
39+
- ENH: _MotorPrints inheritance - issue #460 [#828](https://github.com/RocketPy-Team/RocketPy/pull/828)
40+
- MNT: fix deprecations and warnings [#829](https://github.com/RocketPy-Team/RocketPy/pull/829)
41+
42+
### Fixed
43+
44+
45+
## [v1.10.0] - 2025-05-16
46+
47+
### Added
48+
- ENH: Support for ND arithmetic in Function class. [#810] (https://github.com/RocketPy-Team/RocketPy/pull/810)
3449
- ENH: allow users to provide custom samplers [#803](https://github.com/RocketPy-Team/RocketPy/pull/803)
35-
- 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)
3651
- ENH: Create a rocketpy file to store flight simulations [#800](https://github.com/RocketPy-Team/RocketPy/pull/800)
3752
- ENH: Support for the RSE file format has been added to the library [#798](https://github.com/RocketPy-Team/RocketPy/pull/798)
3853
- ENH: Introduce Net Thrust with pressure corrections [#789](https://github.com/RocketPy-Team/RocketPy/pull/789)
54+
- ENH: Environment object from EnvironmentAnalysis [#813](https://github.com/RocketPy-Team/RocketPy/pull/813)
3955

4056
### Changed
4157

@@ -48,7 +64,7 @@ Attention: The newest changes should be on top -->
4864
- BUG: Wrong Phi Initialization For nose_to_tail Rockets [#809](https://github.com/RocketPy-Team/RocketPy/pull/809)
4965
- BUG: Fix StochasticFlight time_overshoot None bug [#805](https://github.com/RocketPy-Team/RocketPy/pull/805)
5066

51-
## v1.9.0 - 2025-03-24
67+
## [v1.9.0] - 2025-03-24
5268

5369
### Added
5470

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
author = "RocketPy Team"
2828

2929
# The full version, including alpha/beta/rc tags
30-
release = "1.9.0"
30+
release = "1.10.0"
3131

3232

3333
# -- General configuration ---------------------------------------------------

docs/user/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ If you want to choose a specific version to guarantee compatibility, you may ins
1919

2020
.. code-block:: shell
2121
22-
pip install rocketpy==1.9.0
22+
pip install rocketpy==1.10.0
2323
2424
2525
Optional Installation Method: ``conda``

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "rocketpy"
3-
version = "1.9.0"
3+
version = "1.10.0"
44
description="Advanced 6-DOF trajectory simulation for High-Power Rocketry."
55
dynamic = ["dependencies"]
66
readme = "README.md"

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: 23 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
@@ -248,6 +247,8 @@ class Environment:
248247
Number of ensemble members. Only defined when using Ensembles.
249248
Environment.ensemble_member : int
250249
Current selected ensemble member. Only defined when using Ensembles.
250+
Environment.earth_rotation_vector : list[float]
251+
Earth's angular velocity vector in the Flight Coordinate System.
251252
252253
Notes
253254
-----
@@ -353,6 +354,7 @@ def __init__(
353354
self.set_location(latitude, longitude)
354355
self.__initialize_earth_geometry(datum)
355356
self.__initialize_utm_coordinates()
357+
self.__set_earth_rotation_vector()
356358

357359
# Set the gravity model
358360
self.gravity = self.set_gravity_model(gravity)
@@ -451,7 +453,7 @@ def __initialize_utm_coordinates(self):
451453
self.initial_utm_letter,
452454
self.initial_hemisphere,
453455
self.initial_ew,
454-
) = self.geodesic_to_utm(
456+
) = geodesic_to_utm(
455457
lat=self.latitude,
456458
lon=self.longitude,
457459
flattening=self.ellipsoid.flattening,
@@ -584,6 +586,23 @@ def __reset_wind_direction_function(self):
584586
self.wind_direction.set_outputs("Wind Direction (Deg True)")
585587
self.wind_direction.set_title("Wind Direction Profile")
586588

589+
def __set_earth_rotation_vector(self):
590+
"""Calculates and stores the Earth's angular velocity vector in the Flight
591+
Coordinate System, which is essential for evaluating inertial forces.
592+
"""
593+
# Sidereal day
594+
T = 86164.1 # seconds
595+
596+
# Earth's angular velocity magnitude
597+
w_earth = 2 * np.pi / T
598+
599+
# Vector in the Flight Coordinate System
600+
lat = np.radians(self.latitude)
601+
w_local = [0, w_earth * np.cos(lat), w_earth * np.sin(lat)]
602+
603+
# Store the attribute
604+
self.earth_rotation_vector = w_local
605+
587606
# Validators (used to verify an attribute is being set correctly.)
588607

589608
def __validate_dictionary(self, file, dictionary):
@@ -2523,98 +2542,7 @@ def set_earth_geometry(self, datum):
25232542
f"the following recognized datum: {available_datums}"
25242543
) from e
25252544

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

26192547
@staticmethod
26202548
def calculate_earth_radius(

rocketpy/environment/environment_analysis.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2885,3 +2885,79 @@ def save(self, filename="env_analysis_dict"):
28852885
file.write(encoded_class)
28862886
file.close()
28872887
print("Your Environment Analysis file was saved, check it out: " + filename)
2888+
2889+
def create_environment_object(
2890+
self, gravity=None, date=None, datum="SIRGAS2000", max_expected_height=80000.0
2891+
):
2892+
"""Creates an Environment object with the data from the Environment Analysis instance.
2893+
It uses the average values from the data.
2894+
2895+
Parameters
2896+
----------
2897+
gravity : int, float, callable, string, array, optional
2898+
Surface gravitational acceleration. Positive values point the
2899+
acceleration down. If None, the Somigliana formula is used.
2900+
See :meth:`Environment.set_gravity_model` for more information.
2901+
date : list or tuple, optional
2902+
List or tuple of length 4, stating (year, month, day, hour) in the
2903+
time zone used in the Environment Analysis instance.
2904+
Alternatively, can be a ``datetime`` object specifying launch
2905+
date and time. The dates are stored as follows:
2906+
2907+
- :attr:`Environment.local_date`: Local time of launch in
2908+
the time zone specified in the Environment Analysis instance.
2909+
2910+
- :attr:`Environment.datetime_date`: UTC time of launch.
2911+
2912+
Default is None.
2913+
See :meth:`Environment.set_date` for more information.
2914+
datum : string, optional
2915+
The desired reference ellipsoidal model, the following options are
2916+
available: "SAD69", "WGS84", "NAD83", and "SIRGAS2000". The default
2917+
is "SIRGAS2000".
2918+
max_expected_height : float, optional
2919+
Maximum altitude in meters to keep weather data. The altitude must
2920+
be above sea level (ASL). Especially useful for visualization. Can
2921+
be altered as desired by running ``max_expected_height = number``.
2922+
"""
2923+
elevation_si = convert_units(
2924+
self.converted_elevation, self.unit_system["length"], "m"
2925+
)
2926+
altitude_si = convert_units(self.altitude_list, self.unit_system["length"], "m")
2927+
# Recalculating pressure profile using numpy.percentile
2928+
pressures = [
2929+
day_dict[hour]["pressure"](self.altitude_list)
2930+
for day_dict in self.converted_pressure_level_data.values()
2931+
for hour in day_dict.keys()
2932+
]
2933+
pressure_profile = np.percentile(pressures, 50, axis=0)
2934+
pressure_si = convert_units(
2935+
pressure_profile, self.unit_system["pressure"], "Pa"
2936+
)
2937+
temperature_si = convert_units(
2938+
self.average_temperature_profile, self.unit_system["temperature"], "K"
2939+
)
2940+
wind_velocity_x_si = convert_units(
2941+
self.average_wind_velocity_x_profile, self.unit_system["wind_speed"], "m/s"
2942+
)
2943+
wind_velocity_y_si = convert_units(
2944+
self.average_wind_velocity_y_profile, self.unit_system["wind_speed"], "m/s"
2945+
)
2946+
env = Environment(
2947+
gravity,
2948+
date,
2949+
self.latitude,
2950+
self.longitude,
2951+
elevation_si,
2952+
datum,
2953+
self.preferred_timezone,
2954+
max_expected_height,
2955+
)
2956+
env.set_atmospheric_model(
2957+
type="custom_atmosphere",
2958+
pressure=list(zip(altitude_si, pressure_si)),
2959+
temperature=list(zip(altitude_si, temperature_si)),
2960+
wind_u=list(zip(altitude_si, wind_velocity_x_si)),
2961+
wind_v=list(zip(altitude_si, wind_velocity_y_si)),
2962+
)
2963+
return env

0 commit comments

Comments
 (0)