faninsar.constants.Resampling#

class faninsar.constants.Resampling(*values)[source]#

Bases: IntEnum

Available warp resampling algorithms.

Notes

The first 8, ‘nearest’, ‘bilinear’, ‘cubic’, ‘cubic_spline’, ‘lanczos’, ‘average’, ‘mode’, and ‘gauss’, are available for making dataset overviews.

‘max’, ‘min’, ‘med’, ‘q1’, ‘q3’ are only supported in GDAL >= 2.0.0.

‘nearest’, ‘bilinear’, ‘cubic’, ‘cubic_spline’, ‘lanczos’, ‘average’, ‘mode’ are always available (GDAL >= 1.10).

‘sum’ is only supported in GDAL >= 3.1.

‘rms’ is only supported in GDAL >= 3.3.

Note: ‘gauss’ is not available to the functions in rio.warp.

__init__(*args, **kwds)#

Methods

conjugate

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

bit_count()

Number of ones in the binary representation of the absolute value of self.

to_bytes([length, byteorder, signed])

Return an array of bytes representing an integer.

from_bytes(bytes[, byteorder, signed])

Return the integer represented by the given array of bytes.

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

is_integer()

Returns True.

__init__(*args, **kwds)

Attributes

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

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

not available to the functions in rio.warp.

max

Maximum resampling, selects the maximum value from all non-NODATA contributing pixels.

min

Minimum resampling, selects the minimum value from all non-NODATA contributing pixels.

med

Median resampling, selects the median value of all non-NODATA contributing pixels.

q1

Q1, first quartile resampling, selects the first quartile value of all non-NODATA contributing pixels.

q3

Q3, third quartile resampling, selects the third quartile value of all non-NODATA contributing pixels.

sum

Sum, compute the weighted sum of all non-NODATA contributing pixels.

rms

RMS, root mean square / quadratic mean of all non-NODATA contributing pixels.

as_integer_ratio()#

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
bit_count()#

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
bit_length()#

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
conjugate()#

Returns self, the complex conjugate of any int.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)#

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

is_integer()#

Returns True. Exists for duck type compatibility with float.is_integer.

to_bytes(length=1, byteorder='big', *, signed=False)#

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

average = 5#

Average resampling, computes the weighted average of all non-NODATA contributing pixels.

bilinear = 1#

Bilinear resampling.

cubic = 2#

Cubic resampling.

cubic_spline = 3#

Cubic spline resampling.

denominator#

the denominator of a rational number in lowest terms

gauss = 7#

not available to the functions in rio.warp.

Type:

Gaussian resampling, Note

imag#

the imaginary part of a complex number

lanczos = 4#

Lanczos windowed sinc resampling.

max = 8#

Maximum resampling, selects the maximum value from all non-NODATA contributing pixels. (GDAL >= 2.0)

med = 10#

Median resampling, selects the median value of all non-NODATA contributing pixels. (GDAL >= 2.0)

min = 9#

Minimum resampling, selects the minimum value from all non-NODATA contributing pixels. (GDAL >= 2.0)

mode = 6#

Mode resampling, selects the value which appears most often of all the sampled points.

nearest = 0#

Nearest neighbor resampling (default, fastest algorithm, worst interpolation quality).

numerator#

the numerator of a rational number in lowest terms

q1 = 11#

Q1, first quartile resampling, selects the first quartile value of all non-NODATA contributing pixels. (GDAL >= 2.0)

q3 = 12#

Q3, third quartile resampling, selects the third quartile value of all non-NODATA contributing pixels. (GDAL >= 2.0)

real#

the real part of a complex number

rms = 14#

RMS, root mean square / quadratic mean of all non-NODATA contributing pixels. (GDAL >= 3.3)

sum = 13#

Sum, compute the weighted sum of all non-NODATA contributing pixels. (GDAL >= 3.1)