-
Notifications
You must be signed in to change notification settings - Fork 1
/
ts1pos.h
112 lines (92 loc) · 4.07 KB
/
ts1pos.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#ifndef TS1POS_H
#define TS1POS_H
#include "date.h"
#include <iostream>
#include "map"
#include "tuiles2OneDate.h"
#include "tuiles2onedatesco.h"
#include "algorithm"
using namespace date;
extern bool mDebug;
bool isScolyte(int x);
class tuileS2OneDate;
class tuileS2OneDateSco;
class pts;
class TS1Pos;// contient un vecteur de valeur individuelle, un vecteur de date, un vecteur pour stoquer l'analyse temporelle
class TS1PosTest;// beaucoup plus complêt que TS1Pos, car contient les valeurs de chaque bande pour cette position. Sert à débugger et à visualiser toutes les valeurs qui nous intéressent pour une position
// série temporelle pour une position donnée (un pixel)
class TS1Pos{
public:
TS1Pos(int aU, int aV, std::vector<int> * aVYears, int n, std::vector<tuileS2OneDateSco*> aVTuiles):mU(aU),mV(aV),mVDates(n,NULL),mVEtat(n,0),mVEtatFin(n,0),c(0),mVPtrTS2(aVTuiles){//,mVYs(aVYears)
for (int y : * aVYears){
mVRes.emplace(std::make_pair(y,0));
}
}
void add1Date(year_month_day * ymd,int code){
// if (mDebug){std::cout << "TS1Pos::add1Date" << std::endl;}
mVDates.at(c)=ymd;
mVEtat.at(c)=code;
c++;
}
void writeIntermediateRes1pos();
// effectue l'analyse ; détection de plusieurs dates consécutives avec état dépérissant ou sol nu
void analyse();
// enlève les code 0
void nettoyer();
void restrictRetourNorm();
void detectMelange();
void detectStresseEtRetour();
//simplification des vecteurs pour supprimer les dates consécutives qui ont le même état et ne garder que la date moyenne
void concateneEtat(std::vector<year_month_day> *aVD, std::vector<int>* aVE, std::vector<std::vector<int> > *aVPosInit, std::vector<int> *aVDuree=NULL);
// regarde si la valeur val est répétée 3 fois de suite dans la série temporelle, centrée sur la position pos
bool repetition(int pos, int val);
// je voulais utiliser cette fonction dans la partie getEtatPour annee mais je n'ai pas de position à renseigner à la fonction...
bool repetition(int pos, int val, std::vector<int> *aVPt);
int filtreVoisinDirect(int i, int val);
int getEtatPourAnnee(int y);
void printDetail();
int getPositionFirstSco();
int getDelaisCoupe(int y,bool firstDate=0);
int mU, mV;
// résultat par année ; un vecteur par an
std::map<int,int> mVRes;
protected:
// données de base
std::vector<year_month_day *> mVDates;
// analyse temporelle ; vecteur de mm dimension
std::vector<int> mVEtat;
std::vector<tuileS2OneDateSco*> mVPtrTS2;
// état final ; déterminé par comparaison des dates successives (enlever le bruit de mVEtat)
std::vector<int> mVEtatFin;
int c;// compteur pour savoir quantiemme date on ajoute
};
class TS1PosTest : public TS1Pos
{
public:
TS1PosTest(std::vector<int> * aVYears, int n,std::vector<tuileS2OneDateSco*> aVTuiles, pts pt):TS1Pos(0,0,aVYears,n,aVTuiles),mVCRSWIR(n,0),mVCRSWIRNorm(n,0),mVB2(n,0),mVB3(n,0),mVB4(n,0),mVB8A(n,0),mVB11(n,0),mVB12(n,0),mVMasq(n,0),pt_(pt),mVB8(n,0),mVB5(n,0),mVB6(n,0),mVB7(n,0){}
void nettoyer();
void printDetail(std::string aOut="toto");
// overload add1Date
void add1Date(int code, tuileS2OneDate * t);
std::map<int, std::vector<double> > * summaryByTri();
// version plus récente qui permet de faire la synthese spectrale trimestrielle pour un point ET de donner les valeurs des bandes dates par dates, pour faire une figure du process.
// c'est récent 2022 04 car il y a toute les bandes, pas juste cette utilisée par s2_ts Scolyte
void summaryByTriTest();
std::vector<int> getDateIndexForTri(int trimestre);
private:
std::vector<double> mVCRSWIR;
std::vector<double> mVCRSWIRNorm;
std::vector<double> mVB2;
std::vector<double> mVB3;
std::vector<double> mVB4;
std::vector<double> mVB8A;
std::vector<double> mVB11;
std::vector<double> mVB12;
std::vector<double> mVMasq;
std::vector<double> mVB8;
std::vector<double> mVB5;
std::vector<double> mVB6;
std::vector<double> mVB7;
pts pt_;
};
#endif // TS1POS_H