forked from Yanghai717/InSAR-on-Sentinel-1-TOPS-data
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDataTypes.h
285 lines (239 loc) · 5.88 KB
/
DataTypes.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
#ifndef DATATYPES_H
#define DATATYPES_H
#include <string>
#include <iostream>
#include <complex>
#include <fstream>
#include "ogr_api.h"
#include "ogr_core.h"
#include "ogr_srs_api.h"
#include "gdal.h"
using namespace std;
struct Polynomial{
double aztime;
double t0;
double c0;
double c1;
double c2;
};
struct ConfigSet
{
string process_dir;
string masterpath;
string slavepath;
int firstsubswath;
int lastsubswath;
string polarisation;
string preciseOrbitMaster;
string preciseOrbitSlave;
int multi_az;
int multi_rg;
int burst0;
int burstN;
bool SpecificDemorNo;
string SpecificDemPath;
};
struct LatLonMaxMin
{
double lat_max;
double lat_min;
double lon_max;
double lon_min;
};
class SubSwathInfo
{
public:
//subswath info
string subSwathName;
string ImgPath;
string XmlPath;
string polarisation;
string firstLineUTC;
string lastLineUTC;
int numOfLines;
int numOfSamples;
double firstLineTime;
double lastLineTime;
double firstValidLineTime;
double lastValidLineTime;
double slrTimeToFirstPixel;//one way [s]
double slrTimeToLastPixel;
double slrTimeToFirstValidPixel;
double slrTimeToLastValidPixel;
double azimuthTimeInterval;
double rangePixelSpacing;
double azimuthPixelSpacing;
double radarFrequency;
double wavelength; // in m
double rangeSamplingRate;
double azimuthSteeringRate; //[degrees / s]
double ascendingNodeTime;
int firstValidPixel;
int lastValidPixel;
double range_bandwidth;
double azimuth_bandwidth;
double prf;
double headingAngle;
// bursts info
int numOfBursts;
int linesPerBurst;
int samplesPerBurst;
double burstFirstLineTime[16];//16 is enough to store
double burstLastLineTime[16];
double burstFirstValidLineTime[16];
double burstLastValidLineTime[16];
int firstValidLine[16];
int lastValidLine[16];
int *firstValidSample;
int *lastValidSample;
double* rangeDependDopplerRate;
double* dopplerRate;
double* referenceTime;
double* dopplerCentroid;
// GeoLocationGridPoint
int numOfGeoLines;
int numOfGeoPointsPerLine;
double *azimuthTime;
double *slantRangeTime; //one way [s]
double *latitude;
double *longitude;
double *incidenceAngle;
bool nearRangeOnLeft;
LatLonMaxMin latlon;
LatLonMaxMin *latlonBurst;
//Coarse Orbit Information attached in S1 leader file
int numOfOrbit;
double* orbitAzTime = NULL;
double* x_pos = NULL;
double* y_pos = NULL;
double* z_pos = NULL;
double* x_vel = NULL;
double* y_vel = NULL;
double* z_vel = NULL;
int clear();
};
class SentinelTOPS
{
public:
SubSwathInfo *SubSwath;
string MissionID;
double azimuthSpacing;
double rangeSpacing;
int NumSubSwath;
double lat_max;
double lat_min;
double lon_max;
double lon_min;
double getPRF();//Get azimuth sampling rate
double getABW();//Get azimuth bandwidth
double getRSR2X();// Get two times of range sampling rate
void clear();
};
class S1PreciseOrbit
{
public:
int NumPoints;
int NumCoeff;
double TimeInerval;
double* orbitAzTime;
double* x_pos;
double* y_pos;
double* z_pos;
double* x_vel;
double* y_vel;
double* z_vel;
double *coef_x;
double *coef_y;
double *coef_z;
void clear();
};
class ellipsoid_WGS84
{
public:
double e2;
double e2b;
double a;
double b;
ellipsoid_WGS84();
};
class ResampleTable
{
public:
int Npoints;
float* KernelAz=NULL;
float* KernelRg=NULL;
void clear();
};
class RefDem
{
public:
double deltaLat;
double deltaLon;
double lon_min;
double lat_max;
double lat_min;
double lon_max;
int Lines;
int Pixels;
GDALDatasetH pData_dem;
void Init(const char* DEMPath);
~RefDem();
void getData(int x0, int y0, int ww, int hh, short* demBuffer);
void getData(double lat_min, double lat_max, double lon_min, double lon_max, double extralat,
double extralon, short*&demBuffer, int& Lines, int& Pixels);
void getData(double lat_min, double lat_max, double lon_min, double lon_max, double extralat,
double extralon, int*&demBuffer, int& Lines, int& Pixels);
void getIndex(double lat, double lon, double Res[2]);
};
//6 parameters to describe the translation relationship between master and slave
class TransFormCoef
{
public:
int burst0;
int Nbust;
double *CpmAz=NULL;
double *CpmRg = NULL;
void Init(int BusrtBeign, int BusrtEnd);
void setBurstCoeff(int BurstId, double CoeffAz[6], double CoeffRg[6]);
void getBurstCoeff(int BurstId, double CoeffAz[6], double CoeffRg[6]);
double* getAzCoeff(int BurstId);
double* getRgCoeff(int BurstId);
void clear();
};
/*************************************************************
* Class: TiffRead *
*************************************************************/
class TiffRead
{
private:
GDALDatasetH pData_In;
public:
void Init(const char* TiffIn);
void ReadFloat(int x0, int y0, int Lines, int Pixels, float *Buffer);
void ReadDouble(int x0, int y0, int Lines, int Pixels, double *Buffer);
void ReadCpxShort(int x0, int y0, int Lines, int Pixels, complex<short> *Buffer);
void ReadCpxShort(complex<short>*dataFor, complex<short>*dataBack,
const int Numoverlap, int* overlapSizeArray, int linesPerBurst,
int x0, int y0, int width);
void ReadCpxFloat(int x0, int y0, int Lines, int Pixels, complex<float> *Buffer);
void ReadCpxFloat(complex<float>*dataFor, complex<float>*dataBack,
const int Numoverlap, int* overlapSizeArray, int linesPerBurst,
int x0, int y0, int width);
void Close();
};
/*************************************************************
* Class: TiffWrite *
*************************************************************/
class TiffWrite
{
private:
GDALDatasetH pData_Out;
int dataTypes;
public:
void Init(const char* TiffOut, int types, int Pixels, int Lines);
void WriteFloat(int x0, int y0, int Lines, int Pixels, float *Buffer);
void WriteDouble(int x0, int y0, int Lines, int Pixels, double *Buffer);
void WriteCpxFloat(int x0, int y0, int Lines, int Pixels, complex<float> *Buffer);
void Close();
};
#endif // DATATYPES_H