Show:
Module: ABE

The SaplingList class represents a list of saplings (=cohort of trees <4m height) that can be manipulated (e.g., removed) with functions of the class.

Overview

initializing the list

not implemented (but available in Bite)

manipulating the content of the list

The list of sapling cohorts may be manipulated using functions such as filter(). There are functions helping to get aggregate values (sum()).

manipulationg saplings

The class provides function to kill cohorts (kill()) or to modify cohorts (e.g. browse()).

general notes

The sapling list heavily used the expression engine of iLand http://iland.boku.ac.at/Expression. Expressions are provided as strings to the respective Javascript functions (e.g.,filter) and evaluated by iLand. Note that tree species names are treated as a special case (http://iland.boku.ac.at/Expression#Constants).

Example

var saplings = biteAgent.cell(0,0).saplings; // currently, only available via Bite
// load of saplings in Bite: bitecell.reloadSaplings();

saplings.filter('height > 2'); // keep only larger cohorts
trees.sum('foliagemass*nrep'); // calculate total leaf mass of all trees in a cohort
saplings.browse(); // affect saplings (browsing: reduced height growth)

Item Index

Methods

Properties

Methods

browse

(
  • do_browse
)
Integer

Affect all saplings in the list by browsing; this reduces the height growth in the current year to 0.

Parameters:

  • do_browse Boolean

    if true, the cohorts are marked as browsed (false unmarks cohorts)

Returns:

Integer:

the number of trees that have been removed.

Example:

saplings.browse(); // browse saplings

filter

(
  • filter
)
Integer

Apply a filter on the list. Only saplings for which the filter condition filter evaluates to true, remain in the list.

Parameters:

  • filter String

    A valid filter Expression.

Returns:

Integer:

the number of trees that remain in the list.

Example:

saplings.filter('species=fasy'); // remove all trees that are not Beech
                    trees.filter('incsum(foliagemass*nrep)<1'); // max foliage mass after filtering 1kg
                    

kill

(
  • filter
)
Integer

Kill (i.e., cut down and do not remove from the forest) the saplings in the list, filtered with filter. If filter is omitted, all saplings are killed.

Parameters:

  • filter String

    A valid filter Expression.

Returns:

Integer:

the number of trees that have been removed.

Example:

saplings.kill('age<5'); // kill young saplings

sum

(
  • expr
  • filter
)
Double

Calculates the sum of a given expr that can contain any of the available sapling variables. The optional filter is another expression that filters the trees that are processed. Returns the sum of expr.

Note: counting saplings that fulfill the filter expression can be expressed as: sum('1', '<filter-expr>').

Parameters:

  • expr String

    a valid expression that should be processed

  • filter String

    only saplings that pass the filter are processed

Returns:

Double:

the sum over the value of exprof the population

Example:

console.log('number of repr. trees: ' + saplings.sum('nrep') ); // just a count, same as saplings.length
                    console.log('cohorts > 1m: ' + trees.sum('1', 'height>1') ); // note that '1' is a string (and parsed by the expression engine)

Properties

count

Integer

the number of cohorts that are currently loaded in the list.