Port models to LUE


See the status of LUE page to find out more about which PCRaster operations already have an equivalent in LUE and which PCRaster Python Framework classes are available in LUE as well.


This module contains wrappers around LUE operations that behave as PCRaster operations as much as possible. This makes it easier to port models that use the PCRaster Python package to use the LUE Python package.

Currently, it is not possible to provide wrappers for all PCRaster operations. In some cases, we can work around missing functionality in LUE by doing things slightly different. This may involve a performance penalty. Over time these workarounds will be removed.

In case a PCRaster operation supports passing in a non-spatial value, but the LUE operation does not, the wrappers will convert the non-spatial values into a spatial value automatically.

In case PCRaster contains an operation which LUE does not, then we try to work around it by using other operations that produce the same results. If no work-around can be used, a NotImplementedError exception is raised.

LUE does not support value scales. The wrappers in this module assume the cell representations used are the PCRaster ones:

  • uint8 for LDD and boolean values

  • int32 for nominal and ordinal values

  • float32 for scalar and directional values

LUE itself supports additional cell represenations (uint32, int64, uint64, float64).

LUE does not have the notion of non-spatial. This is relevant when passing two “non-spatial” arguments to an operator (e.g.: a & b). The regular Python rules are then in effect.

class lue.pcraster.Configuration(array_shape=None, partition_shape=None, cell_size=None)

Class for storing information that is required for LUE to be able to mimic PCRaster

PCRaster makes use of a clone raster. This raster contains information about the shape of the underlying array and the size of the raster cells. This class fulfills the same role.


Translate PCRaster window lengths in real distance units, to LUE window lengths, in whole number of cells

The assumption here is that @a pcraster_window_length passed in: - is dividable by the cell size - corresponds with an odd number of cells (odd_number * cell_size) - is possitive


This module contains classes that mimic the behaviour of the PCRaster Python Framework.

See the PCRaster Python Modelling Framework documentation for more information.

class lue.pcraster.framework.DynamicFramework(model, last_time_step=0, first_time_step=1)

Class for running dynamic models

class lue.pcraster.framework.DynamicModel

Base class for dynamic models

exception lue.pcraster.framework.FrameworkError(message)
class lue.pcraster.framework.MonteCarloFramework(model, nr_samples=0, remove_dirs=True)

Class for running stochastic models

class lue.pcraster.framework.MonteCarloModel

Base class for stochastic models

class lue.pcraster.framework.StaticFramework(model)

Class for running static models

class lue.pcraster.framework.StaticModel

Base class for static models

lue.pcraster.framework.generateNameS(name, sample)

Return a filename based on the name and sample number passed in.

The resulting name contains a directory and a filename part. The sample number is used as the directory name and the name is used as the filename.

The sample number normally ranges from [1, nrSamples].

See also: generateNameT(), generateNameST()

lue.pcraster.framework.generateNameST(name, sample, timestep)

Return a filename based on the name, sample number and time step.

See also: generateNameT(), generateNameS()

lue.pcraster.framework.generateNameT(name, time)

Return a filename based on the name and time step passed in.

The resulting name obeys the 8.3 DOS style format. The time step will be added to the end of the filename and be prepended by 0’s if needed.

The time step normally ranges from [1, nrTimeSteps]. The length of the name should be max 8 characters to leave room for the time step.

The name passed in may contain a directory name.

See also: generateNameS(), generateNameST()