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