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

Polish

parent e130907b
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,7 @@ class SHPC_class:
self.dir = SHPC_dir
self.def_orient = def_orient
# Define self.n_slices:
# <begin> Define self.n_slices
fname = path.join(SHPC_dir, "n_slices.txt")
......@@ -53,11 +53,13 @@ class SHPC_class:
with open(fname, "w", encoding="utf-8") as f:
f.write(f"{self.n_slices}\n")
# <end> Define self.n_slices
self._readers = [
{"Anticyclones": {}, "Cyclones": {}} for i in range(self.n_slices)
]
# Define self.d_init:
# <begin> Define self.d_init
self.d_init = []
......@@ -65,6 +67,7 @@ class SHPC_class:
my_shapefile = path.join(
SHPC_dir, f"Slice_{i_slice}", def_orient, "extremum"
)
try:
reader[def_orient]["extremum"] = shapefile.Reader(my_shapefile)
except shapefile.ShapefileException:
......@@ -88,6 +91,8 @@ class SHPC_class:
self.d_init.append(d_init_slice)
# <end> Define self.d_init
self._ishape_last = [
{"Anticyclones": None, "Cyclones": None}
for i in range(self.n_slices)
......@@ -104,7 +109,6 @@ class SHPC_class:
ishape_last = self.get_ishape_last(self.n_slices - 1, self.def_orient)
self.n_dates = np.ediff1d(self.d_init, to_end=ishape_last.size)
self._i_slice = []
for i_slice, n_dates in enumerate(self.n_dates):
......@@ -126,7 +130,6 @@ class SHPC_class:
fname = path.join(
self.dir, f"Slice_{i_slice}", orientation, "ishape_last.txt"
)
print("Reading", fname, "...")
try:
self._ishape_last[i_slice][orientation] = np.loadtxt(
......@@ -224,8 +227,8 @@ class SHPC_class:
def comp_ishape(self, date, eddy_index, orientation):
"""Compute the location in the shapefiles: return `(i_slice, ishape)`.
Returns None if ishape_last is None. Returns None if
eddy_index is greater than the maximum value.
Returns None if ishape_last is None or eddy_index is greater
than the maximum value.
"""
......
......@@ -58,7 +58,11 @@ def func(d, ax, i_slices, ishape_lists_all, SHPC, bbox, light):
def anim_eddies(fig, ax, SHPC, window, d_min, d_max, light):
"""SHPC is an instance of SHPC_class."""
"""SHPC is an instance of SHPC_class. We define i_slices and
ishape_lists_all[orientation] here rather than in func because we
need them to compute bbox.
"""
ishape_lists_all = {}
i_slices = {}
......
......@@ -21,6 +21,7 @@ import numpy as np
from cartopy.mpl import geoaxes
import cartopy.crs as ccrs
from matplotlib import patches
import util_eddies
......
......@@ -115,7 +115,7 @@ Cf. algorithme \ref{alg:principal}.
\label{sec:identification}
Instantaneous eddies (also called occurences of eddies) with a given
orientation may be identified in four ways:
orientation may be identified in three ways:
\begin{itemize}
\item By a couple date index $d$ and eddy index $e$ at that date
index. This is the way eddies are identified in program
......@@ -131,10 +131,6 @@ orientation may be identified in four ways:
created by program \verb+inst_eddies+. It is used in program
\verb+eddy_graph+. It is also used in Python scripts to determine
trajectories and to analyze and plot the results.
\item By a vertex index in the abstract graph of instantaneous eddies
and in the abstract graph of segments. The vertex index is defined
and used by the graph software, graph-tool. It appears in the file
\verb+traj_vert_ind.json+ created by script \verb+trajectories.py+.
\end{itemize}
The date index $d$ is an integer value. It is a number of time steps
......@@ -160,8 +156,8 @@ The intra-date eddy indices $e$ for eddies at date index $d$ start at 1 and
increment 1 by 1, without any jump. So they go from 1 to
$e_\mathrm{max}(d)$.
The relation between inter-date index $n$, date index $d$ and intra-date eddy index $e$
is:
The relation between inter-date index $n$, date index $d$ and
intra-date eddy index $e$ is:
\begin{equation*}
n = d E + e
\end{equation*}
......
......@@ -181,6 +181,12 @@ segment isolé.
La révision 6f5bb0c1 donne exactement le même résultat que la 787726e0
sur le graphe global 1993-2020.
A segment may be identified by a vertex index in the abstract graph of
segments. The vertex index is defined and used by the graph software,
graph-tool. Is is between 0 and $N - 1$ where $N$ is the number of
vertices in the graph. It appears in the file
\verb+traj_vert_ind.json+ created by script \verb+trajectories.py+.
\section{Script \texttt{trajectory.py}}
Les trajectoires sont presque toujours, mais pas toujours, des
......
......@@ -63,7 +63,7 @@ def calculate_radii_rossby(properties):
def node_to_prop(node_list, e_overestim, SHPC, orientation):
"""node_list is a list of node identification numbers for
"""node_list is a list of inter-date identification numbers for
instantaneous eddies. This function returns some properties of the
eddies, read from shapefiles: position of extremum, radius of
outermost contour or maximum speed contour, and speed. The three
......
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