Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: print statement in match_neighborhood triggered when nearest neighbor is more than 0.25degC from target window. #101

Open
abigailsnyder opened this issue Sep 5, 2024 · 0 comments
Assignees

Comments

@abigailsnyder
Copy link
Collaborator

This block of code:
https://github.com/JGCRI/stitches/blob/main/stitches/fx_match.py#L314-L352
designed to print a statement if there are target windows more than 0.25degC away from Nearest Neighbor in T-dT space so user knows further validation likely warranted.

Problem:
When match_neighborhood gets called within make_recipe, this print statement causes the same row to repeat several times in the recipe dataframe. gmat_stitching (

def gmat_stitching(rp):
) handles it fine because it's operating on basic dataframes and calls drop duplicates. gridded_stitching does not because it tries to write into the same block of an xarray-structure because there is no drop_duplicates call to the recipe there.

Fix:

  1. have make_recipe (https://github.com/JGCRI/stitches/blob/cb8d6ca10c66292a3824435e12a4335e070946cf/stitches/fx_recipe.py#L1023C5-L1023C17) do a final call to drop duplicates before returning the recipe

  2. revise match_neighborhood block to use a package-messaging specific function rather than print, and streamline so that it is just a single message of words if any target window is further away than 0.25 from its nearest neighbor, rather than printing the data frame every time.

@abigailsnyder abigailsnyder self-assigned this Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant