Skip to content

add zonal interpolation fill for NaNs#1033

Draft
Arcomano1234 wants to merge 2 commits intomainfrom
feature/zonal-sst-interp-mask
Draft

add zonal interpolation fill for NaNs#1033
Arcomano1234 wants to merge 2 commits intomainfrom
feature/zonal-sst-interp-mask

Conversation

@Arcomano1234
Copy link
Copy Markdown
Contributor

Short description of why the PR is needed and how it satisfies those requirements, in sentence form.

Changes:

  • symbol (e.g. fme.core.my_function) or script and concise description of changes or added feature

  • Can group multiple related symbols on a single bullet

  • Tests added

  • If dependencies changed, "deps only" image rebuilt and "latest_deps_only_image.txt" file updated

Resolves # (delete if none)

Copy link
Copy Markdown
Contributor

@brianhenn brianhenn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, some minor suggestions

Parameters:
method: Type of fill operation. Currently only 'constant' is supported.
value: Value to fill NaNs with.
zonal_interp_variables: Variables to fill via periodic zonal (longitude)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is getting merged it seems like we'd want to add 'zonal_interp` as a method in addition to 'constant' rather than adding a new arg

x = np.arange(flat.shape[-1])
for i in range(flat.shape[0]):
row = flat[i]
mask = np.isnan(row)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is greedy, where does this fall in the call stack relative to where we actually load the tensors? I guess not actually wrong to load data earlier, but a bit confusing in terms of the data model

right = array[..., :pad_width]
padded = np.concatenate([left, array, right], axis=-1)

orig_shape = padded.shape
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit use a different name than "orig" here since it has padding on it

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

Successfully merging this pull request may close these issues.

2 participants