diff --git a/Common/util_eddies.py b/Common/util_eddies.py index d5eb61531d5236dfefd66c52fc8ae1ed95dc5a69..54d7bac6a850c27acbf8020df2bd485a4bc3045d 100644 --- a/Common/util_eddies.py +++ b/Common/util_eddies.py @@ -5,6 +5,8 @@ import numpy as np import sys def comp_ishape(handler, date, eddy_index): + """handler should be a dictionary returned by open_shpc.""" + k = date - handler["d_init"] if k == 0: diff --git a/gt_segmented_cf.py b/gt_segmented_cf.py index 29ce90834a5dfd2b01ec9c2eaff126b7b9dfcf21..99e3068f49b5efe435862066d7a9b6a2226b65dc 100755 --- a/gt_segmented_cf.py +++ b/gt_segmented_cf.py @@ -107,9 +107,7 @@ delta_r_std = 8.6953 * 1000 orientation = input("Enter orientation (anti or cyclo): ") -########################## -# load the edgelist file # -########################## +# Load the graph_tool file: t0 = time.perf_counter() @@ -126,10 +124,6 @@ g.set_fast_edge_removal() # Calculating the Cost Function: # ################################## -####################### -# Load the shapefiles # -####################### - # setup the dicts for the shapefiles and the ishape_last files extremum = {} max_speed = {} @@ -163,11 +157,10 @@ for yr in range(1993, 2019): first_days = first['date_index'] # get year - first_date = datetime.date(1950,1,1) + datetime.timedelta(first['date_index']) + first_date = datetime.date(1950, 1, 1) \ + + datetime.timedelta(first['date_index']) first_year = first_date.year - #print(f'Segment size: {len(segment)}, first: {first_year}, last: {last_year}, yr: {yr}') - # chech if we are in the current year if (first_year == yr): @@ -184,8 +177,6 @@ for yr in range(1993, 2019): last_date = datetime.date(1950,1,1) + datetime.timedelta(last['date_index']) last_year = last_date.year - print(f'Segment size: {len(segment)}, first: {first_year}, last: {last_year}, yr: {yr}') - # calculate the location in the shapefile d_init_1 = extremum[first_year].record(0)[1]