Skip to content

Commit 8e6b5d4

Browse files
committed
- minor english
1 parent d81604d commit 8e6b5d4

File tree

4 files changed

+32
-28
lines changed

4 files changed

+32
-28
lines changed

examples/01_general_things/pet_storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
# array field like contour/profile are 2D column.
3333

3434
# %%
35-
# Eddies files (zarr or netcdf) could be loaded with ```load_file``` method:
35+
# Eddies files (zarr or netcdf) can be loaded with ```load_file``` method:
3636
eddies_collections = EddiesObservations.load_file(get_demo_path("Cyclonic_20160515.nc"))
3737
eddies_collections.field_table()
3838
# offset and scale_factor are used only when data is stored in zarr or netCDF4

examples/14_generic_tools/pet_fit_contour.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,30 @@
1515
from py_eddy_tracker import data
1616
from py_eddy_tracker.generic import coordinates_to_local, local_to_coordinates
1717
from py_eddy_tracker.observations.observation import EddiesObservations
18-
from py_eddy_tracker.poly import fit_circle_, fit_ellips
18+
from py_eddy_tracker.poly import fit_circle_, fit_ellipse
1919

2020
# %%
2121
# Load example identification file
2222
a = EddiesObservations.load_file(data.get_demo_path("Anticyclonic_20190223.nc"))
2323

2424

2525
# %%
26-
# Function to draw circle or ellips from parameter
26+
# Function to draw circle or ellipse from parameter
2727
def build_circle(x0, y0, r):
2828
angle = radians(linspace(0, 360, 50))
2929
x_norm, y_norm = cos(angle), sin(angle)
3030
return local_to_coordinates(x_norm * r, y_norm * r, x0, y0)
3131

3232

33-
def build_ellips(x0, y0, a, b, theta):
33+
def build_ellipse(x0, y0, a, b, theta):
3434
angle = radians(linspace(0, 360, 50))
3535
x = a * cos(theta) * cos(angle) - b * sin(theta) * sin(angle)
3636
y = a * sin(theta) * cos(angle) + b * cos(theta) * sin(angle)
3737
return local_to_coordinates(x, y, x0, y0)
3838

3939

4040
# %%
41-
# Plot fitted circle or ellips on stored contour
41+
# Plot fitted circle or ellipse on stored contour
4242
xs, ys = a.contour_lon_s, a.contour_lat_s
4343

4444
fig = plt.figure(figsize=(15, 15))
@@ -51,9 +51,9 @@ def build_ellips(x0, y0, a, b, theta):
5151
ax = fig.add_subplot(4, 4, j)
5252
ax.grid(), ax.set_aspect("equal")
5353
ax.plot(x, y, label="store", color="black")
54-
x0, y0, a, b, theta = fit_ellips(x_, y_)
54+
x0, y0, a, b, theta = fit_ellipse(x_, y_)
5555
x0, y0 = local_to_coordinates(x0, y0, x0_, y0_)
56-
ax.plot(*build_ellips(x0, y0, a, b, theta), label="ellips", color="green")
56+
ax.plot(*build_ellipse(x0, y0, a, b, theta), label="ellipse", color="green")
5757
x0, y0, radius, shape_error = fit_circle_(x_, y_)
5858
x0, y0 = local_to_coordinates(x0, y0, x0_, y0_)
5959
ax.plot(*build_circle(x0, y0, radius), label="circle", color="red", lw=0.5)

examples/16_network/pet_follow_particle.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def _repr_html_(self, *args, **kwargs):
3333

3434
def save(self, *args, **kwargs):
3535
if args[0].endswith("gif"):
36-
# In this case gif is use to create thumbnail which are not use but consume same time than video
36+
# In this case gif is used to create thumbnail which are not used but consumes same time than video
3737
# So we create an empty file, to save time
3838
with open(args[0], "w") as _:
3939
pass
@@ -147,7 +147,7 @@ def particle_candidate(x, y, c, eddies, t_start, i_target, pct, **kwargs):
147147
e = eddies.extract_with_mask(m_start)
148148
# to be able to get global index
149149
translate_start = where(m_start)[0]
150-
# Identify particle in eddies(only in core)
150+
# Identify particle in eddies (only in core)
151151
i_start = e.contains(x, y, intern=True)
152152
m = i_start != -1
153153
x, y, i_start = x[m], y[m], i_start[m]
@@ -158,9 +158,9 @@ def particle_candidate(x, y, c, eddies, t_start, i_target, pct, **kwargs):
158158
e_end = eddies.extract_with_mask(m_end)
159159
# to be able to get global index
160160
translate_end = where(m_end)[0]
161-
# Id eddies for each alive particle(in core and extern)
161+
# Id eddies for each alive particle (in core and extern)
162162
i_end = e_end.contains(x, y)
163-
# compute matrix and filled target array
163+
# compute matrix and fill target array
164164
get_matrix(i_start, i_end, translate_start, translate_end, i_target, pct)
165165

166166

@@ -169,7 +169,7 @@ def get_matrix(i_start, i_end, translate_start, translate_end, i_target, pct):
169169
nb_start, nb_end = translate_start.size, translate_end.size
170170
# Matrix which will store count for every couple
171171
count = zeros((nb_start, nb_end), dtype=nb_types.int32)
172-
# Number of particle in each origin observation
172+
# Number of particles in each origin observation
173173
ref = zeros(nb_start, dtype=nb_types.int32)
174174
# For each particle
175175
for i in range(i_start.size):
@@ -181,7 +181,7 @@ def get_matrix(i_start, i_end, translate_start, translate_end, i_target, pct):
181181
for i in range(nb_start):
182182
for j in range(nb_end):
183183
pct_ = count[i, j]
184-
# If there are particle from i to j
184+
# If there are particles from i to j
185185
if pct_ != 0:
186186
# Get percent
187187
pct_ = pct_ / ref[i] * 100.0

examples/16_network/pet_ioannou_2017_case.py

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,19 @@
1414
from matplotlib import pyplot as plt
1515
from matplotlib.animation import FuncAnimation
1616
from matplotlib.ticker import FuncFormatter
17-
from numpy import arange, where
17+
from numpy import arange, where, array, pi
1818

1919
import py_eddy_tracker.gui
2020
from py_eddy_tracker.appli.gui import Anim
2121
from py_eddy_tracker.data import get_demo_path
2222
from py_eddy_tracker.observations.network import NetworkObservations
2323

24+
from py_eddy_tracker.generic import coordinates_to_local, local_to_coordinates
25+
from py_eddy_tracker.poly import fit_ellipse
2426

2527
# %%
28+
29+
2630
class VideoAnimation(FuncAnimation):
2731
def _repr_html_(self, *args, **kwargs):
2832
"""To get video in html and have a player"""
@@ -192,43 +196,43 @@ def update_axes(ax, mappable=None):
192196
# %%
193197
# Rotation angle
194198
# --------------
195-
from py_eddy_tracker.generic import coordinates_to_local, local_to_coordinates
196-
from py_eddy_tracker.poly import fit_ellips
199+
# For each obs, fit an ellipse to the contour, with theta the angle from the x-axis,
200+
# a the semi ax in x direction and b the semi ax in y dimension
201+
197202
theta_ = list()
198203
a_ = list()
199204
b_ = list()
200205
for obs in close_to_i3:
201-
x, y = obs['contour_lon_s'], obs['contour_lat_s']
206+
x, y = obs["contour_lon_s"], obs["contour_lat_s"]
202207
x0_, y0_ = x.mean(), y.mean()
203208
x_, y_ = coordinates_to_local(x, y, x0_, y0_)
204-
x0, y0, a, b, theta = fit_ellips(x_, y_)
209+
x0, y0, a, b, theta = fit_ellipse(x_, y_)
205210
theta_.append(theta)
206211
a_.append(a)
207212
b_.append(b)
208-
a_=array(a_)
209-
b_=array(b_)
213+
a_ = array(a_)
214+
b_ = array(b_)
210215

211216
# %%
212217
# Theta
213218
ax = timeline_axes()
214-
m = close_to_i3.scatter_timeline(ax, theta_, vmin=-pi/2, vmax=pi/2, cmap='hsv')
219+
m = close_to_i3.scatter_timeline(ax, theta_, vmin=-pi / 2, vmax=pi / 2, cmap="hsv")
215220
cb = update_axes(ax, m["scatter"])
216221

217222
# %%
218-
# A
223+
# a
219224
ax = timeline_axes()
220-
m = close_to_i3.scatter_timeline(ax, a_ * 1e-3, vmin=0, vmax=80, cmap='Spectral_r')
225+
m = close_to_i3.scatter_timeline(ax, a_ * 1e-3, vmin=0, vmax=80, cmap="Spectral_r")
221226
cb = update_axes(ax, m["scatter"])
222227

223228
# %%
224-
# B
229+
# b
225230
ax = timeline_axes()
226-
m = close_to_i3.scatter_timeline(ax, b_ * 1e-3, vmin=0, vmax=80, cmap='Spectral_r')
231+
m = close_to_i3.scatter_timeline(ax, b_ * 1e-3, vmin=0, vmax=80, cmap="Spectral_r")
227232
cb = update_axes(ax, m["scatter"])
228233

229234
# %%
230-
# A/B
235+
# a/b
231236
ax = timeline_axes()
232-
m = close_to_i3.scatter_timeline(ax, a_/b_, vmin=1, vmax=2, cmap='Spectral_r')
237+
m = close_to_i3.scatter_timeline(ax, a_ / b_, vmin=1, vmax=2, cmap="Spectral_r")
233238
cb = update_axes(ax, m["scatter"])
234-

0 commit comments

Comments
 (0)