Subversion Repositories public iLand

Rev

Rev 1104 | Rev 1217 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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