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

Move function `comp_ishape` to method

Move function `comp_ishape` to method of SHPC class.
parent ed16ca4a
Branches
No related tags found
No related merge requests found
......@@ -123,19 +123,19 @@ class SHPC_class:
assert i_slice >= 0
return i_slice
def comp_ishape(date, eddy_index, SHPC, i_slice, orientation):
"""Compute the location in the shapefiles."""
def comp_ishape(self, date, eddy_index, i_slice, orientation):
"""Compute the location in the shapefiles."""
assert date >= SHPC.d_init[i_slice]
assert date >= self.d_init[i_slice]
if date == SHPC.d_init[i_slice]:
ishape = eddy_index - 1
else:
# date > SHPC.d_init[i_slice]
ishape = SHPC.get_ishape_last(i_slice, orientation)\
[date - SHPC.d_init[i_slice] - 1] + eddy_index
if date == self.d_init[i_slice]:
ishape = eddy_index - 1
else:
# date > self.d_init[i_slice]
ishape = self.get_ishape_last(i_slice, orientation)\
[date - self.d_init[i_slice] - 1] + eddy_index
return ishape
return ishape
def in_window(point, window):
llcrnrlon, llcrnrlat, urcrnrlon, urcrnrlat = window
......
......@@ -36,8 +36,7 @@ else:
eddy_index = int(reply[1])
assert eddy_index >= 1
ishape = util_eddies.comp_ishape(date, eddy_index, SHPC, 0,
args.orientation)
ishape = SHPC.comp_ishape(date, eddy_index, 0, args.orientation)
print("ishape =", ishape)
......
......@@ -35,9 +35,8 @@ def select_ishapes(d, SHPC, i_slice, orientation, window = None):
"""
ishape_first = util_eddies.comp_ishape(d, eddy_index = 1, SHPC = SHPC,
i_slice = i_slice,
orientation = orientation)
ishape_first = SHPC.comp_ishape(d, eddy_index = 1, i_slice = i_slice,
orientation = orientation)
ishape_last = SHPC.get_ishape_last(i_slice, orientation)\
[d - SHPC.d_init[i_slice]]
......
......@@ -52,8 +52,8 @@ def set_attribute(G, SHPC):
for n in G:
date_index, eddy_index = node_to_date_eddy(n,
G.graph["e_overestim"])
ishape = util_eddies.comp_ishape(date_index, eddy_index, SHPC, 0,
SHPC.def_orient)
ishape = SHPC.comp_ishape(date_index, eddy_index, 0,
SHPC.def_orient)
shape_rec = reader.shapeRecord(ishape)
if shape_rec.record.valid == 1:
......
......@@ -67,8 +67,8 @@ def node_to_prop(node_list, e_overestim, SHPC):
for n in node_list:
date_index, eddy_index = report_graph.node_to_date_eddy(n, e_overestim)
i_slice = SHPC.get_slice(date_index)
ishape = util_eddies.comp_ishape(date_index, eddy_index, SHPC, i_slice,
SHPC.def_orient)
ishape = SHPC.comp_ishape(date_index, eddy_index, i_slice,
SHPC.def_orient)
shapeRec = SHPC.get_reader(i_slice, "extremum").shapeRecord(ishape)
prop = {"pos": shapeRec.shape.points[0], "speed": shapeRec.record.speed}
prop["radius"] = SHPC.get_reader(i_slice, "max_speed_contour")\
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment