Raster class methods documentation

Each of the following functions are methods of Raster class.

  1. __abs__
  2. __add__
  3. __eq__
  4. __floordiv__
  5. __ge__
  6. __getitem__
  7. __gt__
  8. __iadd__
  9. __idiv__
  10. __imul__
  11. __init__
  12. __isub__
  13. __le__
  14. __lt__
  15. __mod__
  16. __mul__
  17. __ne__
  18. __neg__
  19. __pow__
  20. __setattr__
  21. __setitem__
  22. __sub__
  23. __truediv__
  24. acos
  25. acosh
  26. asin
  27. asinh
  28. atan
  29. atan2
  30. atanh
  31. ceil
  32. con
  33. configs
  34. cos
  35. cosh
  36. decrement
  37. decrement_row_data
  38. exp
  39. exp2
  40. file_mode
  41. file_name
  42. floor
  43. get_column_from_x
  44. get_data_size_in_bytes
  45. get_row_data
  46. get_row_from_y
  47. get_value
  48. get_value_as_rgba
  49. get_x_from_column
  50. get_y_from_row
  51. increment
  52. increment_row_data
  53. is_nodata
  54. ln
  55. log10
  56. log2
  57. max
  58. min
  59. new_from_other
  60. raster_type
  61. reinitialize_values
  62. set_data_from_raster
  63. set_row_data
  64. set_value
  65. set_value_from_rgba
  66. signum
  67. sin
  68. sinh
  69. size_of
  70. sqrt
  71. square
  72. tan
  73. tanh
  74. to_degrees
  75. to_radians
  76. trunc

__abs__

abs(self)

Function Signature

def __abs__(self) -> Raster: ...

__add__

Return self+value.

Function Signature

def __add__(self, other: Union[Raster, float]) -> Raster: ...

__eq__

Return self==value.

__floordiv__

Return self//value.

Function Signature

def __floordiv__(self, other: Union[Raster, float]) -> Raster: ...

__ge__

Return self>=value.

__getitem__

Return self[key].

Function Signature

def __getitem__(self, index: int) -> VectorGeometry: ...

__gt__

Return self>value.

__iadd__

Return self+=value.

Function Signature

def __iadd__(self, other: Union[Raster, float]) -> None: ...

__idiv__

No documentation found.

Function Signature

def __idiv__(self, other: Union[Raster, float]) -> None: ...

__imul__

Return self*=value.

Function Signature

def __imul__(self, other: Union[Raster, float]) -> None: ...

__init__

Initialize self. See help(type(self)) for accurate signature.

Function Signature

def __init__(self) -> GlobalEncodingField:

__isub__

Return self-=value.

Function Signature

def __isub__(self, other: Union[Raster, float]) -> None: ...

__le__

Return self<=value.

__lt__

Return self<value.

__mod__

Return self%value.

Function Signature

def __mod__(self, other: Union[Raster, float]) -> Raster: ...

__mul__

Return self*value.

Function Signature

def __mul__(self, other: Union[Raster, float]) -> Raster: ...

__ne__

Return self!=value.

__neg__

-self

Function Signature

def __neg__(self) -> Raster: ...

__pow__

Return pow(self, value, mod).

Function Signature

def __pow__(self, other: Union[Raster, float], modulo: float = None) -> Raster: ...

__setattr__

Implement setattr(self, name, value).

__setitem__

Set self[key] to value.

Function Signature

def __setitem__(self, row: int, column: int, value: float) -> None: ...

__sub__

Return self-value.

Function Signature

def __sub__(self, other: Union[Raster, float]) -> Raster: ...

__truediv__

Return self/value.

Function Signature

def __truediv__(self, other: Union[Raster, float]) -> Raster: ...

acos

No documentation found.

Function Signature

def acos(self) -> Raster: ...

acosh

No documentation found.

Function Signature

def acosh(self) -> Raster: ...

asin

No documentation found.

Function Signature

def asin(self) -> Raster: ...

asinh

No documentation found.

Function Signature

def asinh(self) -> Raster: ...

atan

No documentation found.

Function Signature

def atan(self) -> Raster: ...

atan2

No documentation found.

Function Signature

def atan2(self, other: Union[Raster, float]) -> Raster: ...

atanh

No documentation found.

Function Signature

def atanh(self) -> Raster: ...

ceil

No documentation found.

Function Signature

def ceil(self) -> Raster: ...

con

The ConditionalEvaluation tool can be used to perform an if-then-else style conditional evaluation on a raster image on a cell-to-cell basis. The user specifies the names of an input raster image (--input) and an output raster (--output), along with a conditional statement (--statement). The grid cell values in the output image will be determined by the TRUE and FALSE values and conditional statement. The conditional statement is a logical expression that must evaluate to either a Boolean, i.e. TRUE or FALSE. Then depending on how this statement evaluates for each grid cell, the TRUE or FALSE values will be assigned to the corresponding
grid cells of the output raster. The TRUE or FALSE values may take the form of either a constant numerical value or a raster image (which may be the same image as the input). These are specified by the --true and --false parameters, which can be either a file name pointing to existing rasters, or numerical values.

The conditional statement is a single-line logical condition. In addition to the common comparison and logical
operators, i.e. < > <= >= == (EQUAL TO) != (NOT EQUAL TO) || (OR) && (AND) (Note: or, OR, and and AND are also valid operators), conditional statements may contain a number of valid mathematical functions. For example:

 * log(base=10, val) -- Logarithm with optional 'base' as first argument.
 If not provided, 'base' defaults to '10'.
 Example: log(100) + log(e(), 100)

 * e()  -- Euler's number (2.718281828459045)
 * pi() -- π (3.141592653589793)

 * int(val)
 * ceil(val)
 * floor(val)
 * round(modulus=1, val) -- Round with optional 'modulus' as first argument.
     Example: round(1.23456) == 1 && round(0.001, 1.23456) == 1.235

 * abs(val)
 * sign(val)

 * min(val, ...) -- Example: min(1, -2, 3, -4) == -4
 * max(val, ...) -- Example: max(1, -2, 3, -4) == 3

 * sin(radians)    * asin(val)
 * cos(radians)    * acos(val)
 * tan(radians)    * atan(val)
 * sinh(val)       * asinh(val)
 * cosh(val)       * acosh(val)
 * tanh(val)       * atanh(val)

Notice that the constants Pi and e must be specified as functions, pi() and e(). A number of global variables are also available to build conditional statements. These include the following:

Special Variable Names For Use In Conditional Statements:

NameDescription
valueThe grid cell value.
nodataThe input raster's NoData value.
nullSame as nodata.
minvalueThe input raster's minimum value.
maxvalueThe input raster's maximum value.
rowsThe input raster's number of rows.
columnsThe input raster's number of columns.
rowThe grid cell's row number.
columnThe grid cell's column number.
rowyThe row's y-coordinate.
columnxThe column's x-coordinate.
northThe input raster's northern coordinate.
southThe input raster's southern coordinate.
eastThe input raster's eastern coordinate.
westThe input raster's western coordinate.
cellsizexThe input raster's grid resolution in the x-direction.
cellsizeyThe input raster's grid resolution in the y-direction.
cellsizeThe input raster's average grid resolution.

The special variable names are case-sensitive. Each of the special variable names can also be used as valid TRUE or FALSE constant values.

The following are examples of valid conditional statements:

value != 300.0

row > (rows / 2)

value >= (minvalue + 35.0)

(value >= 25.0) && (value <= 75.0)

tan(value * pi() / 180.0) > 1.0

value == nodata

Any grid cell in the input raster containing the NoData value will be assigned NoData in the output raster, unless a NoData grid cell value allows the conditional statement to evaluate to True (i.e. the conditional statement includes the NoData value), in which case the True value will be assigned to the output.

Function Signature

def con(self, con_statement: str, true_raster_or_float: Union[Raster, float, str], false_raster_or_float: Union[Raster, float, str]) -> Raster: ...

configs

Function Signature

def configs(self) -> RasterConfigs: ...

cos

No documentation found.

Function Signature

def cos(self) -> Raster: ...

cosh

No documentation found.

Function Signature

def cosh(self) -> Raster: ...

decrement

No documentation found.

Function Signature

def decrement(self, row: int, column: int, value: float) -> None: ...

decrement_row_data

No documentation found.

Function Signature

def decrement_row_data(self, row: int, values: List[float]) -> None: ...

exp

No documentation found.

Function Signature

def exp(self) -> Raster: ...

exp2

No documentation found.

Function Signature

def exp2(self) -> Raster: ...

file_mode

Function Signature

def file_mode(self) -> str: ...

file_name

Function Signature

def file_name(self, value: str) -> None: ...

floor

No documentation found.

Function Signature

def floor(self) -> Raster: ...

get_column_from_x

No documentation found.

Function Signature

def get_column_from_x(self, x: float) -> int: ...

get_data_size_in_bytes

Returns the size of the pixel data in bytes.

Function Signature

def get_data_size_in_bytes(self) -> int: ...

get_row_data

No documentation found.

Function Signature

def get_row_data(self, row: int) -> List[float]: ...

get_row_from_y

No documentation found.

Function Signature

def get_row_from_y(self, y: float) -> int: ...

get_value

Returns the value contained within a grid cell specified by row and column.

Function Signature

def get_value(self, row: int, column: int) -> float: ...

get_value_as_rgba

No documentation found.

Function Signature

def get_value_as_rgba(self, row: int, column: int) -> Tuple[int, int, int, int]: ...

get_x_from_column

No documentation found.

Function Signature

def get_x_from_column(self, column: int) -> float: ...

get_y_from_row

No documentation found.

Function Signature

def get_y_from_row(self, row: int) -> float: ...

increment

No documentation found.

Function Signature

def increment(self, row: int, column: int, value: float) -> None: ...

increment_row_data

No documentation found.

Function Signature

def increment_row_data(self, row: int, values: List[float]) -> None: ...

is_nodata

No documentation found.

Function Signature

def is_nodata(self) -> Raster: ...

ln

No documentation found.

Function Signature

def ln(self) -> Raster: ...

log10

No documentation found.

Function Signature

def log10(self) -> Raster: ...

log2

No documentation found.

Function Signature

def log2(self) -> Raster: ...

max

No documentation found.

Function Signature

def max(self, other: Union[Raster, float]) -> Raster: ...

min

No documentation found.

Function Signature

def min(self, other: Union[Raster, float]) -> Raster: ...

new_from_other

Creates a new in-memory Raster object with grid extent and location based on an existing Raster contained within file_name.

Function Signature

def new_from_other(other: Raster, data_type: Union[RasterDataType, None]) -> Raster: ...

raster_type

Function Signature

def raster_type(self) -> RasterType: ...

reinitialize_values

No documentation found.

Function Signature

def reinitialize_values(self, value: float) -> None: ...

set_data_from_raster

No documentation found.

Function Signature

def set_data_from_raster(self, other: Raster) -> Union[None, str]: ...

set_row_data

No documentation found.

Function Signature

def set_row_data(self, row: int, values: List[float]) -> None: ...

set_value

No documentation found.

Function Signature

def set_value(self, row: int, column: int, value: float) -> None: ...

set_value_from_rgba

No documentation found.

Function Signature

def set_value_from_rgba(self, row: int, column: int, rgba: Tuple[int, int, int, int]) -> None: ...

signum

Returns a raster that where each cell is assigned a number that represents the sign of the corresponding grid cell in the source raster. The transformation follows the rules below:

  • 1.0 if the number is positive, +0.0 or INFINITY
  • -1.0 if the number is negative, -0.0 or NEG_INFINITY
  • NaN if the number is NaN

Function Signature

def signum(self) -> Raster: ...

sin

No documentation found.

Function Signature

def sin(self) -> Raster: ...

sinh

No documentation found.

Function Signature

def sinh(self) -> Raster: ...

size_of

No documentation found.

Function Signature

def size_of(self) -> int: ...

sqrt

No documentation found.

Function Signature

def sqrt(self) -> Raster: ...

square

No documentation found.

Function Signature

def square(self) -> Raster: ...

tan

No documentation found.

Function Signature

def tan(self) -> Raster: ...

tanh

No documentation found.

Function Signature

def tanh(self) -> Raster: ...

to_degrees

No documentation found.

Function Signature

def to_degrees(self) -> Raster: ...

to_radians

No documentation found.

Function Signature

def to_radians(self) -> Raster: ...

trunc

No documentation found.

Function Signature

def trunc(self) -> Raster: ...