Skip to content

Commit

Permalink
MNT: singleton-comparison != None
Browse files Browse the repository at this point in the history
  • Loading branch information
Gui-FernandesBR committed Jun 14, 2024
1 parent 6cd0a93 commit 8925a19
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
10 changes: 5 additions & 5 deletions rocketpy/environment/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def __init__(
self.set_atmospheric_model("standard_atmosphere")

# Save date
if date != None:
if date is not None:
self.set_date(date, timezone)
else:
self.date = None
Expand All @@ -378,7 +378,7 @@ def __init__(
# Save latitude and longitude
self.latitude = latitude
self.longitude = longitude
if latitude != None and longitude != None:
if latitude is not None and longitude is not None:
self.set_location(latitude, longitude)
else:
self.latitude, self.longitude = None, None
Expand Down Expand Up @@ -664,7 +664,7 @@ def set_elevation(self, elevation="Open-Elevation"):
"""
if elevation != "Open-Elevation" and elevation != "SRTM":
self.elevation = elevation
# elif elevation == "SRTM" and self.latitude != None and self.longitude != None:
# elif elevation == "SRTM" and self.latitude is not None and self.longitude is not None:
# # Trigger the authentication flow.
# #ee.Authenticate()
# # Initialize the library.
Expand Down Expand Up @@ -3325,9 +3325,9 @@ def all_info_returned(self):
surface_air_density=self.density(self.elevation),
surface_speed_of_sound=self.speed_of_sound(self.elevation),
)
if self.datetime_date != None:
if self.datetime_date is not None:
info["launch_date"] = self.datetime_date.strftime("%Y-%d-%m %H:%M:%S")
if self.latitude != None and self.longitude != None:
if self.latitude is not None and self.longitude is not None:
info["lat"] = self.latitude
info["lon"] = self.longitude
if info["model_type"] in ["Forecast", "Reanalysis", "Ensemble"]:
Expand Down
9 changes: 6 additions & 3 deletions rocketpy/prints/environment_prints.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def launch_site_details(self):
print("\nLaunch Site Details\n")
time_format = "%Y-%m-%d %H:%M:%S"
if (
self.environment.datetime_date != None
self.environment.datetime_date is not None
and "UTC" not in self.environment.timezone
):
print(
Expand All @@ -62,13 +62,16 @@ def launch_site_details(self):
self.environment.local_date.strftime(time_format),
self.environment.timezone,
)
elif self.environment.datetime_date != None:
elif self.environment.datetime_date is not None:
print(
"Launch Date:",
self.environment.datetime_date.strftime(time_format),
"UTC",
)
if self.environment.latitude != None and self.environment.longitude != None:
if (
self.environment.latitude is not None
and self.environment.longitude is not None
):
print("Launch Site Latitude: {:.5f}°".format(self.environment.latitude))
print("Launch Site Longitude: {:.5f}°".format(self.environment.longitude))
print("Reference Datum: " + self.environment.datum)
Expand Down

0 comments on commit 8925a19

Please sign in to comment.