Data conversion to the directional data type

Result = directional(expression)
spatial, non spatial boolean, nominal, ordinal, scalar, ldd
dimension of expression directional


--degrees or --radians

values on expression are interpreted as degrees (default)
values on expression are interpreted as radians


If expression is a PCRaster map or an calculation resulting in a PCRaster map, it is converted: if expression is of one of the data types boolean, nominal, ordinal, scalar the cell values on expression are converted to the circular scale of Result, on a cell-by-cell basis. If expression is of the data type ldd, the codes on expression representing local drain directions are converted to real directions of drainage and saved as Result. The directions are converted to the circular scale of Result clockwise, assigning 0 degrees (or radians if the option --radians is set) to cells with a local drainage towards the top of the map (ldd code 8). A flat cell (cell value 5 on expression) is assigned a -1 on Result. The command can also generate a map of directional data type with one constant value.

If expression has no PCRaster data type, a Result with data type directional is generated. This is the case if expression is a number or a calculation with numbers. The value of expression must be in the domain of the directional data type, i.e. if the option --degrees is set: equal to 0 or between 0 and 360; if the option radians is set equal to 0 or between 0 and 2pi. Result will be a map with the same location attributes as the global clone map; all cells will have the value of expression.


A cell with missing value on expression is assigned a missing value on Result.


This operation belongs to the group of Conversion and assignment


  1. • pcrcalc
    #! –degrees
    Result2 =;
    Expr =;
    report Result2 = directional(Expr);

    • python
    Expr = readmap(“”)
    Result2 = directional(Expr)
    _images/directional_Result2.png _images/boolean_Expr.png

  2. • pcrcalc
    Result1 =;
    Expr =;
    report Result1 = directional(Expr);

    • python
    Expr = readmap(“”)
    Result1 = directional(Expr)
    _images/directional_Result1.png _images/directional_Expr.png

Table Of Contents

Previous topic


Next topic