Add beach_profile_elevation function

Gets elevation from an x-coordinate on a beach profile.
master
Chris Leaman 6 years ago
parent 2974b5a897
commit b0f2ca9f4c

@ -139,6 +139,25 @@ def distance_to_intersection(lat, lon, landward_orientation, beach, line_strings
# If no intersections are found, return nothing. # If no intersections are found, return nothing.
return None 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 # todo
def get_sites_dune_crest_toe(): def get_sites_dune_crest_toe():
""" """

Loading…
Cancel
Save