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

Add mask-aware interpolation #198

Open
ph-kev opened this issue Feb 20, 2025 · 1 comment
Open

Add mask-aware interpolation #198

ph-kev opened this issue Feb 20, 2025 · 1 comment

Comments

@ph-kev
Copy link
Member

ph-kev commented Feb 20, 2025

Similar to this issue, it would be nice to have mask-aware interpolation for masking OutputVars and plotting.

@ph-kev
Copy link
Member Author

ph-kev commented Mar 4, 2025

A way to improve the current mask is to change the order of operations. As of now, we uses the mask of ones and NaN and interpolate the mask to match the dimensions of the target OutputVar. This is not a good method because the mask needs to be stored as Float64 (due to the NaN), which limits the resolution of the mask. Furthermore, by having NaN, the NaN poisons the computation when interpolating which results in NaN near the borders.

Another approach for this is to do the following:

  1. Do not modify the mask, so that it is still 0s and 1s.
  2. Interpolate to make a mask with the right dimensions (may need to cast the values of the mask to a type that can represent values between 0 and 1)
  3. Replace the 0 and 1 with the appropriate values such as NaN.
  4. Use broadcasting to multiply the data and create the masked OutputVar.

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