00001 #ifndef _LANDUSETABLE_
00002
00003 #define _LANDUSETABLE_
00004 class TimeHandler;
00005 #include "CommonTable.h"
00006
00007
00008
00009 #include <iostream>
00010 #include <iomanip>
00011 #include <cstdio>
00012 #include <vector>
00013 #include <string.h>
00014
00015
00016 #include"MatrixDouble.h"
00017
00018 using namespace std;
00019
00020 #define _MAXCHAR_ 200
00021
00022 typedef void (*functionpointer) (int);
00023
00024
00025
00026 struct KcMonthlyValuesStruct
00027 {
00028 MatrixDouble kcForAllMonth;
00029 int code;
00030 char nameAct[100];
00031 float cutoffFactor;
00032 };
00033
00034
00035
00036 class LUSEtabletype:
00037 public CommonTableType
00038 {
00039
00040 private:
00041 int method;
00042
00043 int ID_cropwatTable;
00044 bool flag_useCropwatTable;
00045 KcMonthlyValuesStruct kcMonthly;
00046
00047 int iNumFixPoints;
00048 int *days;
00049 int *daystemp;
00050 float *rsc,
00051 *rsi,
00052 *rse,
00053 *albedo,
00054 *LAI,
00055 *z0,
00056 *Vbg,
00057 *Wurz,
00058 *AltDep;
00059 float form_par,
00060 redu_parDry,
00061 redu_parWet,
00062 LimitReduWet;
00063 float m_fIntercepStor;
00064 int mon[14];
00065
00066 public:
00067 LUSEtabletype(int index);
00068 LUSEtabletype();
00069 ~LUSEtabletype();
00070 private:
00071 float interpolate(double x1,double y1,double x2,double y2,double x);
00072 int GetJulDay(int iMonthDay,int iMonth,int iYear);
00073 void AltitudeCorrection(float dhm);
00074 int GetFixPoint(int iJulDay,float height);
00075 void stripParameters(string &row,string sWhatParam,float *param,int maxIndex);
00076 void stripParametersJulDays(string &row);
00077
00078 public:
00079
00080 void initialize(ostream *WSstream,string row,int version);
00081 void initialize(ostream *WSstream,string row,string sVersion);
00082
00083 void initializeKcEmpty();
00084 void deallocateKcStruct();
00085
00086 float getFormPar();
00087 float getReduParDry();
00088 float getReduParWet();
00089 float getLimitReduWet();
00090 float getIntercepStor();
00091 char* getName();
00092 int getCode();
00093 void setCode(int code);
00094 void printContent();
00095
00096 bool getIsActivity();
00097 void printKcMonthlyValuesStruct();
00098 int getActivityNumberInMPMAS();
00099 void extractActivityNumberFromName();
00100 void readKcMonthlyValuesStruct(FILE* steuer);
00101 double getMonthlyKcValue(int m);
00102 double getCutoffFactor() {return (double) kcMonthly.cutoffFactor;};
00103
00104
00105 float GetRsc(int iJulDay, float height=0.0);
00106 float GetRsc(int iMonthDay,int iMonth,int iYear, float height=0.0);
00107
00108 float GetRsi(int iJulDay, float height=0.0);
00109 float GetRsi(int iMonthDay,int iMonth,int iYear, float height=0.0);
00110
00111 float GetRse(int iJulDay, float height=0.0);
00112 float GetRse(int iMonthDay,int iMonth,int iYear, float height=0.0);
00113
00114 float GetZ0(int iJulDay, float height=0.0);
00115 float GetZ0(int iMonthDay,int iMonth,int iYear, float height=0.0);
00116
00117 float GetLAI(int iJulDay, float height=0.0);
00118 float GetLAI(int iMonthDay,int iMonth,int iYear, float height=0.0);
00119
00120 float GetVbg(int iJulDay, float height=0.0);
00121 float GetVbg(int iMonthDay,int iMonth,int iYear, float height=0.0);
00122
00123 float GetWurz(int iJulDay, float height=0.0);
00124 float GetWurz(int iMonthDay,int iMonth,int iYear, float height=0.0);
00125
00126 float GetAlbedo(int iJulDay, float height);
00127 float GetAlbedo(int iMonthDay,int iMonth, int iYear, float height=0.0);
00128
00129 };
00130
00131
00132 void GetLuseTable(int version, string , LUSEtabletype*& LUtable);
00133 void GetLuseTable(int version, LUSEtabletype*& LUtable);
00134
00135
00136 #endif