|
|
@ -39,12 +39,11 @@ def parse_orientations(orientations_mat):
|
|
|
|
|
|
|
|
|
|
|
|
def combine_sites_and_orientaions(df_sites, df_orientations):
|
|
|
|
def combine_sites_and_orientaions(df_sites, df_orientations):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Replaces beach/lat/lon columns with the unique site_id
|
|
|
|
Replaces beach/lat/lon columns with the unique site_id.
|
|
|
|
:param dfs:
|
|
|
|
:param dfs:
|
|
|
|
:param df_sites:
|
|
|
|
:param df_sites:
|
|
|
|
:return:
|
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
df_merged_sites = df_sites.merge(df_orientations[['beach', 'lat_center', 'lon_center', 'orientation']],
|
|
|
|
df_merged_sites = df_sites.merge(df_orientations[['beach', 'lat_center', 'lon_center', 'orientation']],
|
|
|
|
left_on=['beach', 'lat', 'lon'],
|
|
|
|
left_on=['beach', 'lat', 'lon'],
|
|
|
|
right_on=['beach', 'lat_center', 'lon_center'])
|
|
|
|
right_on=['beach', 'lat_center', 'lon_center'])
|
|
|
@ -54,8 +53,20 @@ def combine_sites_and_orientaions(df_sites, df_orientations):
|
|
|
|
if n_unmatched > 0:
|
|
|
|
if n_unmatched > 0:
|
|
|
|
logger.warning('Not all records (%d of %d) matched with an orientation', n_unmatched, len(df_sites))
|
|
|
|
logger.warning('Not all records (%d of %d) matched with an orientation', n_unmatched, len(df_sites))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Drop extra columns
|
|
|
|
|
|
|
|
df_merged_sites = df_merged_sites.drop(columns = ['lat_center', 'lon_center'])
|
|
|
|
|
|
|
|
|
|
|
|
return df_merged_sites
|
|
|
|
return df_merged_sites
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def specify_lat_lon_profile_center(df_sites, x_val=200):
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
Specify which x-coordinate in the beach profile cross section the lat/lon corresponds to
|
|
|
|
|
|
|
|
:param df_sites:
|
|
|
|
|
|
|
|
:return:
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
df_sites['profile_x_lat_lon'] = x_val
|
|
|
|
|
|
|
|
return df_sites
|
|
|
|
|
|
|
|
|
|
|
|
def parse_waves(waves_mat):
|
|
|
|
def parse_waves(waves_mat):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Parses the raw waves.mat file and returns a pandas dataframe
|
|
|
|
Parses the raw waves.mat file and returns a pandas dataframe
|
|
|
@ -209,6 +220,7 @@ def main():
|
|
|
|
|
|
|
|
|
|
|
|
logger.info('Combine orientations into sites')
|
|
|
|
logger.info('Combine orientations into sites')
|
|
|
|
df_sites = combine_sites_and_orientaions(df_sites, df_orientations)
|
|
|
|
df_sites = combine_sites_and_orientaions(df_sites, df_orientations)
|
|
|
|
|
|
|
|
df_sites = specify_lat_lon_profile_center(df_sites)
|
|
|
|
|
|
|
|
|
|
|
|
logger.info('Setting pandas index')
|
|
|
|
logger.info('Setting pandas index')
|
|
|
|
df_profiles.set_index(['site_id', 'profile_type', 'x'], inplace=True)
|
|
|
|
df_profiles.set_index(['site_id', 'profile_type', 'x'], inplace=True)
|
|
|
|