Improve warp.reproject and enums.Resampling docs (#2166)

* Add inline descriptions from gdalwarp

Add short descriptions of each resampling method from gdalwarp.

If this isn't wanted, alternatively it might be a good idea to add a link to gdalwarp's resampling methods https://gdal.org/programs/gdalwarp.html#cmdoption-gdalwarp-r

* Add enums.Resampling reference to warp.resampling

Add enums.Resampling reference to warp.resampling parameters to try and clarify documentation.

* Remove redundant list

Removing the list of resampling methods, redundant if linking directly to enums.Resampling's list

Also add "int" back in for type

* Moving resampling method details to main docstring

* Update formatting to match docstring styleguide

Update formatting to match docstring styleguide https://numpydoc.readthedocs.io/en/latest/format.html#class-docstring

* Try to fix formatting with Notes section

* Update rasterio/enums.py

Co-authored-by: Sean Gillies <sean.gillies@gmail.com>
This commit is contained in:
Steven Pestana 2021-04-30 09:33:39 -07:00 committed by GitHub
parent b17b2e330e
commit 48af488f9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 15 deletions

View File

@ -27,7 +27,42 @@ class ColorInterp(IntEnum):
class Resampling(IntEnum):
"""Available warp resampling algorithms.
Attributes
----------
nearest
Nearest neighbor resampling (default, fastest algorithm, worst interpolation quality).
bilinear
Bilinear resampling.
cubic
Cubic resampling.
cubic_spline
Cubic spline resampling.
lanczos
Lanczos windowed sinc resampling.
average
Average resampling, computes the weighted average of all non-NODATA contributing pixels.
mode
Mode resampling, selects the value which appears most often of all the sampled points.
gauss
Gaussian resampling, Note: not available to the functions in rio.warp.
max
Maximum resampling, selects the maximum value from all non-NODATA contributing pixels. (GDAL >= 2.0)
min
Minimum resampling, selects the minimum value from all non-NODATA contributing pixels. (GDAL >= 2.0)
med
Median resampling, selects the median value of all non-NODATA contributing pixels. (GDAL >= 2.0)
q1
Q1, first quartile resampling, selects the first quartile value of all non-NODATA contributing pixels. (GDAL >= 2.0)
q3
Q3, third quartile resampling, selects the third quartile value of all non-NODATA contributing pixels. (GDAL >= 2.0)
sum
Sum, compute the weighted sum of all non-NODATA contributing pixels. (GDAL >= 3.1)
rms
RMS, root mean square / quadratic mean of all non-NODATA contributing pixels. (GDAL >= 3.3)
Notes
----------
The first 8, 'nearest', 'bilinear', 'cubic', 'cubic_spline',
'lanczos', 'average', 'mode', and 'gauss', are available for making
dataset overviews.

View File

@ -257,20 +257,9 @@ def reproject(source, destination=None, src_transform=None, gcps=None, rpcs=None
Index of a band to use as the alpha band when warping.
dst_alpha : int, optional
Index of a band to use as the alpha band when warping.
resampling: int
Resampling method to use. One of the following:
Resampling.nearest,
Resampling.bilinear,
Resampling.cubic,
Resampling.cubic_spline,
Resampling.lanczos,
Resampling.average,
Resampling.mode,
Resampling.max (GDAL >= 2.2),
Resampling.min (GDAL >= 2.2),
Resampling.med (GDAL >= 2.2),
Resampling.q1 (GDAL >= 2.2),
Resampling.q3 (GDAL >= 2.2)
resampling: int, rasterio.enums.Resampling
Resampling method to use.
Default is :attr:`rasterio.enums.Resampling.nearest`.
An exception will be raised for a method not supported by the running
version of GDAL.
num_threads : int, optional