|
|
|
@ -200,7 +200,7 @@ def parse_profiles_and_sites(profiles_mat):
|
|
|
|
|
|
|
|
|
|
# Our z values can come from these columns, depending on the isgood flag.
|
|
|
|
|
# Let's reoganise them into a list of list
|
|
|
|
|
z_names = ["Zpre", 'Zpost', 'Zrec1', 'Zrec2', 'Zrec3', 'Zrec4']
|
|
|
|
|
z_names = ["Zpre", "Zpost", "Zrec1", "Zrec2", "Zrec3", "Zrec4"]
|
|
|
|
|
z_cols = [mat_data[col] for col in z_names]
|
|
|
|
|
z_sites = []
|
|
|
|
|
for cols in zip(*z_cols):
|
|
|
|
@ -226,8 +226,6 @@ def parse_profiles_and_sites(profiles_mat):
|
|
|
|
|
# Want to calculation the orientation
|
|
|
|
|
orientation = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for x, lat, lon, z_site, easting, northing in zip(
|
|
|
|
|
mat_data["x"][i],
|
|
|
|
|
mat_data["lats"][i],
|
|
|
|
@ -237,13 +235,12 @@ def parse_profiles_and_sites(profiles_mat):
|
|
|
|
|
mat_data["northings"][i],
|
|
|
|
|
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
profile_type = None
|
|
|
|
|
for j, is_good in enumerate([1] + mat_data["isgood"][i]):
|
|
|
|
|
|
|
|
|
|
# Assumes the first profile is always good and is the prestorm profike
|
|
|
|
|
if j == 0:
|
|
|
|
|
profile_type = 'prestorm'
|
|
|
|
|
profile_type = "prestorm"
|
|
|
|
|
z = z_site[j]
|
|
|
|
|
land_lim = np.nan
|
|
|
|
|
|
|
|
|
@ -253,7 +250,7 @@ def parse_profiles_and_sites(profiles_mat):
|
|
|
|
|
|
|
|
|
|
# Takes the first isgood profile as the post storm profile
|
|
|
|
|
else:
|
|
|
|
|
profile_type = 'poststorm'
|
|
|
|
|
profile_type = "poststorm"
|
|
|
|
|
z = z_site[j]
|
|
|
|
|
land_lim = mat_data["landlims"][i][j]
|
|
|
|
|
|
|
|
|
@ -287,10 +284,9 @@ def parse_profiles_and_sites(profiles_mat):
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Stop looking at profiles if we've got our post-storm profile
|
|
|
|
|
if profile_type == 'poststorm':
|
|
|
|
|
if profile_type == "poststorm":
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
orientation = math.degrees(
|
|
|
|
|
math.atan2(
|
|
|
|
|
orientation["land_northing"] - orientation["sea_northing"],
|
|
|
|
@ -334,8 +330,7 @@ def remove_zeros(df_profiles):
|
|
|
|
|
)
|
|
|
|
|
df_profile = df_profiles[idx_site]
|
|
|
|
|
x_last_ele = df_profile[df_profile.z == 0].index.get_level_values("x")[0]
|
|
|
|
|
df_profiles.loc[idx_site & (df_profiles.index.get_level_values("x") > x_last_ele),
|
|
|
|
|
"z"] = np.nan
|
|
|
|
|
df_profiles.loc[idx_site & (df_profiles.index.get_level_values("x") > x_last_ele), "z"] = np.nan
|
|
|
|
|
logger.info("Removed zeros from end of profiles")
|
|
|
|
|
|
|
|
|
|
return df_profiles
|
|
|
|
|