Fix finding z elevation of dune toe/crests

If the x-coordinate specified for the toe/crest does not exist for the profile type, this fixes an issue where the z-elevation of the other profile type was not being correctly calculated. Also, some commented out code is removed.
develop
Chris Leaman 6 years ago
parent 16ca2aa482
commit 1774c15e89

@ -68,7 +68,7 @@ def parse_crest_toes(df_raw_features, df_profiles):
# Try get the value from the other profile if we return nan or empty dataframe # Try get the value from the other profile if we return nan or empty dataframe
df_z = df_profile.loc[idx[site_id, param, x_val], :] df_z = df_profile.loc[idx[site_id, param, x_val], :]
if df_z.empty: if np.isnan(df_z.z):
if param == "prestorm": if param == "prestorm":
new_param = "poststorm" new_param = "poststorm"
elif param == "poststorm": elif param == "poststorm":
@ -77,16 +77,6 @@ def parse_crest_toes(df_raw_features, df_profiles):
else: else:
z_val = df_z.z z_val = df_z.z
# # Try get the value from the other profile if we return nan or empty dataframe
# if df_profile.query(query).empty:
# if param == "prestorm":
# query = query.replace('prestorm', 'poststorm')
# elif param == "poststorm":
# query = query.replace('poststorm', 'prestorm')
# z_val = df_profile.query(query).iloc[0].z
# else:
# z_val = df_profile.query(query).iloc[0].z
# Put results back into merged dataframe # Put results back into merged dataframe
df_crest_toes.loc[(site_id, param), "dune_{}_z".format(loc)] = z_val df_crest_toes.loc[(site_id, param), "dune_{}_z".format(loc)] = z_val

Loading…
Cancel
Save