diff --git a/src/data/profile_features.py b/src/data/profile_features.py index 0860b68..5ed2018 100644 --- a/src/data/profile_features.py +++ b/src/data/profile_features.py @@ -18,9 +18,11 @@ def shapes_from_shp(shp_file): :return: """ shapes = [] - for feat in fiona.open(shp_file): + ids = [] + for feat in fiona.open(shp_file,'r'): shapes.append(shape(feat['geometry'])) - return shapes + ids.append(feat['id']) + return shapes, ids def convert_coord_systems(g1, in_coord_system='EPSG:4326', out_coord_system='EPSG:28356'): @@ -126,12 +128,18 @@ def distance_to_intersection(lat, lon, orientation, line_strings): # todo def get_sites_dune_crest_toe(): + """ + Reads dune crest and toe files and creates a pandas dataframe with crest/toe locations at each site_ + :return: + """ + + # Get site information data_folder = './data/interim' df_sites = pd.read_csv(os.path.join(data_folder, 'sites.csv'), index_col=[0]) - # Import + # Import our dune crest and toes for f in ['./data/raw/profile_features/dune_crests.shp']: - shapes = shapes_from_shp(f) + shapes, _ = shapes_from_shp(f) shapes = [convert_coord_systems(x) for x in shapes] # Iterate through each site