fix: resolve xarray FacetGrid DeprecationWarning in plot_example.py#482
fix: resolve xarray FacetGrid DeprecationWarning in plot_example.py#482sohampatil01-svg wants to merge 2 commits intomllam:mainfrom
Conversation
|
@sohampatil01-svg thanks, please create a corresponding issue, first. and also revert to the original PR template |
"Hi @sadamov , thank you for the feedback! I have now created a corresponding issue for this bug (#485) and updated the PR description using the project's original template. Please let me know if any further changes are needed." |
|
@sohampatil01-svg |
|
"Thank you for the catch, @kshirajahere! I have now updated the PR body to include the missing sections and matched the exact formatting of the template. Please let me know if everything looks correct now." |
There was a problem hiding this comment.
The template requires a fixes entry. Please add to CHANGELOG.md under [unreleased] > Fixed:
- Replace deprecated `FacetGrid.axes` with `FacetGrid.axs` in `plot_example_from_datastore` to silence xarray DeprecationWarning (>= 2022.11) [\#482](https://github.com/mllam/neural-lam/pull/482) @sohampatil01-svg
| ) | ||
| for ax in g.axes.flat: | ||
| for ax in g.axs.flat: | ||
| ax.coastlines() |
There was a problem hiding this comment.
g.axs was added in xarray 2022.11. xarray has no lower bound in pyproject.toml, so older installs will get an AttributeError rather than just a warning. A one-line shim covers both old and new xarray without touching dependencies:
| ax.coastlines() | |
| for ax in getattr(g, "axs", g.axes).flat: |
Describe your changes
Fixes a
DeprecationWarningencountered during testing and plotting by replacing the deprecatedg.axesattribute withg.axson thexarray.plot.FacetGridobject inneural_lam/datastore/plot_example.py. This aligns the codebase with newer versions ofxarray(>= 2022.11) which match matplotlib'splt.subplotsstandard.No new dependencies are required.
Issue Link
closes #485
Type of change
Checklist before requesting a review
pullwith--rebaseoption if possible).Checklist for reviewers
Each PR comes with its own improvements and flaws. The reviewer should check the following:
Author checklist after completed review
reflecting type of change (add section where missing):
Checklist for assignee