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

Polish

parent 4a4c2a05
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
# A script that takes a segmented graph in the gt format and performs the
# non-local cost function calculation where each each will have a cost
# non-local cost function calculation where each edge will have a cost
# function assigned to it.
# Inputs (to be changed within the script):
# Orientation
......@@ -113,7 +113,7 @@ g = graph_tool.Graph()
g.load('segmented.gt')
t1 = time.perf_counter()
print(f'Loading done: {g}')
print(t1 - t0)
print(t1 - t0, "s")
g.set_fast_edge_removal()
......@@ -125,10 +125,6 @@ g.set_fast_edge_removal()
# Load the shapefiles #
#######################
# load the shapefiles and the ishape_last files
print('Loading extrema and ishape_last files.')
# setup the dicts for the shapefiles and the ishape_last files
extremum = {}
max_speed = {}
......@@ -143,7 +139,6 @@ for year in range(1993,2019):
ishape_last[year] = loadtxt(path.join(shp_dir, 'ishape_last.txt'),
dtype = int, delimiter = "\n", unpack = False)
print('Loading of the shapefiles and ishape_last files done.')
# change if there is a change over the number of days to average
num_of_days_to_avg = 7
......@@ -153,6 +148,8 @@ 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.')
ext_shp_rcd = {}
max_rcd = {}
......@@ -168,6 +165,8 @@ for yr in range(1993, 2019):
if (yr <= 2016):
ext_shp_rcd[yr+2] = extremum[yr + 2].shapeRecords()
max_rcd[yr+2] = max_speed[yr + 2].records()
print("Finished reading shapefiles.")
# iterate on the vertices
for n in g.vertices():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment