datainterface module¶
BaseData
¶
Base class for handling common data operations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
The path to the data file. |
required |
Attributes:
Name | Type | Description |
---|---|---|
path |
str
|
The path to the data file. |
sublabel |
str
|
The sublabel extracted from the file path. |
label |
str
|
The label extracted from the file path. |
type |
str
|
The type extracted from the label. |
data |
DataFrame
|
The loaded data. |
latest_date |
Timestamp
|
The latest date in the data. |
oldest_date |
Timestamp
|
The oldest date in the data. |
Source code in multidefusion\datainterface.py
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 |
|
__init__(path)
¶
Initializes BaseData object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
The path to the data file. |
required |
Source code in multidefusion\datainterface.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
add_label_to_data()
¶
Extracts and returns the label and set sublabel from the file path.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Extracted label. |
Source code in multidefusion\datainterface.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
|
convert_range_into_two_timestamps()
¶
Convert DInSAR range columns into two timestamp columns.
Converts "YYYY1", "MM1", "DD1", "YYYY2", "MM2", "DD2" columns into "timestamp1" and "timestamp2" columns, and sets them as the index.
Source code in multidefusion\datainterface.py
130 131 132 133 134 135 136 137 138 139 140 |
|
create_projection_matrix_and_error(row_of_data)
¶
Abstract method to be implemented by subclasses for creating projection matrix and error matrix.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row_of_data |
Series
|
A row of data. |
required |
Returns:
Type | Description |
---|---|
Tuple[Optional[ndarray], Optional[ndarray]]
|
Tuple[Optional[np.ndarray], Optional[np.ndarray]]: Projection matrix and error matrix. |
Source code in multidefusion\datainterface.py
155 156 157 158 159 160 161 162 163 164 165 |
|
get_data_by_date(date, columns_list=None)
¶
Gets data for a specific date.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
date |
Timestamp
|
The date for which data is requested. |
required |
columns_list |
List[str]
|
List of column names to be returned. |
None
|
Returns:
Type | Description |
---|---|
Union[DataFrame, None]
|
Union[pd.DataFrame, None]: Data for the specified date (or None if not found). |
Source code in multidefusion\datainterface.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
|
get_observation(row_of_data)
¶
Abstract method to be implemented by subclasses for extracting observations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row_of_data |
Any
|
A row of data. |
required |
Returns:
Name | Type | Description |
---|---|---|
Any |
Any
|
Extracted observation. |
Source code in multidefusion\datainterface.py
70 71 72 73 74 75 76 77 78 79 80 |
|
load_csv_data(header)
¶
Loads data from the specified file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
header |
List[str]
|
List of column names. |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
pd.DataFrame: Loaded data. |
Source code in multidefusion\datainterface.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|
load_data()
¶
Abstract method to be implemented by subclasses for loading data.
Returns:
Type | Description |
---|---|
DataFrame
|
pd.DataFrame: Loaded data. |
Source code in multidefusion\datainterface.py
61 62 63 64 65 66 67 68 |
|
process_timestamp_columns()
¶
Process timestamp columns in the data.
Converts GNSS, SBAS, and PSI "YYYY", "MM", "DD" columns into a single "timestamp" column, sets it as the index, and resamples the data based on the time interval.
Source code in multidefusion\datainterface.py
118 119 120 121 122 123 124 125 126 127 128 |
|
replace_decimal_sep()
¶
Replace decimal separators in non-float columns.
Replaces commas with dots in non-float columns and converts them to float.
Source code in multidefusion\datainterface.py
142 143 144 145 146 147 148 149 150 151 152 153 |
|
GNSSData
¶
Bases: BaseData
Class for handling GNSS data operations, inheriting from BaseData.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
The path to the GNSS data file. |
required |
Source code in multidefusion\datainterface.py
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 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
|
__init__(path)
¶
Initializes GNSSData object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
The path to the GNSS data file. |
required |
Source code in multidefusion\datainterface.py
181 182 183 184 185 186 187 188 |
|
create_projection_matrix_and_error(row_of_data)
¶
Creates a projection matrix and error matrix based on the provided row of data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row_of_data |
Series
|
A row of GNSS data. |
required |
Returns:
Type | Description |
---|---|
Tuple[Union[ndarray, None], Union[ndarray, None]]
|
Tuple[Union[np.ndarray, None], Union[np.ndarray, None]]: Projection matrix and error matrix. |
Source code in multidefusion\datainterface.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
|
create_rotation_matrix()
¶
Creates a rotation matrix based on the mean coordinates of the first five epochs.
Returns:
Type | Description |
---|---|
Tuple[pd.Series, np.ndarray]: Mean coordinates of the first five epochs and the rotation matrix. |
Source code in multidefusion\datainterface.py
272 273 274 275 276 277 278 279 280 281 282 283 284 |
|
get_observation(row_of_data)
¶
Gets GNSS observation from the provided row of data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row_of_data |
Series
|
A row of GNSS data. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: GNSS observation. |
Source code in multidefusion\datainterface.py
224 225 226 227 228 229 230 231 232 233 234 |
|
load_data()
¶
Loads GNSS data from the specified file.
Returns:
Type | Description |
---|---|
DataFrame
|
pd.DataFrame: Loaded GNSS data. |
Source code in multidefusion\datainterface.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
xyz_to_blh(X, Y, Z)
staticmethod
¶
Converts Cartesian coordinates (X, Y, Z) to geodetic coordinates (latitude, longitude, height).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X |
float
|
Cartesian coordinate in the X direction. |
required |
Y |
float
|
Cartesian coordinate in the Y direction. |
required |
Z |
float
|
Cartesian coordinate in the Z direction. |
required |
Returns:
Type | Description |
---|---|
Tuple[float, float, float]: Geodetic coordinates (latitude, longitude, height). |
Source code in multidefusion\datainterface.py
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 |
|
xyz_to_neu(mean_xyz_first_five_epochs, F)
¶
Converts Cartesian coordinates (X, Y, Z) to local coordinates (North, East, Up).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mean_xyz_first_five_epochs |
Series
|
Mean coordinates of the first five epochs. |
required |
F |
ndarray
|
Rotation matrix. |
required |
Returns:
Name | Type | Description |
---|---|---|
None |
Modifies the 'data' attribute in-place by updating coordinates and errors. |
Source code in multidefusion\datainterface.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
|
SARData
¶
Bases: BaseData
Class for handling SAR data operations, inheriting from BaseData.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
The path to the SAR data file. |
required |
Source code in multidefusion\datainterface.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 |
|
__init__(path)
¶
Initializes SARData object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
The path to the SAR data file. |
required |
Source code in multidefusion\datainterface.py
328 329 330 331 332 333 334 335 336 337 |
|
coherence_to_error()
¶
Convert coherence column to error column in the data.
Source code in multidefusion\datainterface.py
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
|
create_projection_matrix_and_error(row_of_data)
¶
Creates a projection matrix and error from the provided row of data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row_of_data |
Series
|
A row of SAR data. |
required |
Returns:
Type | Description |
---|---|
Tuple[Optional[ndarray], Optional[float]]
|
Tuple[Optional[np.ndarray], Optional[float]]: Projection matrix and error. |
Source code in multidefusion\datainterface.py
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 |
|
expand_dataframe_by_date_range()
¶
Expands the DataFrame by date range for "DInSAR" label.
For SAR data labeled as "DInSAR", this method adds a temporary column "temp" to the DataFrame containing a date range between "timestamp1" and "timestamp2" based on the specified time interval. The DataFrame is then exploded based on the "temp" column, duplicates are removed, and unnecessary columns are dropped to create a new "timestamp1" index.
Note: - This method is specifically designed for SAR data labeled as "DInSAR". - It modifies the existing DataFrame in-place.
Example: If the original DataFrame has a row with "timestamp1" and "timestamp2" as ["2022-01-01", "2022-01-03"], and the time interval is set to "1D" (daily), the resulting DataFrame will have individual rows for "2022-01-01", "2022-01-02", and "2022-01-03".
Source code in multidefusion\datainterface.py
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 |
|
get_observation(row_of_data)
¶
Gets SAR observation from the provided row of data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row_of_data |
Series
|
A row of SAR data. |
required |
Returns:
Type | Description |
---|---|
Union[float, None]
|
Union[float, None]: SAR observation. |
Source code in multidefusion\datainterface.py
443 444 445 446 447 448 449 450 451 452 453 |
|
load_data()
¶
Loads SAR data from the specified file.
Returns:
Type | Description |
---|---|
DataFrame
|
pd.DataFrame: Loaded SAR data. |
Source code in multidefusion\datainterface.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
|
reduce_bias_to_gnss(date)
¶
Reduces bias in SAR data to GNSS data.
This method reduces the bias in the SAR data by removing data points prior to the specified date and adjusting the 'DSP' values based on the first non-null value after the specified date.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
date |
Timestamp
|
The timestamp used as a reference point for bias reduction. |
required |
Returns:
Type | Description |
---|---|
None |
Source code in multidefusion\datainterface.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
|