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

Gridding sparse data (fine to coarse) #33

Closed
NicWayand opened this issue Sep 5, 2018 · 3 comments
Closed

Gridding sparse data (fine to coarse) #33

NicWayand opened this issue Sep 5, 2018 · 3 comments

Comments

@NicWayand
Copy link

hi @JiaweiZhuang, I am trying to regrid sparse (~1 km) Ice Bridge data (airborne flight transects) to a coarser 25 km grid, using the new conservative_normed method from your master branch. But I am getting only NaNs out.

Even if there is only one non-NaN fine cell within a coarse cell, it should assign that only fine cell's value to the coarse cell, correct?

A runable example can be found here.

@JiaweiZhuang
Copy link
Owner

In your case, getting all NaNs is the expected, default behavior for most algorithms, as explained in #22 (comment).

To get rid of NaNs, you need to apply masking like #22 (comment). conservative vs conservative_normed only affects the magnitude of the regridding result, not the occurrence of NaNs.

@JiaweiZhuang
Copy link
Owner

There should be a ds_fine['mask'] that masks all cells out of your data trajectory (i.e. all NaNs in the input data).

@NicWayand
Copy link
Author

Ah thanks! I had the ds_target['mask'] but forgot the ds_fine['mask'].

Now getting non-nan values in the coarse grid as expected:
image

However, now all other coarse cells were set to 0, when I would have expected them to be NaN. From past convos I understand this is the expected current behavior.

Using the add offset, mask > offset, subtract offset, workaround works for now but feels a little hacky. Thanks for all the work on #22!

image

aulemahal referenced this issue in Ouranosinc/xESMF Oct 6, 2020
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

2 participants