Conversation
Modified from https://notebooksharing.space/view/c6c1f3a7d0c260724115eaa2bf78f3738b275f7f633c1558639e7bbd75b31456#displayOptions= Co-authored-by: Ryan Abernathey <ryan@earthmover.io>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #478 +/- ##
==========================================
- Coverage 85.78% 83.06% -2.73%
==========================================
Files 13 14 +1
Lines 2364 2799 +435
Branches 183 208 +25
==========================================
+ Hits 2028 2325 +297
- Misses 303 423 +120
- Partials 33 51 +18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
In Xvec we could flatten the array and use it as an index instead of latitude and longitude coordinates if there's a use case for that. |
mathause
left a comment
There was a problem hiding this comment.
That looks very promising also for regionmask as we discussed in regionmask/regionmask#499. Is it a general assumption in cf_xarray that your grid is lat/ lon in degree?
| # geopandas needs this | ||
| mask = lonbnd[..., 0] >= 180 | ||
| lonbnd[mask, :] = lonbnd[mask, :] - 360 |
There was a problem hiding this comment.
I think the reason for this is that most geographic data is given in WGS84 which is -180...180 (I may be wrong here). So if you want to compare it to regional polygons it is probably a good idea to wrap the data. Still, it may be confusing to users.
Maybe this could be optional. However, I am not sure what a good name is (In regionmask I call it wrap_lon with the options 180 (= what you do here), 360 and False. That works but there may be better names).
* main: (35 commits) Add release.yml Allow encoding/decoding multiple geometries (#526) Rewrite unit formatter for pint 0.24 and earlier (#523) [pre-commit.ci] pre-commit autoupdate (#527) Add grid_mapping for geometries if possible (#521) Bump pypa/gh-action-pypi-publish from 1.8.14 to 1.9.0 (#524) Bump codecov/codecov-action from 4.4.1 to 4.5.0 (#525) Add geometry encoding and decoding functions. (#517) Bump links to CF-1.11 (#519) Docs cleanup (#518) Bump codecov/codecov-action from 4.3.0 to 4.4.1 (#514) [pre-commit.ci] pre-commit autoupdate (#510) Bump pypa/gh-action-pypi-publish from 1.8.12 to 1.8.14 (#509) Add docs about converting between shapely and cf (#512) Bump codecov/codecov-action from 4.1.0 to 4.3.0 (#511) Fix scheduled nightly upstream test Bump pypa/gh-action-pypi-publish from 1.8.11 to 1.8.12 (#503) Bump codecov/codecov-action from 4.0.0 to 4.1.0 (#504) numpy 2 compat (#505) ruff settings: move 'ignore' to 'lint' section (#506) ...
This converts "bounds" in the 2-element form to an array of shapely polygons, one per grid cell. A step towards nicely packaging conservative regridding for the ecosystem. It could easily be generalized to the 4-element "vertex" form
Modified from
https://notebooksharing.space/view/c6c1f3a7d0c260724115eaa2bf78f3738b275f7f633c1558639e7bbd75b31456#displayOptions=
cc @martinfleis @benbovy @aulemahal for awareness. I'm not sure if this is at all useful for
xvecbut on the off-chance that it is..