def test_double_cols(csv_path, func_name): df = pd.read_csv(csv_path, delimiter='|', header=None) data_shapely_1 = df[0].apply(shapely.wkt.loads) data_shapely_2 = df[1].apply(shapely.wkt.loads) data_col1 = gpd.GeoSeries(data_shapely_1) data_col2 = gpd.GeoSeries(data_shapely_2) start_time = time.time() try: exec("data_col1.%s(data_col2)" % func_name) except AttributeError: print("geopandas has no attribute ", func_name) pass end_time = time.time() with open( output_path + "/geopandas/" + data_num_path + "/" + func_name + ".txt", 'a+') as f: f.writelines("geopandas %s time is:" % func_name + str(end_time - start_time) + "\n") arctern_data_col1 = arctern.GeoSeries(df[0]) arctern_data_col2 = arctern.GeoSeries(df[1]) start_time = time.time() try: exec("arctern_data_col1.%s(arctern_data_col2)" % func_name) except AttributeError: print("arctern has no attribute ", func_name) pass end_time = time.time() with open( output_path + "/arctern/" + data_num_path + "/" + func_name + ".txt", 'a+') as f: f.writelines("arctern %s time is:" % func_name + str(end_time - start_time) + "\n")
def test_simplify_preserve_topology(csv_path, func_name): df = pd.read_csv(csv_path, delimiter='|', header=None) data_shapely = df[0].apply(shapely.wkt.loads) data = gpd.GeoSeries(data_shapely) start_time = time.time() try: exec("data.simplify(1, preserve_topology=True)") except AttributeError: print("geopandas has no attribute ", func_name) pass end_time = time.time() with open( output_path + "/geopandas/" + data_num_path + "/" + func_name + ".txt", 'a+') as f: f.writelines("geopandas %s time is:" % func_name + str(end_time - start_time) + "\n") arctern_data = arctern.GeoSeries(df[0]) start_time = time.time() try: exec("arctern_data.simplify_preserve_to_pology(1)") except AttributeError: print("arctern has no attribute ", func_name) pass end_time = time.time() with open( output_path + "/arctern/" + data_num_path + "/" + func_name + ".txt", 'a+') as f: f.writelines("arctern %s time is:" % func_name + str(end_time - start_time) + "\n")
def test_buffer(csv_path, func_name): df = pd.read_csv(csv_path, delimiter='|', header=None) data_shapely = df[0].apply(shapely.wkt.loads) data = gpd.GeoSeries(data_shapely) start_time = time.time() try: exec("data.buffer(1.2, resolution=30)") except AttributeError: print("geopandas has no attribute ", func_name) pass end_time = time.time() with open( output_path + "/geopandas/" + data_num_path + "/" + func_name + ".txt", 'a+') as f: f.writelines("geopandas %s time is:" % func_name + str(end_time - start_time) + "\n") arctern_data = arctern.GeoSeries(df[0]) start_time = time.time() try: exec("arctern_data.buffer(1.2).to_wkt()") except AttributeError: print("arctern has no attribute ", func_name) pass end_time = time.time() with open( output_path + "/arctern/" + data_num_path + "/" + func_name + ".txt", 'a+') as f: f.writelines("arctern %s time is:" % func_name + str(end_time - start_time) + "\n")
def test_single_col_2(csv_path, func_name): df = pd.read_csv(csv_path, delimiter='|', header=None) print("geopandas has no attribute ", func_name) arctern_data = arctern.GeoSeries(df[0]) start_time = time.time() try: exec("arctern_data.%s()" % func_name) except AttributeError: print("arctern has no attribute ", func_name) pass end_time = time.time() with open( output_path + "/arctern/" + data_num_path + "/" + func_name + ".txt", 'a+') as f: f.writelines("arctern %s time is:" % func_name + str(end_time - start_time) + "\n")