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

Fixes xesmf flag #374

Merged
merged 2 commits into from
Oct 25, 2022
Merged

Fixes xesmf flag #374

merged 2 commits into from
Oct 25, 2022

Conversation

jasonb5
Copy link
Collaborator

@jasonb5 jasonb5 commented Oct 21, 2022

Description

Fixes ignore_degenerate not being passed through to xESMF regridder object.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

If applicable:

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass with my changes (locally and CI/CD build)
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have noted that this is a breaking change for a major release (fix or feature that would cause existing functionality to not work as expected)

@jasonb5
Copy link
Collaborator Author

jasonb5 commented Oct 21, 2022

This should resolve issues with curvilinear grids not working (#339).

@tomvothecoder tomvothecoder added type: bug Inconsistencies or issues which will cause an issue or problem for users or implementors. Priority: High labels Oct 24, 2022
Copy link
Collaborator

@tomvothecoder tomvothecoder left a comment

Choose a reason for hiding this comment

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

LGTM as far as code changes. @pochedls can you test out the functionality is working as expected?

Once this is done, feel free to merge this PR @jasonb5.

Comment on lines +441 to +451
@pytest.mark.parametrize(
"name,value,attr_name",
[
("periodic", True, "_periodic"),
("extrap_method", "inverse_dist", "_extrap_method"),
("extrap_method", "nearest_s2d", "_extrap_method"),
("extrap_dist_exponent", 0.1, "_extrap_dist_exponent"),
("extrap_num_src_pnts", 10, "_extrap_num_src_pnts"),
("ignore_degenerate", False, "_ignore_degenerate"),
],
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I didn't know this pytest decorator exists. This is neat for easily testing different function/method parameters!

Copy link
Collaborator

@pochedls pochedls left a comment

Choose a reason for hiding this comment

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

This resolves most of the curvilinear gridding issues. I do not have an exact match with CDAT, but when I spot-checked the grid cell differences were order 10$^{-5}$. In looking at 58 models, 9 had issues, but they appeared to be known issues (I think compared to more than 30 exceptions before?):

Error Instances
TypeError: buffer is too small for requested array 1
KeyError: "Receive multiple variables for key 'longitude': {'lon', 'longitude'}. Expected only one. Please pass a list ['longitude'] instead to get all variables matching 'longitude'." 2
KeyError: 'lon_b' 3
ValueError: Bounds format not understood. Got ('nj', 'ni', 'vertices') with shape (384, 320, 2). 1
KeyError: "No results found for 'longitude'." 1
xarray.core.merge.MergeError: conflicting values for variable 'vertices_latitude' on objects to be combined. You can skip this check by specifying compat='override'. 1

I think this PR is good to go. Thanks for sorting this out @jasonb5!

@jasonb5 jasonb5 merged commit 41bde88 into xCDAT:main Oct 25, 2022
@jasonb5 jasonb5 deleted the fix_xesmf_flag branch October 25, 2022 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Support regridding for curvilinear grid
3 participants