Rev 1221 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
671 | werner | 1 | /******************************************************************************************** |
2 | ** iLand - an individual based forest landscape and disturbance model |
||
3 | ** http://iland.boku.ac.at |
||
4 | ** Copyright (C) 2009- Werner Rammer, Rupert Seidl |
||
5 | ** |
||
6 | ** This program is free software: you can redistribute it and/or modify |
||
7 | ** it under the terms of the GNU General Public License as published by |
||
8 | ** the Free Software Foundation, either version 3 of the License, or |
||
9 | ** (at your option) any later version. |
||
10 | ** |
||
11 | ** This program is distributed in the hope that it will be useful, |
||
12 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
13 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
14 | ** GNU General Public License for more details. |
||
15 | ** |
||
16 | ** You should have received a copy of the GNU General Public License |
||
17 | ** along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
18 | ********************************************************************************************/ |
||
19 | |||
262 | werner | 20 | #include "standdeadout.h" |
21 | #include "helper.h" |
||
22 | #include "model.h" |
||
23 | #include "resourceunit.h" |
||
24 | #include "species.h" |
||
25 | |||
26 | |||
27 | StandDeadOut::StandDeadOut() |
||
28 | { |
||
29 | setName("Dead trees by species/RU", "standdead"); |
||
30 | setDescription("Died trees in current year on the level of RU x species. The output is created after the growth of the year, " \ |
||
277 | werner | 31 | "i.e. the growth of year trees are dying in is included! NPP and NPP_kg are not recorded for trees that " \ |
32 | "are removed during management. "); |
||
570 | werner | 33 | columns() << OutputColumn::year() << OutputColumn::ru() << OutputColumn::id() << OutputColumn::species() |
802 | werner | 34 | << OutputColumn("count_ha", "tree count (that died this year)", OutInteger) |
262 | werner | 35 | << OutputColumn("dbh_avg_cm", "average dbh (cm)", OutDouble) |
36 | << OutputColumn("height_avg_m", "average tree height (m)", OutDouble) |
||
37 | << OutputColumn("volume_m3", "volume (geomery, taper factor) in m3", OutDouble) |
||
38 | << OutputColumn("basal_area_m2", "total basal area at breast height (m2)", OutDouble) |
||
39 | << OutputColumn("NPP_kg", "sum of NPP (aboveground + belowground) kg Biomass/ha", OutDouble) |
||
40 | << OutputColumn("NPPabove_kg", "sum of NPP (abovegroundground) kg Biomass/ha", OutDouble); |
||
41 | |||
42 | } |
||
43 | |||
44 | void StandDeadOut::setup() |
||
45 | { |
||
46 | } |
||
47 | |||
48 | void StandDeadOut::exec() |
||
49 | { |
||
50 | Model *m = GlobalSettings::instance()->model(); |
||
51 | |||
52 | foreach(ResourceUnit *ru, m->ruList()) { |
||
574 | werner | 53 | if (ru->id()==-1) |
54 | continue; // do not include if out of project area |
||
55 | |||
455 | werner | 56 | foreach(const ResourceUnitSpecies *rus, ru->ruSpecies()) { |
57 | const StandStatistics &stat = rus->constStatisticsDead(); |
||
1114 | werner | 58 | if (stat.count()==0.) |
262 | werner | 59 | continue; |
570 | werner | 60 | *this << currentYear() << ru->index() << ru->id() << rus->species()->id(); // keys |
262 | werner | 61 | *this << stat.count() << stat.dbh_avg() << stat.height_avg() << stat.volume() << stat.basalArea() |
62 | << stat.npp() << stat.nppAbove(); |
||
63 | writeRow(); |
||
64 | } |
||
65 | } |
||
66 | } |