Reference documentation

pcraster._pcraster.cellvalue(*args, **kwargs)

Overloaded function.

  1. cellvalue(map: pcraster._pcraster.Field, index: int) -> tuple

    Return a cell value from a map.

    map – Map you want to query.

    index – Linear index of a cell in the map, ranging from

    [1, number-of-cells].

    Returns a tuple with two elements: the first is the cell value, the second is a boolean value which shows whether the first element, is valid or not. If the second element is False, the cell contains a missing value.

    See also: cellvalue(map, row, col)

  2. cellvalue(map: pcraster._pcraster.Field, row: int, col: int) -> tuple

    Return a cell value from a map.

    map – Map you want to query.

    row – Row index of a cell in the map, ranging from [1, number-of-rows].

    col – Col index of a cell in the map, ranging from [1, number-of-cols].

    Returns a tuple with two elements: the first is the cell value, the second is a boolean value which shows whether the first element, is valid or not. If the second element is False, the cell contains a missing value.

    See also: cellvalue(map, index)

pcraster._pcraster.cellvalue_by_coordinates(map: pcraster._pcraster.Field, xcoordinate: float, ycoordinate: float) tuple

Return a cell value from a map.

map – Map you want to query.

xcoordinate – x coordinate of the point.

ycoordinate – y coordinate of the point.

Returns a tuple with two elements: the first is the cell value, the second is a boolean value which shows whether the first element, is valid or not. If the second element is False, the cell contains a missing value.

Note that no check on coordinate reference systems is performed.

New in version 4.3.

pcraster._pcraster.cellvalue_by_index(map: pcraster._pcraster.Field, index: int) tuple

Return a cell value from a map.

map – Map you want to query.

index – Linear index of a cell in the map, ranging from

[0, number-of-cells].

Returns a tuple with two elements: the first is the cell value, the second is a boolean value which shows whether the first element, is valid or not. If the second element is False, the cell contains a missing value.

New in version 4.3.

pcraster._pcraster.cellvalue_by_indices(map: pcraster._pcraster.Field, row: int, col: int) tuple

Return a cell value from a map.

map – Map you want to query.

row – Row index of a cell in the map, ranging from [0, number-of-rows].

col – Col index of a cell in the map, ranging from [0, number-of-cols].

Returns a tuple with two elements: the first is the cell value, the second is a boolean value which shows whether the first element, is valid or not. If the second element is False, the cell contains a missing value.

New in version 4.3.

pcraster._pcraster.clone() geo::RasterSpace

Returns the clone RasterSpace object

pcraster._pcraster.maptotal(arg0: pcraster._pcraster.Field) pcraster._pcraster.Field
pcraster._pcraster.readmap(arg0: str) pcraster._pcraster.Field

Read a map.

filename – Filename of a PCRaster map to read.

pcraster._pcraster.report(*args, **kwargs)

Overloaded function.

  1. report(arg0: str, arg1: str) -> None

    Write data from a file to a file.

    filename – Filename of data you want to open and write. filename – Filename to use.

  2. report(arg0: pcraster._pcraster.Field, arg1: str) -> None

    Write a map to a file.

    map – Map you want to write. filename – Filename to use.

pcraster._pcraster.setclone(*args, **kwargs)

Overloaded function.

  1. setclone(arg0: str) -> None

    Set the clone properties from an existing raster. Only the PCRaster file format is supported as input argument.

    map – Filename of clone map.

  2. setclone(arg0: int, arg1: int, arg2: float, arg3: float, arg4: float) -> None

    Set the clone using clone properties.

    nrRows – Number of rows.

    nrCols – Number of columns.

    cellSize – Cell size.

    west – Coordinate of west side of raster.

    north – Coordinate of north side of raster.

pcraster._pcraster.setglobaloption(arg0: str) None

Set the global option. The option argument must not contain the leading dashes as used on the command line of pcrcalc.

Python example:

setglobaloption(“unitcell”)

The pcrcalc equivalent:

pcrcalc –unitcell -f model.mod

pcraster._pcraster.setrandomseed(seed: int) None

Set the random seed.

seed – An integer value >= 0. If the seed is 0 then the seed is taken

from the current time.

pcraster._pcraster.version_tuple() tuple

Returns the PCRaster version as tuple (major, minor, patch)

New in version 4.3.

class pcraster._pcraster.RasterSpace
cellSize(self: pcraster._pcraster.RasterSpace) float

Returns cell size

north(self: pcraster._pcraster.RasterSpace) float

Returns north coordinate

nrCols(self: pcraster._pcraster.RasterSpace) int

Returns number of columns

nrRows(self: pcraster._pcraster.RasterSpace) int

Returns number of rows

west(self: pcraster._pcraster.RasterSpace) float

Returns west coordinate

pcraster.numpy_operations.numpy2pcr(dataType, array, mv)

Convert entities from NumPy to PCRaster.

dataType – Either Boolean, Nominal, Ordinal, Scalar, Directional or Ldd.

array – Array you want to convert.

mv – Value that identifies a missing value in the array.

Returns a map.

pcraster.numpy_operations.pcr2numpy(map, mv)

Convert entities from PCRaster to NumPy.

map – Map you want to convert.

mv – Value to use in the result array cells as a missing value.

Returns an array.

pcraster.numpy_operations.pcr_as_numpy(map)

Reference PCRaster maps from NumPy arrays.

map – Map to reference.

Returns an array.

pcraster.aguila.aguila(*arguments, **keywords)

Each argument is taken to be a raster or a list of rasters. Each raster should be the name of a raster file on disk or a variable resulting from a PCRaster operation.

Individual rasters end up in separate visualisation windows. The rasters from a list of rasters ends in a single visualisation window.

pcraster.matplotlib.plot(raster, labels=None, title=None, filename=None)

raster: Raster map with type of either Boolean, Nominal, Scalar, or Ldd.

labels: Optional. Dictionary of labels that should be used for the legend, cell values will be used otherwise.

title: Optional. Legend title, tries to identify the variable name otherwise.

filename: Optional. If provided plot will be written to disk.

Creates a plot of a PCRaster map using matplotlib. The plot is either opened in a separate window, or written to disk in case a filename is provided.

New in version 4.3.

Note

This function is only available when the matplotlib module is installed.