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

Allow 'nearest_dtos' 2-d regridding to work with discrete sampling geometry source grids #833

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

davidhassell
Copy link
Collaborator

Fixes #832

@davidhassell davidhassell added enhancement New feature or request regridding Relating to regridding operations labels Nov 5, 2024
@davidhassell davidhassell added this to the NEXT VERSION milestone Nov 5, 2024
Copy link
Member

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

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

One question mostly for my understanding, but overall this is great and will be really useful for VISION work. Please merge once you've fixed one typo. Thanks.

src = src.copy()
src[6:8] = cf.masked
# This following element should be smaller, because it
# now only has two source cells conrtibuting to it,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# now only has two source cells conrtibuting to it,
# now only has two source cells contributing to it,

elif method == "nearest_dtos":
# 3) Nearest neighbour dtos method:
#
# Set to 0 any weight that corresponds to a masked source
Copy link
Member

Choose a reason for hiding this comment

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

To check my understanding of this via the maths, am I correct in deducing that the ultimate dot product deals with the fact that, if we set to zero for masked source points (which is the only sensible option IMO so I agree is the way) then we are effectively using less points as sources, i.e. instead of shape (J, I) weights matrix as described here:

    weights: `scipy.sparse.spmatrix`
       The sparse weights matrix that defines the regridding
       operation. Might be modified (not in-place) to account for
       missing data in *a*. Must have shape ``(J, I)``, where
       ``J`` is the number of destination grid cells and ``I`` is
       the number of source grid cells. 

we now really have (J, I - M) where M is the number of masked source points? So I can convince myself the reduction in total source points is accounted for in the calculation. Reminding myself about dot products I think it will, but it would be good to get confirmation. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request regridding Relating to regridding operations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow 'nearest_dtos' 2-d regridding to work with discrete sampling geometry source grids
2 participants