diff --git a/gt_segmented_cf.py b/gt_segmented_cf.py index 07a2dd58f966ac86ba8c8cf89d25e2360bd1f8dd..29ce90834a5dfd2b01ec9c2eaff126b7b9dfcf21 100755 --- a/gt_segmented_cf.py +++ b/gt_segmented_cf.py @@ -39,7 +39,7 @@ def comp_ishape(d_init, ishape_last, days_1950, eddy_index): ####################### def calculate_radii_and_rossby(start, end, inc, segment, e_overestim, extremum, - max_rcd, ishape_last): + max_speed, ishape_last): radii = 0 #[m] rossby = 0 #[1/s] @@ -67,7 +67,7 @@ def calculate_radii_and_rossby(start, end, inc, segment, e_overestim, extremum, f = 2*2*math.pi/(24*3600)*math.sin(math.radians(lat_in_deg)) # [1/s] V_max = shapeRec.record[4] #[m/s] - R_Vmax = max_rcd[year][location]['r_eq_area'] * 1000 #[m] + R_Vmax = max_speed[year].record(location)['r_eq_area'] * 1000 #[m] if (V_max < 100): @@ -150,20 +150,6 @@ num_of_days_to_avg = 7 # we iterate on the years because the segments are non sequential in time for yr in range(1993, 2019): print(f'Current year: {yr}') - print('Loading shapefiles...') - - max_rcd = {} - - max_rcd[yr] = max_speed[yr].records() - - # check if we are reaching the last two years or the last year - if (yr <= 2017): - max_rcd[yr+1] = max_speed[yr + 1].records() - - if (yr <= 2016): - max_rcd[yr+2] = max_speed[yr + 2].records() - - print("Finished reading shapefiles.") # iterate on the vertices for n in g.vertices(): @@ -229,7 +215,7 @@ for yr in range(1993, 2019): # First 7 days calculation first_res = calculate_radii_and_rossby(0, num_of_days_to_avg, 1, segment, e_overestim, - extremum, max_rcd, + extremum, max_speed, ishape_last) # average and assign radii @@ -253,7 +239,7 @@ for yr in range(1993, 2019): -1, segment, e_overestim, extremum, - max_rcd, ishape_last) + max_speed, ishape_last) # Average and assign the last radii last_radii = last_res['radii'] / num_of_days_to_avg @@ -276,7 +262,7 @@ for yr in range(1993, 2019): else: res = calculate_radii_and_rossby(0, num_of_days, 1, segment, e_overestim, - extremum, max_rcd, ishape_last) + extremum, max_speed, ishape_last) # grab the days modifier modifier = res['days_modifier']