-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move raster footprint functionality into a class #396
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we should deprecate the free functions now? Or wait until a later time? Also, looks like rasterio 1.3.5.post1 changed how some subdatasets are named: https://github.com/stac-utils/stactools/actions/runs/4156577655/jobs/7190456348#step:5:32? That feels strange to me...
We don't have an explicit deprecation policy, but IMO it's best to give at least one release cycle for the deprecations to kick in. So depreacted in 0.4.4, removal planned for 0.6.
I think the problem was due to using rasterio wheels rather than building from scratch (f75b36c). I agree that the test is a bit fragile but #401 should fix it. |
- supplements existing raster footprint with new densification method and projection to lon/lat that does not wrap longitudes
- 2 subclasses: default and sinusoidal
- add instance creation methods - remove sinusoidal class
- return `cls` rather than `RasterFootprint` from a classmethod
- Removes doc and docstring edits to the round utility, which are more appropriately addressed in a new PR.
b1da2a7
to
1cf6803
Compare
- update cli to use new RasterFootprint class method - test densification methods
Updated Description
Related Issue(s):
None.
Description:
The raster footprint utility often produces incorrect geometry polygons when the data spans the edge of the sinusoidal projection used by MODIS and VIIRS. A fix requires an alternative densification approach and a custom reprojection function. There is currently no convenient way to override these steps in the raster footprint utility since they are: 1) bundled into a single function (
densify_reproject_simplify
) and 2) that function exists at the end of a chain of function calls.This PR replicates the functionality of the raster footprint utility in a class (named
RasterFootprint
) with an eye toward subclassing for selective method overrides. In addition to breaking out individual methods for the densify, reproject, and simplify steps, alternative constructors are provided for footprint creation directly from an href or from a file opened with rasterio (a rasterio DatasetReader object). An alternative densification function is also provided; you can now choose to densify by factor or by distance.The existing raster footprint functions are retained, but marked as deprecated. Their functionality is fully contained in the new
RasterFootprint
class and the functions themselves now rely onRasterFootprint
.PR checklist:
scripts/format
).scripts/lint
).scripts/test
).Original Description (for context)
Related Issue(s):
None.
Description:
The raster footprint utility often produces incorrect and globe-spanning geometry polygons when the data is on the edge of the sinusoidal projection used by MODIS and VIIRS.
This PR provides a fix to create correct raster footprints at the edges of the sinusoidal projection.
Approach:
abs(longitude)
value greater than180
. This should be able to be done without the custom projection equations, but I am unable to forceproj
to not wrap the longitude coordinates.Notes:
sinusoidal_pixel_to_grid
function inprojection.py
. It will be used by the MODIS stactools-package and it seemed natural to place it alongside the newsinusoidal_grid_to_lonlat
function._densify()
to_densify_by_factor()
. The name parallels the new_densify_by_distance()
function used by the sinusoidal class.Example:
Current, incorrect behavior (pink) for an h01v11 MODIS tile (MCD15A2H.A2022025.h01v11.061):
Proposed, correct behavior (green) via this PR for the same MODIS tile: