opendatacube / datacube-core

Open Data Cube analyses continental scale Earth Observation data through time
http://www.opendatacube.org
Apache License 2.0
505 stars 176 forks source link

Inaccurate computation of Lon/Lat bounds in `geobox_info` #537

Closed Kirill888 closed 1 year ago

Kirill888 commented 6 years ago

Expected behaviour

Actual behaviour

Offending code is here:

https://github.com/opendatacube/datacube-core/blob/d561b4a1c8a8dce4c98fd524eca5899e98303241/datacube/model/utils.py#L47-L62

This just transforms 4 points of a bounding rectangle to EPSG:4362

to_lonlat( bounds(valid_data | image_bounds))

this computation sometimes results in smaller bounds than actual, a more proper way to first "increase resolution" of the native polygon, possibly add some buffer, then translate that to EPSG:4326 and then compute envelope of the result. Converting geometry to a different CRS with increased resolution is already supported by datacube.utils.geometry.Geometry class, but we should probably use "higher resolution" than what is currently default (100km)

envelope(polygon(valid_data|image_bounds).to_crs(epsg4326, resolution=1000))
Kirill888 commented 6 years ago

Same problem here:

https://github.com/opendatacube/datacube-core/blob/8b865d2b4aa7a8f6f65c62e6c10a3ca65c8da387/utils/ls_usgs_prepare.py#L94

Kirill888 commented 6 years ago

And pretty much all other prepare scripts too.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Kirill888 commented 4 years ago

pretty sure this bug is still a bug

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Ariana-B commented 1 year ago

native_geobox is only used in ingestion, which will be deprecated in 1.9 and removed in 2.0.