-
Notifications
You must be signed in to change notification settings - Fork 37
Enabling target mask for LocStream input #445
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
Enabling target mask for LocStream input #445
Conversation
- Adding function xesmf.smm.post_apply_target_mask_to_weights to zero out weights of masked target grid cells - Adding application of this function to BaseRegridder in the case of LocStream input, Grid output incl. mask - This may lead to unexpected results when not using with nearest_s2d, as the masking is applied *post* weight generation
|
@sol1105 thank you for these 2 contribs, this looks very useful and I'll take a deeper look at the code later next week when I'm back from leave. |
aulemahal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me!
AFAIU, the only methods available when starting from a LocStream are the two nearest directions. And this method wouldn't make sense for "d2s", indeed, so this implementation seems to cover "all" meaningful cases.
|
Ah and same comment as the other PR, could you please add a changelog line ? |
…fxr.bounds_to_vertices
…ue to cfxr.bounds_to_vertices
|
@aulemahal Thanks for dealing with the failing test. When this is merged I can sort out the merge conflicts for #444 Currently, there is still the |
Enabling target masks for LocStream input
LocStreaminput or output, masks are generally filtered/ignored and not handed to ESMF, as ESMF apparently crashes in that casexesmf.smm.post_apply_target_mask_to_weightsto zero out weights of masked target grid cells post weight generationBaseRegridderin the case of all the following conditions being True:LocStreaminputGridoutputgrid_outhaving a mask definednearest_s2d(forLocStreaminput, the only other option would anyways only benearest_d2s)nearest_s2d, which is why the automatic application is restricted to that method. To my understanding, as the masking is applied post weight generation, the resulting weights may differ from the "masking during the weights generation" if the mapping betweensource <--> targetmay be influenced by the location of masked cells. But this would be the case fornearest_d2s.I set this up to allow making use of land-sea-masks when remapping from unstructured grids with the "trick" described in #115 - without land-sea-mask there was undesired extrapolation happening outside the source domain:
Scatter plot of source grid cell locations (AWI-CM-1-1-MR FESOM unstructured ocean model grid)
Remapped result before - even when target mask was defined (
nearest_s2d)Remapped result after - with target mask defined (
nearest_s2d)