|
27 | 27 | find_latitude_index, |
28 | 28 | find_longitude_index, |
29 | 29 | find_time_index, |
| 30 | + geodesic_to_utm, |
30 | 31 | get_elevation_data_from_dataset, |
31 | 32 | get_final_date_from_time_array, |
32 | 33 | get_initial_date_from_time_array, |
33 | 34 | get_interval_date_from_time_array, |
34 | 35 | get_pressure_levels_from_file, |
35 | 36 | mask_and_clean_dataset, |
36 | 37 | ) |
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 |
39 | 38 | from rocketpy.environment.weather_model_mapping import WeatherModelMapping |
40 | 39 | from rocketpy.mathutils.function import NUMERICAL_TYPES, Function, funcify_method |
41 | 40 | from rocketpy.plots.environment_plots import _EnvironmentPlots |
@@ -248,6 +247,8 @@ class Environment: |
248 | 247 | Number of ensemble members. Only defined when using Ensembles. |
249 | 248 | Environment.ensemble_member : int |
250 | 249 | 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. |
251 | 252 |
|
252 | 253 | Notes |
253 | 254 | ----- |
@@ -353,6 +354,7 @@ def __init__( |
353 | 354 | self.set_location(latitude, longitude) |
354 | 355 | self.__initialize_earth_geometry(datum) |
355 | 356 | self.__initialize_utm_coordinates() |
| 357 | + self.__set_earth_rotation_vector() |
356 | 358 |
|
357 | 359 | # Set the gravity model |
358 | 360 | self.gravity = self.set_gravity_model(gravity) |
@@ -451,7 +453,7 @@ def __initialize_utm_coordinates(self): |
451 | 453 | self.initial_utm_letter, |
452 | 454 | self.initial_hemisphere, |
453 | 455 | self.initial_ew, |
454 | | - ) = self.geodesic_to_utm( |
| 456 | + ) = geodesic_to_utm( |
455 | 457 | lat=self.latitude, |
456 | 458 | lon=self.longitude, |
457 | 459 | flattening=self.ellipsoid.flattening, |
@@ -584,6 +586,23 @@ def __reset_wind_direction_function(self): |
584 | 586 | self.wind_direction.set_outputs("Wind Direction (Deg True)") |
585 | 587 | self.wind_direction.set_title("Wind Direction Profile") |
586 | 588 |
|
| 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 | + |
587 | 606 | # Validators (used to verify an attribute is being set correctly.) |
588 | 607 |
|
589 | 608 | def __validate_dictionary(self, file, dictionary): |
@@ -2523,98 +2542,7 @@ def set_earth_geometry(self, datum): |
2523 | 2542 | f"the following recognized datum: {available_datums}" |
2524 | 2543 | ) from e |
2525 | 2544 |
|
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 |
2618 | 2546 |
|
2619 | 2547 | @staticmethod |
2620 | 2548 | def calculate_earth_radius( |
|
0 commit comments