diff --git a/gt_segmented_cf.py b/gt_segmented_cf.py index dd6442185bf23c4c7144f28dc403aaef536c64c7..07a2dd58f966ac86ba8c8cf89d25e2360bd1f8dd 100755 --- a/gt_segmented_cf.py +++ b/gt_segmented_cf.py @@ -48,16 +48,18 @@ def calculate_radii_and_rossby(start, end, inc, segment, e_overestim, extremum, for i in range(start, end, inc): current_eddy = report_graph.node_to_date_eddy(segment[i], e_overestim) - date = datetime.date(1950,1,1) + datetime.timedelta(current_eddy['date_index']) + date = datetime.date(1950, 1, 1) \ + + datetime.timedelta(current_eddy['date_index']) year = date.year # calculate the location in the shapefile d_init_1 = extremum[year].record(0)[1] location = comp_ishape(d_init_1, ishape_last[year], - current_eddy['date_index'], current_eddy['eddy_index']) - - # now that we have the location in the shapefiles, we need to get the radius and the rossby number + current_eddy['date_index'], + current_eddy['eddy_index']) + # now that we have the location in the shapefiles, we need to + # get the radius and the rossby number shapeRec = extremum[year].shapeRecord(location) # rossby: lat_in_deg = shapeRec.shape.points[0][1] @@ -137,8 +139,8 @@ shp_tr_dir = input('Directory containing %Y/SHPC_(anti|cyclo): ') for year in range(1993,2019): shp_dir = path.join(shp_tr_dir, f'{year}/SHPC_{orientation}') - extremum[year] = shapefile.Reader(path.join(shp_dir, 'extremum.shp')) - max_speed[year] = shapefile.Reader(path.join(shp_dir, 'max_speed_contour.shp')) + extremum[year] = shapefile.Reader(path.join(shp_dir, 'extremum')) + max_speed[year] = shapefile.Reader(path.join(shp_dir, 'max_speed_contour')) ishape_last[year] = loadtxt(path.join(shp_dir, 'ishape_last.txt'), dtype = int, delimiter = "\n", unpack = False) @@ -147,12 +149,8 @@ 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}') - - # grab the shapefiles - # load the shapefiles and the ishape_last files - print('Loading extrema and ishape_last files.') + print('Loading shapefiles...') max_rcd = {}