2424ONE_SECOND = np .timedelta64 (1 , "s" )
2525
2626
27+ DataArrayOrDataset = T .TypeVar ("DataArrayOrDataset" , xr .DataArray , xr .Dataset )
28+
29+
2730def get_fs_path (
2831 urlpath_or_path : esa_safe .PathType ,
2932 fs : T .Optional [fsspec .AbstractFileSystem ] = None ,
@@ -551,7 +554,7 @@ def open_pol_dataset(
551554
552555
553556def find_bursts_index (
554- pol_dataset : xr . Dataset ,
557+ pol_dataset : DataArrayOrDataset ,
555558 azimuth_anx_time : float ,
556559 use_center : bool = False ,
557560) -> int :
@@ -573,15 +576,16 @@ def find_bursts_index(
573576
574577
575578def crop_burst_dataset (
576- pol_dataset : xr . Dataset ,
579+ pol_dataset : DataArrayOrDataset ,
577580 burst_index : T .Optional [int ] = None ,
578581 azimuth_anx_time : T .Optional [float ] = None ,
579582 use_center : bool = False ,
580583 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+
584587 Only one keyword between 'burst_index' and 'azimuth_anx_time' and 'burst_id' must be defined.
588+
585589 :param xr.Dataset pol_dataset: measurement dataset
586590 :param int burst_index: burst index can take values from 1 to the number of bursts
587591 :param float azimuth_anx_time: azimuth anx time of first line of the bursts
@@ -643,7 +647,9 @@ def crop_burst_dataset(
643647 return ds
644648
645649
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 :
647653 bursts = []
648654 for i in range (slc_iw_image .attrs ["number_of_bursts" ]):
649655 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:
654660def calibrate_amplitude (
655661 digital_number : xr .DataArray , calibration_lut : xr .DataArray
656662) -> 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+
658665 :param digital_number: digital numbers to be calibrated
659666 :param calibration_lut: calibration LUT (sigmaNought, betaNought or gamma).
667+
660668 The LUT can be opened using the measurement sub-group `calibration`
661669 """
662670 calibration = calibration_lut .interp (
@@ -680,8 +688,8 @@ def calibrate_intensity(
680688 as_db : bool = False ,
681689 min_db : T .Optional [float ] = - 40.0 ,
682690) -> 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+
685693 :param digital_number: digital numbers to be calibrated
686694 :param calibration_lut: calibration LUT (sigmaNought, betaNought or gamma).
687695 The LUT can be opened using the measurement sub-group `calibration`.
@@ -712,14 +720,12 @@ def slant_range_time_to_ground_range(
712720 slant_range_time : xr .DataArray ,
713721 coordinate_conversion : xr .Dataset ,
714722) -> 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+
718725 :param azimuth_time: azimuth time coordinates
719726 :param slant_range_time: slant range time
720727 :param coordinate_conversion: coordinate conversion dataset.
721728 The coordinate conversion dataset can be opened using the measurement sub-groub `coordinate_conversion`
722- :return:
723729 """
724730 slant_range = SPEED_OF_LIGHT / 2.0 * slant_range_time
725731 cc = coordinate_conversion .interp (azimuth_time = azimuth_time )
0 commit comments