Skip to content

Commit

Permalink
improve identification of variables to be matched up
Browse files Browse the repository at this point in the history
  • Loading branch information
robertjwilson committed Jun 13, 2024
1 parent fd932eb commit 15ae5b3
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions ecoval/matchall.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,17 +943,43 @@ def write_report(x):
point_bottom = [x for x in point_bottom if x in valid_bottom]
surface = [x for x in surface if x in valid_surface]

vars_available = list(
all_df
# drop rows where pattern is None
.dropna()
# get all variables
.variable

)
surface = [x for x in surface if x in vars_available]
point_surface = [x for x in point_surface if x in vars_available]
point_bottom = [x for x in point_bottom if x in vars_available]
point_benthic = [x for x in point_benthic if x in vars_available]
var_chosen = surface + bottom + point_benthic + point_bottom + point_surface
var_chosen = list(set(var_chosen))
if mapping is not None:
if True:

# add the global checker here
# sort all_df alphabetically by variable
all_df = all_df.sort_values("variable").reset_index(drop=True)
surface.sort()
point_surface.sort()
point_bottom.sort()
point_benthic.sort()
# ensure variables are in all_df.variable
vars_available = list(
all_df
# drop rows where pattern is None
.dropna()
# get all variables
.variable

)
surface = [x for x in surface if x in vars_available]
point_surface = [x for x in point_surface if x in vars_available]
point_bottom = [x for x in point_bottom if x in vars_available]
point_benthic = [x for x in point_benthic if x in vars_available]
print("Variables that will be matched up")
print("******************************")
if len(surface) > 0:
Expand Down

0 comments on commit 15ae5b3

Please sign in to comment.