diff --git a/Trajectories/cost_function.py b/Trajectories/cost_function.py index 77daba0826934f56e8b861629f7ae93c81575b73..d33c0e6819ecdc66eebb785f531a877aaaa28145 100755 --- a/Trajectories/cost_function.py +++ b/Trajectories/cost_function.py @@ -55,10 +55,10 @@ def calculate_radii_rossby(properties): if n_valid_Rossby != 0: avg_Rossby /= n_valid_Rossby return avg_rad, avg_Rossby -def get_SHPC(array_d_ini, date_index): - i_SHPC = bisect.bisect(array_d_init, date_index) - 1 - assert i_SHPC >= 0 - return i_SHPC +def get_slice(array_d_ini, date_index): + i_slice = bisect.bisect(array_d_init, date_index) - 1 + assert i_slice >= 0 + return i_slice def node_to_prop(node_list, e_overestim, array_d_init, handlers): """node_list is a list of node identification numbers for @@ -73,16 +73,16 @@ def node_to_prop(node_list, e_overestim, array_d_init, handlers): for n in node_list: date_index, eddy_index = report_graph.node_to_date_eddy(n, e_overestim) - i_SHPC = get_SHPC(array_d_init, date_index) - ishape = util_eddies.comp_ishape(handlers[i_SHPC], date_index, + i_slice = get_slice(array_d_init, date_index) + ishape = util_eddies.comp_ishape(handlers[i_slice], date_index, eddy_index) - shapeRec = handlers[i_SHPC]["readers"]["extremum"].shapeRecord(ishape) + shapeRec = handlers[i_slice]["readers"]["extremum"].shapeRecord(ishape) prop = {"pos": shapeRec.shape.points[0], "speed": shapeRec.record.speed} - prop["radius"] = handlers[i_SHPC]["readers"]["max_speed_contour"]\ + prop["radius"] = handlers[i_slice]["readers"]["max_speed_contour"]\ .record(ishape).r_eq_area if prop["radius"] < 0: - prop["radius"] = handlers[i_SHPC]["readers"]["outermost_contour"]\ + prop["radius"] = handlers[i_slice]["readers"]["outermost_contour"]\ .record(ishape).r_eq_area properties.append(prop)