Subversion Repositories public iLand

Rev

Rev 198 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1
 
193 werner 2
#ifndef CLIMATE_H
3
#define CLIMATE_H
4
 
5
#include <QtSql>
6
 
7
struct ClimateDay
8
{
9
    int year; // year
10
    int month; // month
11
    int day; // day of year
12
    double temperature; // average day °C
13
    double preciptitation; // sum of day [mm]
14
    double radiation; // sum of day (MJ/m2)
15
    double vpd; // average of day [kPa]
16
};
17
class Climate
18
{
19
public:
20
    Climate();
21
    void setup(); ///< setup routine that opens database connection
22
    // activity
23
    void nextYear();
24
 
25
private:
26
    void load(); ///< load mLoadYears years from database
27
    int mLoadYears; // count of years to load ahead
28
    int mCurrentYear; // current year (relative)
29
    int mMinYear; // lowest year in store (relative)
30
    int mMaxYear;  // highest year in store (relative)
31
    QVector<ClimateDay> mStore; ///< storage of climate data
32
    QVector<int> mDayIndices; ///< store indices for month / years within store
33
    QSqlQuery mClimateQuery; ///< sql query for db access
34
};
35
 
36
#endif // CLIMATE_H