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

Rename d to date and i to `eddy_i`

To search those names more easily.
parent c1762646
No related branches found
No related tags found
No related merge requests found
...@@ -35,8 +35,8 @@ contains ...@@ -35,8 +35,8 @@ contains
! Local: ! Local:
integer ishape, ishape_first integer ishape, ishape_first
integer d ! date integer date
integer i ! eddy index integer eddy_i ! eddy index
type(eddy) e type(eddy) e
!--------------------------------------------------------------------- !---------------------------------------------------------------------
...@@ -52,25 +52,25 @@ contains ...@@ -52,25 +52,25 @@ contains
allocate(s%list(s%number_extr)) allocate(s%list(s%number_extr))
do ishape = ishape_first, ishape_last(k + 1) do ishape = ishape_first, ishape_last(k + 1)
call read_eddy(e, d, i, hshp, ishape) call read_eddy(e, date, eddy_i, hshp, ishape)
! Check that all the eddies have the same date index: ! Check that all the eddies have the same date index:
if (d - d_init /= k) then if (date - d_init /= k) then
print *, "read_snapshot: bad date index" print *, "read_snapshot: bad date index"
print *, "d = ", d print *, "date = ", date
print *, "d_init = ", d_init print *, "d_init = ", d_init
print *, "k = ", k print *, "k = ", k
print *, "ishape = ", ishape print *, "ishape = ", ishape
print *, "i = ", i print *, "eddy_i = ", eddy_i
stop 1 stop 1
end if end if
s%list(i) = e s%list(eddy_i) = e
end do end do
allocate(s%ind_extr(2, s%number_extr)) allocate(s%ind_extr(2, s%number_extr))
forall (i = 1:s%number_extr) s%ind_extr(:, i) & forall (eddy_i = 1:s%number_extr) s%ind_extr(:, eddy_i) &
= nint(convert_to_ind(s%list(i)%coord_extr, corner, step)) = nint(convert_to_ind(s%list(eddy_i)%coord_extr, corner, step))
! Define s%extr_map from s%ind_extr: ! Define s%extr_map from s%ind_extr:
...@@ -79,8 +79,8 @@ contains ...@@ -79,8 +79,8 @@ contains
! Since we are not sure that there is no duplicate tuple in ! Since we are not sure that there is no duplicate tuple in
! s%ind_extr, we must use a do construct and not a forall: ! s%ind_extr, we must use a do construct and not a forall:
do i = 1, s%number_extr do eddy_i = 1, s%number_extr
s%extr_map(s%ind_extr(1, i), s%ind_extr(2, i)) = i s%extr_map(s%ind_extr(1, eddy_i), s%ind_extr(2, eddy_i)) = eddy_i
end do end do
call assert(count(s%extr_map(1:nlon, :) /= 0) == s%number_extr, & call assert(count(s%extr_map(1:nlon, :) /= 0) == s%number_extr, &
......
...@@ -18,16 +18,16 @@ def node_to_date_eddy(node_index, e_overestim, d_init): ...@@ -18,16 +18,16 @@ def node_to_date_eddy(node_index, e_overestim, d_init):
""" """
k = (node_index - 1) // e_overestim k = (node_index - 1) // e_overestim
d = d_init + k date = d_init + k
return {"eddy_index": node_index - k * e_overestim, "date_index": k, return {"eddy_index": node_index - k * e_overestim, "date_index": k,
"date": d} "date": date}
def date_eddy_to_node(d, eddy_index, e_overestim, d_init): def date_eddy_to_node(date, eddy_index, e_overestim, d_init):
"""Convert from eddy identification in shapefiles to node """Convert from eddy identification in shapefiles to node
identification in graph. identification in graph.
""" """
return (d - d_init) * e_overestim + eddy_index return (date - d_init) * e_overestim + eddy_index
def read_eddy_graph(edgelist, shpc_dir = None): def read_eddy_graph(edgelist, shpc_dir = None):
if os.access(edgelist, os.R_OK): if os.access(edgelist, os.R_OK):
...@@ -75,7 +75,7 @@ def to_eddy_agraph(G): ...@@ -75,7 +75,7 @@ def to_eddy_agraph(G):
A = nx_agraph.to_agraph(G) A = nx_agraph.to_agraph(G)
for d, s in my_subgraphs.items(): for date, s in my_subgraphs.items():
A.add_subgraph(s, rank = "same") A.add_subgraph(s, rank = "same")
return A return A
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment