|
|
@ -13,7 +13,7 @@ from shapely.ops import transform
|
|
|
|
|
|
|
|
|
|
|
|
def shapes_from_shp(shp_file):
|
|
|
|
def shapes_from_shp(shp_file):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Parses a shape file and returns a list of shapely shapes
|
|
|
|
Parses a shape file and returns a list of shapely shapes, ids and properties
|
|
|
|
:param shp_file:
|
|
|
|
:param shp_file:
|
|
|
|
:return:
|
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
"""
|
|
|
@ -158,27 +158,23 @@ def beach_profile_elevation(x_coord, df_profiles, profile_type, site_id):
|
|
|
|
return np.interp(x_coord, df_profile.index.get_level_values('x'), df_profile['z'])
|
|
|
|
return np.interp(x_coord, df_profile.index.get_level_values('x'), df_profile['z'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# todo
|
|
|
|
def parse_profile_features(df_sites, df_profiles, dune_crest_shp, dune_toe_shp):
|
|
|
|
def get_sites_dune_crest_toe():
|
|
|
|
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Reads dune crest and toe files and creates a pandas dataframe with crest/toe locations at each site_
|
|
|
|
Reads dune crest and toe files and creates a pandas dataframe with crest/toe locations at each site
|
|
|
|
:return:
|
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
# Get site information. Base our profile features on each site
|
|
|
|
# Get site information. Base our profile features on each site
|
|
|
|
data_folder = './data/interim'
|
|
|
|
|
|
|
|
df_sites = pd.read_csv(os.path.join(data_folder, 'sites.csv'), index_col=[0])
|
|
|
|
|
|
|
|
df_profiles = pd.read_csv(os.path.join(data_folder, 'profiles.csv'), index_col=[0, 1, 2])
|
|
|
|
|
|
|
|
df_profile_features = df_sites
|
|
|
|
df_profile_features = df_sites
|
|
|
|
|
|
|
|
|
|
|
|
features = {
|
|
|
|
features = {
|
|
|
|
'dune_crest':
|
|
|
|
'dune_crest':
|
|
|
|
{
|
|
|
|
{
|
|
|
|
'file': './data/raw/profile_features/dune_crests.shp'
|
|
|
|
'file': dune_crest_shp
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'dune_toe':
|
|
|
|
'dune_toe':
|
|
|
|
{
|
|
|
|
{
|
|
|
|
'file': './data/raw/profile_features/dune_toes.shp'
|
|
|
|
'file': dune_toe_shp
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -206,6 +202,16 @@ def get_sites_dune_crest_toe():
|
|
|
|
row.name),
|
|
|
|
row.name),
|
|
|
|
axis=1)
|
|
|
|
axis=1)
|
|
|
|
|
|
|
|
|
|
|
|
df_profile_features = df_profile_features.drop(columns=['beach', 'lat','lon','orientation'])
|
|
|
|
df_profile_features = df_profile_features.drop(columns=['beach', 'lat', 'lon', 'orientation'])
|
|
|
|
df_profile_features.to_csv('./data/interim/profile_features.csv')
|
|
|
|
return df_profile_features
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
|
|
|
data_folder = './data/interim'
|
|
|
|
|
|
|
|
df_sites = pd.read_csv(os.path.join(data_folder, 'sites.csv'), index_col=[0])
|
|
|
|
|
|
|
|
df_profiles = pd.read_csv(os.path.join(data_folder, 'profiles.csv'), index_col=[0, 1, 2])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dune_crest_shp = './data/raw/profile_features/dune_crests.shp'
|
|
|
|
|
|
|
|
dune_toe_shp = './data/raw/profile_features/dune_toes.shp'
|
|
|
|
|
|
|
|
df_profile_features = parse_profile_features(df_sites, df_profiles, dune_crest_shp, dune_toe_shp)
|
|
|
|
|
|
|
|
df_profile_features.to_csv('./data/interim/profile_features.csv')
|
|
|
|