@@ -42,9 +42,9 @@ typedef struct {
42
42
enum { _full_ , _stats_ , _inter_ , _nrt_ , _year_ , _quarter_ , _month_ , _week_ , _day_ , _lsp_ , _pol_ , _trd_ , _cat_ , _udf_ };
43
43
44
44
45
- void alloc_ts_dates (tsa_t * ts , par_hl_t * phl , int nt , int nr , int ni );
46
- void free_ts_dates (tsa_t * ts );
47
- void compile_ts_dates (ard_t * ard , tsa_t * ts , par_hl_t * phl , int nt , int nr , int ni );
45
+ void alloc_ts_metadata (tsa_t * ts , par_hl_t * phl , int nt , int nr , int ni );
46
+ void free_ts_metadata (tsa_t * ts , int ni );
47
+ void compile_ts_metadata (ard_t * ard , tsa_t * ts , par_hl_t * phl , int nt , int nr , int ni );
48
48
brick_t * compile_tsa_brick (brick_t * ard , int idx , brick_compile_info_t * info , par_hl_t * phl );
49
49
brick_t * * compile_tsa (ard_t * ard , tsa_t * tsa , par_hl_t * phl , cube_t * cube , int nt , int nr , int ni , int idx , int * nproduct );
50
50
@@ -451,16 +451,16 @@ int info_rsp(brick_compile_info_t *info, int o, tsa_t *ts, par_hl_t *phl){
451
451
}
452
452
453
453
454
- /** This function allocates the date arrays
455
- +++ Free the arrays using free_ts_dates
454
+ /** This function allocates the date & bandname arrays
455
+ +++ Free the arrays using free_ts_metadata
456
456
--- ts: pointer to instantly useable TSA image arrays
457
457
--- phl: HL parameters
458
458
--- nt: number of ARD products over time
459
459
--- nr: number of NRT ARD products over time
460
460
--- ni: number of interpolated products over time
461
461
+++ Return: void
462
462
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++**/
463
- void alloc_ts_dates (tsa_t * ts , par_hl_t * phl , int nt , int nr , int ni ){
463
+ void alloc_ts_metadata (tsa_t * ts , par_hl_t * phl , int nt , int nr , int ni ){
464
464
465
465
466
466
#ifdef FORCE_DEBUG
@@ -479,15 +479,17 @@ void alloc_ts_dates(tsa_t *ts, par_hl_t *phl, int nt, int nr, int ni){
479
479
if (phl -> tsa .lsp .ny > 0 ) alloc ((void * * )& ts -> d_lsp , phl -> tsa .lsp .ny , sizeof (date_t )); else ts -> d_lsp = NULL ;
480
480
if (phl -> tsa .pol .ny > 0 ) alloc ((void * * )& ts -> d_pol , phl -> tsa .pol .ny , sizeof (date_t )); else ts -> d_pol = NULL ;
481
481
482
+ if (ni > 0 ) alloc_2D ((void * * * )& ts -> bandnames_tsi , ni , NPOW_04 , sizeof (char )); else ts -> bandnames_tsi = NULL ;
483
+
482
484
return ;
483
485
}
484
486
485
487
486
- /** This function frees the date arrays
488
+ /** This function frees the date & bandname arrays
487
489
--- ts: pointer to instantly useable TSA image arrays
488
490
+++ Return: void
489
491
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++**/
490
- void free_ts_dates (tsa_t * ts ){
492
+ void free_ts_metadata (tsa_t * ts , int ni ){
491
493
492
494
493
495
if (ts -> d_tss != NULL ){ free ((void * )ts -> d_tss ); ts -> d_tss = NULL ;}
@@ -501,27 +503,30 @@ void free_ts_dates(tsa_t *ts){
501
503
if (ts -> d_lsp != NULL ){ free ((void * )ts -> d_lsp ); ts -> d_lsp = NULL ;}
502
504
if (ts -> d_pol != NULL ){ free ((void * )ts -> d_pol ); ts -> d_pol = NULL ;}
503
505
506
+ if (ts -> bandnames_tsi != NULL ){ free_2D ((void * * )ts -> bandnames_tsi , ni ); ts -> bandnames_tsi = NULL ;}
507
+
504
508
return ;
505
509
}
506
510
507
511
508
- /** This function compiles the date arrays
512
+ /** This function compiles the date & bandname arrays
509
513
--- ard: ARD
510
514
--- ts: pointer to instantly useable TSA image arrays
511
515
--- phl: HL parameters
512
516
--- nt: number of ARD products over time
513
517
--- ni: number of interpolated products over time
514
518
+++ Return: void
515
519
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++**/
516
- void compile_ts_dates (ard_t * ard , tsa_t * ts , par_hl_t * phl , int nt , int nr , int ni ){
520
+ void compile_ts_metadata (ard_t * ard , tsa_t * ts , par_hl_t * phl , int nt , int nr , int ni ){
517
521
int t , k ;
518
522
date_t date ;
523
+ char sensor [NPOW_04 ];
519
524
520
525
521
526
init_date (& date );
522
527
set_date (& date , 2000 , 1 , 1 );
523
528
524
- alloc_ts_dates (ts , phl , nt , nr , ni );
529
+ alloc_ts_metadata (ts , phl , nt , nr , ni );
525
530
526
531
if (nt > 0 ){
527
532
for (t = 0 ; t < nt ; t ++ ){
@@ -543,10 +548,13 @@ date_t date;
543
548
for (t = 0 ; t < ni ; t ++ ){
544
549
if (phl -> tsa .tsi .method == _INT_NONE_ ){
545
550
date = get_brick_date (ard [t ].DAT , 0 );
551
+ get_brick_sensor (ard [t ].DAT , 0 , sensor , NPOW_04 );
546
552
} else {
547
553
set_date_ce (& date , phl -> date_range [_MIN_ ].ce + t * phl -> tsa .tsi .step );
554
+ copy_string (sensor , NPOW_04 , "BLEND" );
548
555
}
549
556
copy_date (& date , & ts -> d_tsi [t ]);
557
+ copy_string (ts -> bandnames_tsi [t ], NPOW_04 , sensor );
550
558
}
551
559
}
552
560
@@ -896,7 +904,7 @@ brick_compile_info_t *info = NULL;
896
904
printf ("%d compiling TSA product errors.\n" , error );
897
905
for (o = 0 ; o < nprod ; o ++ ) free_brick (TSA [o ]);
898
906
free ((void * )TSA );
899
- free_ts_dates (ts );
907
+ free_ts_metadata (ts , ni );
900
908
return NULL ;
901
909
}
902
910
@@ -1039,7 +1047,7 @@ short nodata;
1039
1047
for (idx = 0 ; idx < phl -> tsa .n ; idx ++ ){
1040
1048
1041
1049
// generate data arrays
1042
- compile_ts_dates (ard , & ts , phl , nt , nr , ni );
1050
+ compile_ts_metadata (ard , & ts , phl , nt , nr , ni );
1043
1051
1044
1052
// initialize UDFs
1045
1053
init_pyp (NULL , & ts , _HL_TSA_ , phl -> tsa .index_name [idx ], 1 , ni , & phl -> tsa .pyp );
@@ -1080,7 +1088,7 @@ short nodata;
1080
1088
1081
1089
1082
1090
// clean date arrays
1083
- free_ts_dates (& ts );
1091
+ free_ts_metadata (& ts , ni );
1084
1092
1085
1093
// terminate UDFs
1086
1094
term_pyp (& phl -> tsa .pyp );
0 commit comments