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