@@ -334,8 +334,6 @@ GDALDatasetH fp_;
334
334
335
335
336
336
meta -> cal = allocate_calibration (nb );
337
- //alloc((void**)&meta->cal, nb, sizeof(cal_t));
338
- //for (b=0; b<nb; b++) init_calib(&meta->cal[b]);
339
337
340
338
341
339
// set start of Relative Spectral Response Array
@@ -736,8 +734,6 @@ int svgrid = 5000;
736
734
for (b = 0 ; b < nb ; b ++ ) set_brick_sensor (DN , b , sensor );
737
735
738
736
meta -> cal = allocate_calibration (nb );
739
- //alloc((void**)&meta->cal, nb, sizeof(cal_t));
740
- //for (b=0; b<nb; b++) init_calib(&meta->cal[b]);
741
737
742
738
// set start of Relative Spectral Response Array
743
739
if (strcmp (sensor , "SEN2A" ) == 0 ){
@@ -883,6 +879,25 @@ int svgrid = 5000;
883
879
tokenptr = strtok (NULL , separator );
884
880
}
885
881
882
+ // additive scaling factor (since baseline 4.0)
883
+ } else if (strcmp (tag , "RADIO_ADD_OFFSET" ) == 0 ){
884
+ // re-init to 0 to be compatible with older baselines
885
+ for (b = 0 ; b < nb ; b ++ ){
886
+ if (meta -> cal [b ].radd == meta -> cal [b ].fill ) meta -> cal [b ].radd = 0 ;
887
+ }
888
+ b = -1 ;
889
+ while (strcmp (tokenptr , "/RADIO_ADD_OFFSET" ) != 0 ){
890
+ if (b < 0 ){
891
+ char_to_int (tokenptr , & b );
892
+ } else if (b >= 0 || b < nb ){
893
+ char_to_float (tokenptr , & meta -> cal [b ].radd );
894
+ }
895
+ tag = tokenptr ;
896
+ tokenptr = strtok (NULL , separator );
897
+ }
898
+ #ifdef FORCE_DEBUG
899
+ if (b >= 0 ) printf ("additive scaling factor for band %d: %f\n" , b , meta -> cal [b ].radd );
900
+ #endif
886
901
}
887
902
888
903
// in case tag (key words) is not the first word in a line
0 commit comments