ensure compatibility with matplotblib 3.11.0#1228
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1228 +/- ##
==========================================
+ Coverage 89.59% 89.61% +0.01%
==========================================
Files 280 280
Lines 21692 21694 +2
==========================================
+ Hits 19436 19440 +4
+ Misses 2256 2254 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| ### Fixes | ||
| * Improved raster tile alignment by using nearest-pixel rounding during tile reprojection, | ||
| reducing visual offsets between rendered map tiles and dataset coordinates. (#1216) | ||
| * ensure compatibility with matplotlib 3.11.0 (#1219) |
There was a problem hiding this comment.
| * ensure compatibility with matplotlib 3.11.0 (#1219) | |
| * Ensure compatibility with matplotlib 3.11.0 (#1219) |
| stepwise_cm_items.append((value + offset, color)) | ||
| stepwise_cm_items.append((next_value, color)) | ||
| offset = 1e-8 |
There was a problem hiding this comment.
Please explain
- the magic constant used here,
- why this does "ensure compatibility with matplotlib 3.11.0".
Comment in code.
There was a problem hiding this comment.
The offset here stands for a very small value, just large enough to serve to create a difference in floating point numbers. The reason to set it is that when we create a series of stepwise_cm_items, matplotlib since v3.11.0 requires these to be strictly mononically increasing, otherwise an error is thrown and we continue with the fallback code.
I guess it makes sense to call the constant EPSILON to make it clearer.
Another option would have been to try to reimplement the former matplotlib code in xcube, but I preferred this solution.
There was a problem hiding this comment.
Just leave a comment in the code so someone else understands the magic.
| - libgdal-jp2openjpeg | ||
| - mashumaro | ||
| - matplotlib-base >=3.8.3,<3.11.0 # see Issue #1219 | ||
| - matplotlib-base >=3.8.3 |
There was a problem hiding this comment.
| - matplotlib-base >=3.8.3 | |
| - matplotlib-base >=3.8.3,<4 |
…b-3.11.0-compatibility
…b-3.11.0-compatibility # Conflicts: # CHANGES.md
Solves #1219. The issue is that since matplotlib 3.11.0 color map values need to be given in a strictly ascending order; in our declaration of stepwise categorical color maps we state values as end points for one range and start points for the next one. I added a small value to the beginning of a range, so there is a tiny increase.
Checklist:
[ ] Add unit tests and/or doctests in docstrings[ ] Add docstrings and API docs for any new/modified user-facing classes and functions[ ] New/modified features documented indocs/source/*CHANGES.md