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

Polish

parent 8f480111
No related branches found
No related tags found
No related merge requests found
...@@ -1597,6 +1597,18 @@ $\times$ 4 contours. Mettre \verb+outside_points+ vide dans ...@@ -1597,6 +1597,18 @@ $\times$ 4 contours. Mettre \verb+outside_points+ vide dans
\verb+good_contour+ pour trouver ces contours supplémentaires. Faire \verb+good_contour+ pour trouver ces contours supplémentaires. Faire
la recherche avec \verb+good_contour+ dans l'espace des indices. la recherche avec \verb+good_contour+ dans l'espace des indices.
type ssh contour : ssh, area, speed, contour xy, contour $\lambda
\phi$.
type eddy
\begin{itemize}
\item extremum : coord proj x y, coord $\lambda \phi$, ssh
\item innermost level, cyclone
\item type(ssh contour) contour list\verb+(:)+ (dernier : outer)
\item indice dans contour list du contour de vitesse maximale
\item valid, delta in delta out
\end{itemize}
Algorithme principal : Algorithme principal :
\begin{algorithmic} \begin{algorithmic}
\STATE lire ($\lambda$, $\phi$, ssh, u, v) \STATE lire ($\lambda$, $\phi$, ssh, u, v)
......
...@@ -8,21 +8,29 @@ G = nx.read_edgelist(sys.argv[1], create_using = nx.DiGraph, nodetype = int) ...@@ -8,21 +8,29 @@ G = nx.read_edgelist(sys.argv[1], create_using = nx.DiGraph, nodetype = int)
nbunch = [] # list of nodes to remove nbunch = [] # list of nodes to remove
for n in G: G.nodes[n]["inst_eddies"] = [n] for n in G: G.nodes[n]["inst_eddies"] = [n]
# "inst_eddies" is the list of instantaneous eddies represented by a
# node. At first, each node represents only itself. At the end of the
# script, each node will be a segment and "inst_eddies" will contain
# the list of eddies in the segment.
for n in G: for n in G:
if G.in_degree[n] == 1: if G.in_degree[n] == 1:
n2 = next(G.predecessors(n)) n2 = next(G.predecessors(n))
if G.out_degree[n2] == 1: if G.out_degree[n2] == 1:
# n continues a segment, circumvent n # n continues a segment, circumvent n:
nbunch.append(n) nbunch.append(n)
G.remove_edge(n2, n) G.remove_edge(n2, n)
G.nodes[n2]["inst_eddies"] += G.nodes[n]["inst_eddies"]
for n3 in list(G.successors(n)): for n3 in list(G.successors(n)):
G.remove_edge(n, n3) G.remove_edge(n, n3)
G.add_edge(n2, n3) G.add_edge(n2, n3)
# Add the segments represented by n to the segments
# represented by n2:
G.nodes[n2]["inst_eddies"] += G.nodes[n]["inst_eddies"]
G.remove_nodes_from(nbunch) G.remove_nodes_from(nbunch)
for k in sorted(G.nodes): print(k, G.nodes[k]) for k in sorted(G.nodes): print(k, G.nodes[k])
A = nx_agraph.to_agraph(G) A = nx_agraph.to_agraph(G)
......
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