24
24
ONE_SECOND = np .timedelta64 (1 , "s" )
25
25
26
26
27
+ DataArrayOrDataset = T .TypeVar ("DataArrayOrDataset" , xr .DataArray , xr .Dataset )
28
+
29
+
27
30
def get_fs_path (
28
31
urlpath_or_path : esa_safe .PathType ,
29
32
fs : T .Optional [fsspec .AbstractFileSystem ] = None ,
@@ -551,7 +554,7 @@ def open_pol_dataset(
551
554
552
555
553
556
def find_bursts_index (
554
- pol_dataset : xr . Dataset ,
557
+ pol_dataset : DataArrayOrDataset ,
555
558
azimuth_anx_time : float ,
556
559
use_center : bool = False ,
557
560
) -> int :
@@ -573,15 +576,16 @@ def find_bursts_index(
573
576
574
577
575
578
def crop_burst_dataset (
576
- pol_dataset : xr . Dataset ,
579
+ pol_dataset : DataArrayOrDataset ,
577
580
burst_index : T .Optional [int ] = None ,
578
581
azimuth_anx_time : T .Optional [float ] = None ,
579
582
use_center : bool = False ,
580
583
burst_id : T .Optional [int ] = None ,
581
- ) -> xr . Dataset :
582
- """
583
- Returns the measurement dataset cropped to the selected burst.
584
+ ) -> DataArrayOrDataset :
585
+ """Return the measurement dataset cropped to the selected burst.
586
+
584
587
Only one keyword between 'burst_index' and 'azimuth_anx_time' and 'burst_id' must be defined.
588
+
585
589
:param xr.Dataset pol_dataset: measurement dataset
586
590
:param int burst_index: burst index can take values from 1 to the number of bursts
587
591
:param float azimuth_anx_time: azimuth anx time of first line of the bursts
@@ -643,7 +647,9 @@ def crop_burst_dataset(
643
647
return ds
644
648
645
649
646
- def mosaic_slc_iw (slc_iw_image : xr .Dataset , crop : int = 90 ) -> xr .Dataset :
650
+ def mosaic_slc_iw (
651
+ slc_iw_image : DataArrayOrDataset , crop : int = 90
652
+ ) -> DataArrayOrDataset :
647
653
bursts = []
648
654
for i in range (slc_iw_image .attrs ["number_of_bursts" ]):
649
655
burst = crop_burst_dataset (slc_iw_image , burst_index = i )
@@ -654,9 +660,11 @@ def mosaic_slc_iw(slc_iw_image: xr.Dataset, crop: int = 90) -> xr.Dataset:
654
660
def calibrate_amplitude (
655
661
digital_number : xr .DataArray , calibration_lut : xr .DataArray
656
662
) -> xr .DataArray :
657
- """Returns the calibrated amplitude. The calibration is done using the calibration LUT in the product metadata.
663
+ """Return the calibrated amplitude. The calibration is done using the calibration LUT in the product metadata.
664
+
658
665
:param digital_number: digital numbers to be calibrated
659
666
:param calibration_lut: calibration LUT (sigmaNought, betaNought or gamma).
667
+
660
668
The LUT can be opened using the measurement sub-group `calibration`
661
669
"""
662
670
calibration = calibration_lut .interp (
@@ -680,8 +688,8 @@ def calibrate_intensity(
680
688
as_db : bool = False ,
681
689
min_db : T .Optional [float ] = - 40.0 ,
682
690
) -> xr .DataArray :
683
- """
684
- Returns the calibrated intensity. The calibration is done using the calibration LUT in the product metadata.
691
+ """Return the calibrated intensity. The calibration is done using the calibration LUT in the product metadata.
692
+
685
693
:param digital_number: digital numbers to be calibrated
686
694
:param calibration_lut: calibration LUT (sigmaNought, betaNought or gamma).
687
695
The LUT can be opened using the measurement sub-group `calibration`.
@@ -712,14 +720,12 @@ def slant_range_time_to_ground_range(
712
720
slant_range_time : xr .DataArray ,
713
721
coordinate_conversion : xr .Dataset ,
714
722
) -> xr .DataArray :
715
- """
716
- Convert the slant range time coordinates to ground range coordinates using the coordinate conversion `sr0`
717
- and `srgrCoefficients` product metadata
723
+ """Convert slant range time to ground range using the coordinate conversion metadata.
724
+
718
725
:param azimuth_time: azimuth time coordinates
719
726
:param slant_range_time: slant range time
720
727
:param coordinate_conversion: coordinate conversion dataset.
721
728
The coordinate conversion dataset can be opened using the measurement sub-groub `coordinate_conversion`
722
- :return:
723
729
"""
724
730
slant_range = SPEED_OF_LIGHT / 2.0 * slant_range_time
725
731
cc = coordinate_conversion .interp (azimuth_time = azimuth_time )
0 commit comments