Commit 51f0408c authored by Ronan Trépos's avatar Ronan Trépos
Browse files

ParametresVarietes: allow new init

- use relative dates rather than absolute dates
date_TT_F1, data_TT_M0, date_TT_M3
parent 1d0dfc94
......@@ -101,21 +101,52 @@ struct ParametresVariete
} else {
throw vle::utils::ModellingError("[ParametersVariete] missing 'date_TT_E1'");
}
//date_TT_F1
if ( events.exist("date_TT_F1") ){
if (events.exist("reldate_TT_F1")) {
throw vle::utils::ModellingError("[ParametersVariete] either 'date_TT_F1' or 'reldate_TT_F1'");
}
date_TT_F1 = events.getDouble("date_TT_F1");
} else if (events.exist("reldate_TT_F1")) {
date_TT_F1 = date_TT_E1 + events.getDouble("reldate_TT_F1");
} else {
throw vle::utils::ModellingError("[ParametersVariete] missing 'date_TT_F1'");
throw vle::utils::ModellingError("[ParametersVariete] missing 'date_TT_F1' and 'reldate_TT_F1' ");
}
//date_TT_M0
if ( events.exist("date_TT_M0") ){
if (events.exist("reldate_TT_M0")) {
throw vle::utils::ModellingError("[ParametersVariete] either 'date_TT_M0' or 'reldate_TT_M0'");
}
date_TT_M0 = events.getDouble("date_TT_M0");
} else if (events.exist("reldate_TT_M0")) {
date_TT_M0 = date_TT_F1 + events.getDouble("reldate_TT_M0");
} else {
throw vle::utils::ModellingError("[ParametersVariete] missing 'date_TT_M0'");
throw vle::utils::ModellingError("[ParametersVariete] missing 'date_TT_M0' and 'reldate_TT_M0'");
}
//date_TT_M3
if ( events.exist("date_TT_M3") ){
if (events.exist("reldate_TT_M3")) {
throw vle::utils::ModellingError("[ParametersVariete] either 'date_TT_M3' or 'reldate_TT_M3'");
}
date_TT_M3 = events.getDouble("date_TT_M3");
} else if (events.exist("reldate_TT_M3")) {
date_TT_M3 = date_TT_M0 + events.getDouble("reldate_TT_M3");
} else {
throw vle::utils::ModellingError("[ParametersVariete] missing 'date_TT_M3'");
throw vle::utils::ModellingError("[ParametersVariete] missing 'date_TT_M3' and 'reldate_TT_M3'");
}
//check dates
if ( ( date_TT_E1 < date_TT_F1 )
&& ( date_TT_F1 < date_TT_M0 )
&& ( date_TT_M0 < date_TT_M3 ) ){
// ok
} else { // probleme
throw vle::utils::ModellingError("[ParametersVariete] error date_TT_*");
}
if ( events.exist("cSF") ){
cSF = events.getDouble("cSF");
} else {
......
......@@ -102,14 +102,6 @@ public :
photo_DatePsgPhasePhenoPlante_DESSICATION_A_RECOLTEE.init(this,
"photo_DatePsgPhasePhenoPlante_DESSICATION_A_RECOLTEE", events);
if ( ( pv.date_TT_E1 < pv.date_TT_F1 )
&& ( pv.date_TT_F1 < pv.date_TT_M0 )
&& ( pv.date_TT_M0 < pv.date_TT_M3 ) ){
// ok
} else { // probleme
throw vle::utils::ModellingError("[Phenologie] error date_TT_*");
}
double FHTR_valeurInitiale = 1.0;
estimationTTentreSemisEtLevee_casPhaseSemisLeveeSimulee =
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment