Skip to content
Snippets Groups Projects
Commit 96501863 authored by GUEZ Lionel's avatar GUEZ Lionel
Browse files

Use intermediate constant `FACTOR`

To avoid repeated computation.
parent 88aec419
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,7 @@ import util_eddies ...@@ -28,6 +28,7 @@ import util_eddies
Omega = 2 * math.pi / 86164.0 # in s-1 Omega = 2 * math.pi / 86164.0 # in s-1
r_Earth = 6371 # radius of the Earth, in km r_Earth = 6371 # radius of the Earth, in km
FACTOR = 2 * Omega
def avg_radii_rossby(latitude_list, speed_list, radius_list): def avg_radii_rossby(latitude_list, speed_list, radius_list):
...@@ -43,7 +44,7 @@ def avg_radii_rossby(latitude_list, speed_list, radius_list): ...@@ -43,7 +44,7 @@ def avg_radii_rossby(latitude_list, speed_list, radius_list):
n_valid_Rossby = 0 n_valid_Rossby = 0
for latitude, speed, radius in zip(latitude_list, speed_list, radius_list): for latitude, speed, radius in zip(latitude_list, speed_list, radius_list):
f = 2 * Omega * math.sin(latitude) # in s-1 f = FACTOR * math.sin(latitude) # in s-1
radius = radius * 1000 # in m radius = radius * 1000 # in m
if abs(speed) < 100: if abs(speed) < 100:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment