Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 72d6f5d

Browse files
RickisterrGui-FernandesBR
authored andcommittedMay 16, 2025
Reformatted + Removed Redundanct files
1 parent 6ee7c3b commit 72d6f5d

22 files changed

+116
-247
lines changed
 

‎rocketpy/environment/environment.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,9 +1442,7 @@ def wind_heading_func(h): # TODO: create another custom reset for heading
14421442

14431443
self._max_expected_height = max_expected_height
14441444

1445-
def process_windy_atmosphere(
1446-
self, model="ECMWF"
1447-
): # pylint: disable=too-many-statements
1445+
def process_windy_atmosphere(self, model="ECMWF"): # pylint: disable=too-many-statements
14481446
"""Process data from Windy.com to retrieve atmospheric forecast data.
14491447
14501448
Parameters
@@ -1655,9 +1653,7 @@ def process_wyoming_sounding(self, file): # pylint: disable=too-many-statements
16551653
# Save maximum expected height
16561654
self._max_expected_height = data_array[-1, 1]
16571655

1658-
def process_forecast_reanalysis(
1659-
self, file, dictionary
1660-
): # pylint: disable=too-many-locals,too-many-statements
1656+
def process_forecast_reanalysis(self, file, dictionary): # pylint: disable=too-many-locals,too-many-statements
16611657
"""Import and process atmospheric data from weather forecasts
16621658
and reanalysis given as ``netCDF`` or ``OPeNDAP`` files.
16631659
Sets pressure, temperature, wind-u and wind-v
@@ -1913,9 +1909,7 @@ def process_forecast_reanalysis(
19131909
# Close weather data
19141910
data.close()
19151911

1916-
def process_ensemble(
1917-
self, file, dictionary
1918-
): # pylint: disable=too-many-locals,too-many-statements
1912+
def process_ensemble(self, file, dictionary): # pylint: disable=too-many-locals,too-many-statements
19191913
"""Import and process atmospheric data from weather ensembles
19201914
given as ``netCDF`` or ``OPeNDAP`` files. Sets pressure, temperature,
19211915
wind-u and wind-v profiles and surface elevation obtained from a weather

‎rocketpy/environment/environment_analysis.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -751,9 +751,9 @@ def __parse_pressure_level_data(self):
751751
outputs="Wind Direction (Deg True)",
752752
extrapolation="constant",
753753
)
754-
dictionary[date_string][hour_string][
755-
"wind_direction"
756-
] = wind_direction_function
754+
dictionary[date_string][hour_string]["wind_direction"] = (
755+
wind_direction_function
756+
)
757757

758758
return (dictionary, lat0, lat1, lon0, lon1)
759759

@@ -996,11 +996,7 @@ def converted_pressure_level_data(self):
996996
converted_dict = copy.deepcopy(self.original_pressure_level_data)
997997

998998
# Loop through dates
999-
for (
1000-
date
1001-
) in (
1002-
self.original_pressure_level_data
1003-
): # pylint: disable=consider-using-dict-items
999+
for date in self.original_pressure_level_data: # pylint: disable=consider-using-dict-items
10041000
# Loop through hours
10051001
for hour in self.original_pressure_level_data[date]:
10061002
# Loop through variables
@@ -1062,9 +1058,7 @@ def converted_surface_data(self):
10621058
converted_dict = copy.deepcopy(self.original_surface_data)
10631059

10641060
# Loop through dates
1065-
for (
1066-
date
1067-
) in self.original_surface_data: # pylint: disable=consider-using-dict-items
1061+
for date in self.original_surface_data: # pylint: disable=consider-using-dict-items
10681062
# Loop through hours
10691063
for hour in self.original_surface_data[date]:
10701064
# Loop through variables

‎rocketpy/environment/tools.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,7 @@ def get_interval_date_from_time_array(time_array, units=None):
442442
# Geodesic conversions functions
443443

444444

445-
def geodesic_to_utm(
446-
lat, lon, semi_major_axis=6378137.0, flattening=1 / 298.257223563
447-
): # pylint: disable=too-many-locals,too-many-statements
445+
def geodesic_to_utm(lat, lon, semi_major_axis=6378137.0, flattening=1 / 298.257223563): # pylint: disable=too-many-locals,too-many-statements
448446
"""Function which converts geodetic coordinates, i.e. lat/lon, to UTM
449447
projection coordinates. Can be used only for latitudes between -80.00°
450448
and 84.00°

‎rocketpy/mathutils/function.py

Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,7 @@ def __set_interpolation_func(self): # pylint: disable=too-many-statements
374374
if interpolation == 0: # linear
375375
if self.__dom_dim__ == 1:
376376

377-
def linear_interpolation(
378-
x, x_min, x_max, x_data, y_data, coeffs
379-
): # pylint: disable=unused-argument
377+
def linear_interpolation(x, x_min, x_max, x_data, y_data, coeffs): # pylint: disable=unused-argument
380378
x_interval = bisect_left(x_data, x)
381379
x_left = x_data[x_interval - 1]
382380
y_left = y_data[x_interval - 1]
@@ -387,27 +385,21 @@ def linear_interpolation(
387385
else:
388386
interpolator = LinearNDInterpolator(self._domain, self._image)
389387

390-
def linear_interpolation(
391-
x, x_min, x_max, x_data, y_data, coeffs
392-
): # pylint: disable=unused-argument
388+
def linear_interpolation(x, x_min, x_max, x_data, y_data, coeffs): # pylint: disable=unused-argument
393389
return interpolator(x)
394390

395391
self._interpolation_func = linear_interpolation
396392

397393
elif interpolation == 1: # polynomial
398394

399-
def polynomial_interpolation(
400-
x, x_min, x_max, x_data, y_data, coeffs
401-
): # pylint: disable=unused-argument
395+
def polynomial_interpolation(x, x_min, x_max, x_data, y_data, coeffs): # pylint: disable=unused-argument
402396
return np.sum(coeffs * x ** np.arange(len(coeffs)))
403397

404398
self._interpolation_func = polynomial_interpolation
405399

406400
elif interpolation == 2: # akima
407401

408-
def akima_interpolation(
409-
x, x_min, x_max, x_data, y_data, coeffs
410-
): # pylint: disable=unused-argument
402+
def akima_interpolation(x, x_min, x_max, x_data, y_data, coeffs): # pylint: disable=unused-argument
411403
x_interval = bisect_left(x_data, x)
412404
x_interval = x_interval if x_interval != 0 else 1
413405
a = coeffs[4 * x_interval - 4 : 4 * x_interval]
@@ -417,9 +409,7 @@ def akima_interpolation(
417409

418410
elif interpolation == 3: # spline
419411

420-
def spline_interpolation(
421-
x, x_min, x_max, x_data, y_data, coeffs
422-
): # pylint: disable=unused-argument
412+
def spline_interpolation(x, x_min, x_max, x_data, y_data, coeffs): # pylint: disable=unused-argument
423413
x_interval = bisect_left(x_data, x)
424414
x_interval = max(x_interval, 1)
425415
a = coeffs[:, x_interval - 1]
@@ -455,9 +445,7 @@ def shepard_interpolation(x, x_min, x_max, x_data, y_data, _):
455445
elif interpolation == 5: # RBF
456446
interpolator = RBFInterpolator(self._domain, self._image, neighbors=100)
457447

458-
def rbf_interpolation(
459-
x, x_min, x_max, x_data, y_data, coeffs
460-
): # pylint: disable=unused-argument
448+
def rbf_interpolation(x, x_min, x_max, x_data, y_data, coeffs): # pylint: disable=unused-argument
461449
return interpolator(x)
462450

463451
self._interpolation_func = rbf_interpolation
@@ -471,19 +459,15 @@ def __set_extrapolation_func(self): # pylint: disable=too-many-statements
471459

472460
if extrapolation == 0: # zero
473461

474-
def zero_extrapolation(
475-
x, x_min, x_max, x_data, y_data, coeffs
476-
): # pylint: disable=unused-argument
462+
def zero_extrapolation(x, x_min, x_max, x_data, y_data, coeffs): # pylint: disable=unused-argument
477463
return 0
478464

479465
self._extrapolation_func = zero_extrapolation
480466
elif extrapolation == 1: # natural
481467
if interpolation == 0: # linear
482468
if self.__dom_dim__ == 1:
483469

484-
def natural_extrapolation(
485-
x, x_min, x_max, x_data, y_data, coeffs
486-
): # pylint: disable=unused-argument
470+
def natural_extrapolation(x, x_min, x_max, x_data, y_data, coeffs): # pylint: disable=unused-argument
487471
x_interval = 1 if x < x_min else -1
488472
x_left = x_data[x_interval - 1]
489473
y_left = y_data[x_interval - 1]
@@ -496,31 +480,23 @@ def natural_extrapolation(
496480
self._domain, self._image, neighbors=100
497481
)
498482

499-
def natural_extrapolation(
500-
x, x_min, x_max, x_data, y_data, coeffs
501-
): # pylint: disable=unused-argument
483+
def natural_extrapolation(x, x_min, x_max, x_data, y_data, coeffs): # pylint: disable=unused-argument
502484
return interpolator(x)
503485

504486
elif interpolation == 1: # polynomial
505487

506-
def natural_extrapolation(
507-
x, x_min, x_max, x_data, y_data, coeffs
508-
): # pylint: disable=unused-argument
488+
def natural_extrapolation(x, x_min, x_max, x_data, y_data, coeffs): # pylint: disable=unused-argument
509489
return np.sum(coeffs * x ** np.arange(len(coeffs)))
510490

511491
elif interpolation == 2: # akima
512492

513-
def natural_extrapolation(
514-
x, x_min, x_max, x_data, y_data, coeffs
515-
): # pylint: disable=unused-argument
493+
def natural_extrapolation(x, x_min, x_max, x_data, y_data, coeffs): # pylint: disable=unused-argument
516494
a = coeffs[:4] if x < x_min else coeffs[-4:]
517495
return a[3] * x**3 + a[2] * x**2 + a[1] * x + a[0]
518496

519497
elif interpolation == 3: # spline
520498

521-
def natural_extrapolation(
522-
x, x_min, x_max, x_data, y_data, coeffs
523-
): # pylint: disable=unused-argument
499+
def natural_extrapolation(x, x_min, x_max, x_data, y_data, coeffs): # pylint: disable=unused-argument
524500
if x < x_min:
525501
a = coeffs[:, 0]
526502
x = x - x_data[0]
@@ -554,18 +530,14 @@ def natural_extrapolation(x, x_min, x_max, x_data, y_data, _):
554530
elif interpolation == 5: # RBF
555531
interpolator = RBFInterpolator(self._domain, self._image, neighbors=100)
556532

557-
def natural_extrapolation(
558-
x, x_min, x_max, x_data, y_data, coeffs
559-
): # pylint: disable=unused-argument
533+
def natural_extrapolation(x, x_min, x_max, x_data, y_data, coeffs): # pylint: disable=unused-argument
560534
return interpolator(x)
561535

562536
self._extrapolation_func = natural_extrapolation
563537
elif extrapolation == 2: # constant
564538
if self.__dom_dim__ == 1:
565539

566-
def constant_extrapolation(
567-
x, x_min, x_max, x_data, y_data, coeffs
568-
): # pylint: disable=unused-argument
540+
def constant_extrapolation(x, x_min, x_max, x_data, y_data, coeffs): # pylint: disable=unused-argument
569541
return y_data[0] if x < x_min else y_data[-1]
570542

571543
else:

‎rocketpy/plots/environment_analysis_plots.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -957,9 +957,7 @@ def average_wind_rose_specific_hour(self, hour, fig=None, *, filename=None):
957957
)
958958
show_or_save_plot(filename)
959959

960-
def average_wind_rose_grid(
961-
self, *, filename=None
962-
): # pylint: disable=too-many-statements
960+
def average_wind_rose_grid(self, *, filename=None): # pylint: disable=too-many-statements
963961
"""Plot wind roses for all hours of a day, in a grid like plot.
964962
965963
Parameters
@@ -1093,9 +1091,7 @@ def animate_average_wind_rose(self, figsize=(5, 5), filename="wind_rose.gif"):
10931091

10941092
# More plots and animations
10951093

1096-
def wind_gust_distribution_grid(
1097-
self, *, filename=None
1098-
): # pylint: disable=too-many-statements
1094+
def wind_gust_distribution_grid(self, *, filename=None): # pylint: disable=too-many-statements
10991095
"""Plots shown in the animation of how the wind gust distribution varies
11001096
throughout the day.
11011097
@@ -1498,9 +1494,7 @@ def update(frame):
14981494
plt.close(fig)
14991495
return HTML(animation.to_jshtml())
15001496

1501-
def wind_speed_profile_grid(
1502-
self, clear_range_limits=False, *, filename=None
1503-
): # pylint: disable=too-many-statements
1497+
def wind_speed_profile_grid(self, clear_range_limits=False, *, filename=None): # pylint: disable=too-many-statements
15041498
"""Creates a grid of plots with the wind profile over the average day.
15051499
Each subplot represents a different hour of the day.
15061500
@@ -1597,9 +1591,7 @@ def wind_speed_profile_grid(
15971591
fig.supylabel(f"Altitude AGL ({self.env_analysis.unit_system['length']})")
15981592
show_or_save_plot(filename)
15991593

1600-
def wind_heading_profile_grid(
1601-
self, clear_range_limits=False, *, filename=None
1602-
): # pylint: disable=too-many-statements
1594+
def wind_heading_profile_grid(self, clear_range_limits=False, *, filename=None): # pylint: disable=too-many-statements
16031595
"""Creates a grid of plots with the wind heading profile over the
16041596
average day. Each subplot represents a different hour of the day.
16051597
@@ -1691,9 +1683,7 @@ def wind_heading_profile_grid(
16911683
fig.supylabel(f"Altitude AGL ({self.env_analysis.unit_system['length']})")
16921684
show_or_save_plot(filename)
16931685

1694-
def animate_wind_speed_profile(
1695-
self, clear_range_limits=False
1696-
): # pylint: disable=too-many-statements
1686+
def animate_wind_speed_profile(self, clear_range_limits=False): # pylint: disable=too-many-statements
16971687
"""Animation of how wind profile evolves throughout an average day.
16981688
16991689
Parameters
@@ -1773,9 +1763,7 @@ def update(frame):
17731763
plt.close(fig)
17741764
return HTML(animation.to_jshtml())
17751765

1776-
def animate_wind_heading_profile(
1777-
self, clear_range_limits=False
1778-
): # pylint: disable=too-many-statements
1766+
def animate_wind_heading_profile(self, clear_range_limits=False): # pylint: disable=too-many-statements
17791767
"""Animation of how the wind heading profile evolves throughout an
17801768
average day. Each frame is a different hour of the day.
17811769

‎rocketpy/plots/flight_plots.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,7 @@ def trajectory_3d(self, *, filename=None): # pylint: disable=too-many-statement
133133
ax1.set_box_aspect(None, zoom=0.95) # 95% for label adjustment
134134
show_or_save_plot(filename)
135135

136-
def linear_kinematics_data(
137-
self, *, filename=None
138-
): # pylint: disable=too-many-statements
136+
def linear_kinematics_data(self, *, filename=None): # pylint: disable=too-many-statements
139137
"""Prints out all Kinematics graphs available about the Flight
140138
141139
Parameters
@@ -323,9 +321,7 @@ def flight_path_angle_data(self, *, filename=None):
323321
plt.subplots_adjust(hspace=0.5)
324322
show_or_save_plot(filename)
325323

326-
def angular_kinematics_data(
327-
self, *, filename=None
328-
): # pylint: disable=too-many-statements
324+
def angular_kinematics_data(self, *, filename=None): # pylint: disable=too-many-statements
329325
"""Prints out all Angular velocity and acceleration graphs available
330326
about the Flight
331327
@@ -399,9 +395,7 @@ def angular_kinematics_data(
399395
plt.subplots_adjust(hspace=0.5)
400396
show_or_save_plot(filename)
401397

402-
def rail_buttons_forces(
403-
self, *, filename=None
404-
): # pylint: disable=too-many-statements
398+
def rail_buttons_forces(self, *, filename=None): # pylint: disable=too-many-statements
405399
"""Prints out all Rail Buttons Forces graphs available about the Flight.
406400
407401
Parameters
@@ -492,9 +486,7 @@ def rail_buttons_forces(
492486
plt.subplots_adjust(hspace=0.5)
493487
show_or_save_plot(filename)
494488

495-
def aerodynamic_forces(
496-
self, *, filename=None
497-
): # pylint: disable=too-many-statements
489+
def aerodynamic_forces(self, *, filename=None): # pylint: disable=too-many-statements
498490
"""Prints out all Forces and Moments graphs available about the Flight
499491
500492
Parameters
@@ -701,9 +693,7 @@ def energy_data(self, *, filename=None): # pylint: disable=too-many-statements
701693
plt.subplots_adjust(hspace=1)
702694
show_or_save_plot(filename)
703695

704-
def fluid_mechanics_data(
705-
self, *, filename=None
706-
): # pylint: disable=too-many-statements
696+
def fluid_mechanics_data(self, *, filename=None): # pylint: disable=too-many-statements
707697
"""Prints out a summary of the Fluid Mechanics graphs available about
708698
the Flight
709699
@@ -801,9 +791,7 @@ def fluid_mechanics_data(
801791
plt.subplots_adjust(hspace=0.5)
802792
show_or_save_plot(filename)
803793

804-
def stability_and_control_data(
805-
self, *, filename=None
806-
): # pylint: disable=too-many-statements
794+
def stability_and_control_data(self, *, filename=None): # pylint: disable=too-many-statements
807795
"""Prints out Rocket Stability and Control parameters graphs available
808796
about the Flight
809797

‎rocketpy/plots/rocket_plots.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,7 @@ def _draw_motor(self, last_radius, last_x, ax, vis_args):
438438

439439
self._draw_nozzle_tube(last_radius, last_x, nozzle_position, ax, vis_args)
440440

441-
def _generate_motor_patches(
442-
self, total_csys, ax
443-
): # pylint: disable=unused-argument
441+
def _generate_motor_patches(self, total_csys, ax): # pylint: disable=unused-argument
444442
"""Generates motor patches for drawing"""
445443
motor_patches = []
446444

0 commit comments

Comments
 (0)