From 1774c15e89db021478839a535f4ae56d2432da2c Mon Sep 17 00:00:00 2001 From: Chris Leaman Date: Thu, 7 Mar 2019 12:53:57 +1100 Subject: [PATCH] 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. --- src/data/parse_mat.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/data/parse_mat.py b/src/data/parse_mat.py index 437a29b..f1ed72b 100644 --- a/src/data/parse_mat.py +++ b/src/data/parse_mat.py @@ -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 df_z = df_profile.loc[idx[site_id, param, x_val], :] - if df_z.empty: + if np.isnan(df_z.z): if param == "prestorm": new_param = "poststorm" elif param == "poststorm": @@ -77,16 +77,6 @@ def parse_crest_toes(df_raw_features, df_profiles): else: 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 df_crest_toes.loc[(site_id, param), "dune_{}_z".format(loc)] = z_val