Skip to content

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

@abigailsnyder

Description

@abigailsnyder

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions