Subversion Repositories public iLand

Rev

Rev 1221 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
900 werner 1
// documentation for the FMTreeList API
2
 
3
 
4
/**
5
The TreeList class (**`trees`** variable) represents a list of trees that can be manipulated (e.g., harvested) with functions of the class.
6
When javascript code is executed in the context of an Activity, a variable 'trees' is available in the global context. This instance
7
of a TreeList is linked automatically to the forest stand that is currently managed.
8
 
9
## Overview
10
### initializing the list
11
The main function for loading (i.e. making available for manipulation) trees of a forest stand is `load()`. `load()` can be used to load either
12
all trees, or a subset of trees (based on filter criteria).
13
### manipulating the content of the list
14
The trees in a list (loaded by `load()`) may be manipulated using functions such as `filter()` or `sort()`. There are functions helping to get aggregate values
15
(`mean()`, `sum()`), or to get the value of a given `percentile()`.
16
### manipulationg trees
17
Trees present in the tree list may be harvested or simply cut down. Main functions are `kill()`, `harvest()`. If `simulate` is true, harvested/killed trees
18
are only marked for removal. At a later point in time, all marked trees can be removed using `removeMarkedTrees()`.
19
### extra features
20
something here...
21
 
22
## Examples
23
    // 'trees' variable is always available.
24
    // this loads *all* trees of the current forest stand (i.e. trees>4m)
25
    trees.load();
26
    trees.simulate = true; // enable simulation mode (this is the default)
27
    // keep only spruce trees with a dbh>20cm in the list:
28
    trees.filter("species = piab and dbh>20");
29
    // now harvest all trees (since simulate=true, the trees are only marked for harvesting)
30
    trees.harvest();
31
    ...
32
    // later: remove all trees from the system that are marked for removal (harvest/kill)
33
    trees.removeMarkedTrees();
34
 
35
@class TreeList
36
***/
37
 
38
 
39
/**
40
The `load()` method is the main means to get all the trees of a forest stand into the list.
41
Per default, all trees (i.e. trees>4m height) that are located on the forest stand are loaded. If `filter` is provided, only a subset
42
of the trees are loaded. `filter` can either be a probability (between 0..1) for selecting individual trees, or an Expression using tree
43
variables.
44
 
45
    trees.load(0.2); // load (randomly selected) 20% of all trees
46
    trees.load("rnd(0,1)<0.2)"); // the same as above, but using an Expression
47
    // load a subset of trees (for which the given Expression evalulates to true):
48
    trees.load("species=piab and dbh>20");
49
 
50
@method load
51
@param {String} filter optional filter criterion (see above).
52
@return {Integer} the number of trees loaded.
53
**/
54
 
55
 
56
/**
57
When `simulate` is true, harvest operations are not actually executed, but affected trees are marked as either for harvest or killing. Calling `removeMarkedTrees()` then
58
executes the harvest operation.
59
Note: tree variables `markharvest`, `markcut`, `markcrop` are available for use in `filter()` or for visualization in iLand.
60
@propery simulate
61
@type Boolean
62
@default true
63
*/
1198 werner 64
 
65
/**
66
the ID of the currently active stand (or -1).
67
@propery stand
68
@type Integer
69
@readonly
70
*/
71
 
72
/**
1208 werner 73
the number of trees that are currently loaded in the list.
74
@propery count
75
@type Integer
76
@readonly
77
*/
78
 
79
/**
1198 werner 80
Load all trees (living trees, >4m height) of the current `stand` into the internal list.
81
 
82
@method loadAll
83
@return {Integer} the number of loaded harvested.
84
**/
85
 
86
 
87
/**
88
Check all trees of the stand and either kill or harvest those trees that are marked for that operation.
89
 
90
See also: {{#crossLink "TreeList/simulate:property"}}{{/crossLink}}, {{#crossLink "TreeList/harvest:method"}}{{/crossLink}}
91
 
92
@method removeMarkedTrees
93
@return {Integer} the number of trees that have been removed.
94
**/
95
 
96
/**
97
Kill (i.e., cut down and do not remove from the forest) the trees in the list, filtered with `filter`.
98
 
99
See also: {{#crossLink "TreeList/simulate:property"}}{{/crossLink}}
100
 
101
@method kill
102
@param {String} filter A valid filter Expression.
103
@return {Integer} the number of trees that have been removed.
104
@Example
105
    trees.loadAll();
106
    trees.kill('dbh<10'); // kill all trees with a dbh<10cm
107
**/
108
 
109
 
110
/**
111
Remove the `fraction` of all trees [0..1] for which `filter` evalulates to `true`. Return number of removed trees.
112
When trees are harvested, the biomass is removed from the system (compare kill/cut).
113
When `harvest()` is called without parameters, then all trees that are currently in the list are removed (see also `load()`).
114
 
115
 
116
See also: {{#crossLink "TreeList/simulate:property"}}{{/crossLink}}, {{#crossLink "TreeList/kill:method"}}{{/crossLink}}
117
 
118
@method harvest
119
@param {string} filter A valid filter Expression.
120
@param {double} fraction The fraction [0..1] of trees that should be harvested. Default value is 1.
121
@return {Integer} the number of trees that have been removed.
122
@Example
123
    trees.loadAll();
124
    trees.harvest('species=piab', 0.2); // remove 20% (selected randomly) from all spruce
125
    trees.harvest('dbh>30'); // harvest all trees with dbh>30cm
126
**/
127