pytroll / pyresample

Geospatial image resampling in Python
http://pyresample.readthedocs.org
GNU Lesser General Public License v3.0
344 stars 95 forks source link

Convert AreaDefinitions to odc geoboxes #545

Closed BENR0 closed 8 months ago

BENR0 commented 10 months ago

Convert AreaDefinitions to odc geoboxes (https://odc-geo.readthedocs.io/en/latest/).

codecov[bot] commented 10 months ago

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (e82bf47) 94.06% compared to head (e560f1c) 94.05%.

Files Patch % Lines
pyresample/geometry.py 75.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #545 +/- ## ========================================== - Coverage 94.06% 94.05% -0.01% ========================================== Files 85 85 Lines 13250 13276 +26 ========================================== + Hits 12463 12487 +24 - Misses 787 789 +2 ``` | [Flag](https://app.codecov.io/gh/pytroll/pyresample/pull/545/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pytroll) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/pytroll/pyresample/pull/545/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pytroll) | `94.05% <92.30%> (-0.01%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pytroll#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

coveralls commented 10 months ago

Coverage Status

coverage: 93.642% (-0.002%) from 93.644% when pulling e560f1ced180e529551a6de2897f4ce2015dedf4 on BENR0:feat_to_odc_geobox into e82bf470dae00258231978037455ecb2e133e796 on pytroll:main.

BENR0 commented 10 months ago

Glad that you like it was not sure if it is a valuable addition. I just used it because I was to lazy to create Affine transformations from scratch and was thinking that maybe I can test some stuff for rerprojections and maybe for the html representation.

ghiggi commented 10 months ago

Cool feature @BENR0. I never used the odc-geo tool. But from a quick look @djhoese:

BTW I just opened the PR https://github.com/pytroll/pyresample/pull/546 to streamline the boundary extraction

djhoese commented 10 months ago

does not support swath definition data

Sure, but I think that's the point. They're projected bounding boxes.

I am not sure it currently support areas crossing the antimeridian (@BENR0 could you test the result with GOES-17 AreaDef? area_def = satpy.resample.get_area_def("goes_west_abi_f_1km") The implemented geometry operations are implemented wrapping shapely ... so classical problems ... --> We could maybe use the odc-geo for the get_bbox_lonlats of AreaDefinition. But it's worth?

I would suspect they don't currently support the anti-meridian as that is technically not a valid contiguous space on any CRS. If you have data that crosses the anti-meridian of a CRS then your data can't be represented correctly on that CRS. This is strict and difficult to reconcile in real world applications with data crossing the poles, but it is technically true. I know you have workarounds in your other PRs since we do end up having to deal with it, but I just wanted to point this out.

As for using odc-geo in other methods of the geometry objects: no thank you. Not yet. Not unless it is a clear win for doing calculations. No need for the extra dependency.

djhoese commented 8 months ago

Not that I expected this to happen in this PR, but we really need to come up with a new pattern for conversion of areas to other things. I'm not sure dumping it all in geometry.py is a good idea.