diff --git a/src/data/profile_features.py b/src/data/profile_features.py index 5825b43..3aa0c66 100644 --- a/src/data/profile_features.py +++ b/src/data/profile_features.py @@ -139,6 +139,25 @@ def distance_to_intersection(lat, lon, landward_orientation, beach, line_strings # If no intersections are found, return nothing. return None + +def beach_profile_elevation(x_coord, df_profiles, profile_type, site_id): + """ + Returns the beach profile elevation at a particular x-coordinate + :param x_coord: + :param df_profiles: + :param profile_type: "prestorm" or "poststorm" + :param site_id: + :return: + """ + + if np.isnan(x_coord): + return None + + # Get profile + df_profile = df_profiles.query('profile_type == "{}" and site_id =="{}"'.format(profile_type, site_id)) + return np.interp(x_coord, df_profile.index.get_level_values('x'), df_profile['z']) + + # todo def get_sites_dune_crest_toe(): """