@@ -465,10 +465,10 @@ def open_pol_dataset(
465
465
swap_dims = {"line" : "azimuth_time" , "pixel" : "slant_range_time" }
466
466
else :
467
467
if "burstId" in swath_timing ["burstList" ]["burst" ][0 ]:
468
- bursts_ids = []
468
+ burst_ids = []
469
469
for burst in swath_timing ["burstList" ]["burst" ]:
470
- bursts_ids .append (burst ["burstId" ]["$" ])
471
- attrs ["bursts_ids " ] = bursts_ids
470
+ burst_ids .append (burst ["burstId" ]["$" ])
471
+ attrs ["burst_ids " ] = burst_ids
472
472
lines_per_burst = swath_timing ["linesPerBurst" ]
473
473
attrs .update (
474
474
{
@@ -582,6 +582,17 @@ def crop_burst_dataset(
582
582
use_center : bool = False ,
583
583
burst_id : T .Optional [int ] = None ,
584
584
) -> DataArrayOrDataset :
585
+ """
586
+ Returns the measurement dataset cropped to the selected burst.
587
+ Only one keyword between 'burst_index' and 'azimuth_anx_time' and 'burst_id' must be defined.
588
+ :param xr.Dataset pol_dataset: measurement dataset
589
+ :param int burst_index: burst index can take values from 1 to the number of bursts
590
+ :param float azimuth_anx_time: azimuth anx time of first line of the bursts
591
+ To use the center instead of the first line, set `use_center=True`
592
+ :param bool use_center: If `true`, it uses as reference the azimuth anx time of the burst center instead of the first line
593
+ :param int burst_id: for product processed with Sentinel-1 IPF version 3.40 or higher,
594
+ the burst can be selected using the relative burst id.
595
+ """
585
596
burst_definitions = (
586
597
(burst_index is not None )
587
598
+ (azimuth_anx_time is not None )
@@ -598,16 +609,16 @@ def crop_burst_dataset(
598
609
pol_dataset , azimuth_anx_time , use_center = use_center
599
610
)
600
611
elif burst_id is not None :
601
- bursts_ids = pol_dataset .attrs .get ("bursts_ids " )
602
- if bursts_ids is None :
612
+ burst_ids = pol_dataset .attrs .get ("burst_ids " )
613
+ if burst_ids is None :
603
614
raise TypeError (
604
- "'bursts_ids ' list can't be found in product attributes, "
615
+ "'burst_ids ' list can't be found in product attributes, "
605
616
"probably Sentinel-1 IPF processor version is older than 3.40"
606
617
)
607
618
try :
608
- burst_index = bursts_ids .index (burst_id )
619
+ burst_index = burst_ids .index (burst_id )
609
620
except ValueError :
610
- raise KeyError (f"{ burst_id = } not found in product { bursts_ids = } " )
621
+ raise KeyError (f"{ burst_id = } not found in product { burst_ids = } " )
611
622
else :
612
623
raise TypeError (
613
624
"one keyword between 'burst_index' and 'azimuth_anx_time' must be defined"
@@ -628,9 +639,9 @@ def crop_burst_dataset(
628
639
ds .attrs ["azimuth_anx_time" ] = burst_azimuth_anx_times .values [0 ] / ONE_SECOND
629
640
ds = ds .swap_dims ({"line" : "azimuth_time" , "pixel" : "slant_range_time" })
630
641
ds .attrs ["burst_index" ] = burst_index
631
- if "bursts_ids " in ds .attrs :
632
- ds .attrs ["burst_id" ] = ds .attrs ["bursts_ids " ][burst_index ]
633
- _ = ds .attrs .pop ("bursts_ids " )
642
+ if "burst_ids " in ds .attrs :
643
+ ds .attrs ["burst_id" ] = ds .attrs ["burst_ids " ][burst_index ]
644
+ _ = ds .attrs .pop ("burst_ids " )
634
645
_ = ds .attrs .pop ("subgroups" , None )
635
646
return ds
636
647
@@ -648,6 +659,11 @@ def mosaic_slc_iw(
648
659
def calibrate_amplitude (
649
660
digital_number : xr .DataArray , calibration_lut : xr .DataArray
650
661
) -> xr .DataArray :
662
+ """Returns the calibrated amplitude. The calibration is done using the calibration LUT in the product metadata.
663
+ :param digital_number: digital numbers to be calibrated
664
+ :param calibration_lut: calibration LUT (sigmaNought, betaNought or gamma).
665
+ The LUT can be opened using the measurement sub-group `calibration`
666
+ """
651
667
calibration = calibration_lut .interp (
652
668
line = digital_number .line ,
653
669
pixel = digital_number .pixel ,
@@ -669,6 +685,14 @@ def calibrate_intensity(
669
685
as_db : bool = False ,
670
686
min_db : T .Optional [float ] = - 40.0 ,
671
687
) -> xr .DataArray :
688
+ """
689
+ Returns the calibrated intensity. The calibration is done using the calibration LUT in the product metadata.
690
+ :param digital_number: digital numbers to be calibrated
691
+ :param calibration_lut: calibration LUT (sigmaNought, betaNought or gamma).
692
+ The LUT can be opened using the measurement sub-group `calibration`.
693
+ :param as_db: if True, returns the data in db
694
+ :param min_db: minimal value in db, to avoid infinity values.
695
+ """
672
696
amplitude = calibrate_amplitude (digital_number , calibration_lut )
673
697
intensity = abs (amplitude ) ** 2
674
698
if as_db :
@@ -693,6 +717,15 @@ def slant_range_time_to_ground_range(
693
717
slant_range_time : xr .DataArray ,
694
718
coordinate_conversion : xr .Dataset ,
695
719
) -> xr .DataArray :
720
+ """
721
+ Convert the slant range time coordinates to ground range coordinates using the coordinate conversion `sr0`
722
+ and `srgrCoefficients` product metadata
723
+ :param azimuth_time: azimuth time coordinates
724
+ :param slant_range_time: slant range time
725
+ :param coordinate_conversion: coordinate conversion dataset.
726
+ The coordinate conversion dataset can be opened using the measurement sub-groub `coordinate_conversion`
727
+ :return:
728
+ """
696
729
slant_range = SPEED_OF_LIGHT / 2.0 * slant_range_time
697
730
cc = coordinate_conversion .interp (azimuth_time = azimuth_time )
698
731
x = slant_range - cc .sr0
0 commit comments