5353 / "measurement"
5454 / "s1a-s3-slc-vh-20210401t152855-20210401t152914-037258-04638e-001.tiff"
5555)
56- GRD_IW_VV_annotation = (
56+ GRD_IW = (
5757 DATA_FOLDER
5858 / "S1B_IW_GRDH_1SDV_20210401T052623_20210401T052648_026269_032297_ECC8.SAFE"
59+ )
60+ GRD_IW_VV_annotation = (
61+ GRD_IW
5962 / "annotation"
6063 / "s1b-iw-grd-vv-20210401t052623-20210401t052648-026269-032297-001.xml"
6164)
@@ -70,6 +73,9 @@ def test_get_fs_path() -> None:
7073
7174 assert path == str ((SLC_IW / "manifest.safe" ))
7275
76+ with pytest .raises (TypeError ):
77+ sentinel1 .get_fs_path ("*" , fs = fs , storage_options = {})
78+
7379 with pytest .raises (ValueError ):
7480 sentinel1 .get_fs_path ("non-existent-path/*" )
7581
@@ -288,14 +294,20 @@ def test_crop_burst_dataset() -> None:
288294 sentinel1 .crop_burst_dataset (swath_ds , burst_id = 1 )
289295
290296
297+ def test_mosaic_slc_iw () -> None :
298+ da = sentinel1 .open_sentinel1_dataset (SLC_IW_V340 , group = "IW1/HH" )
299+
300+ res = sentinel1 .mosaic_slc_iw (da )
301+
302+ assert isinstance (res , xr .Dataset )
303+
304+
291305def test_calibrate_amplitude () -> None :
292306 swath_ds = sentinel1 .open_sentinel1_dataset (SLC_IW , group = "IW1/VH" )
293307 burst_ds = sentinel1 .crop_burst_dataset (swath_ds , burst_index = 8 )
294- calibration_ds = sentinel1 .open_calibration_dataset ( SLC_IW1_VV_calibration )
308+ cal_ds = sentinel1 .open_sentinel1_dataset ( SLC_IW , group = "IW1/VH/calibration" )
295309
296- res = sentinel1 .calibrate_amplitude (
297- burst_ds .measurement , calibration_ds ["betaNought" ]
298- )
310+ res = sentinel1 .calibrate_amplitude (burst_ds .measurement , cal_ds ["betaNought" ])
299311
300312 assert set (res .dims ) == {"azimuth_time" , "slant_range_time" }
301313 assert np .issubdtype (res .dtype , np .complex64 )
@@ -304,11 +316,50 @@ def test_calibrate_amplitude() -> None:
304316def test_calibrate_intensity () -> None :
305317 swath_ds = sentinel1 .open_sentinel1_dataset (SLC_IW , group = "IW1/VH" )
306318 burst_ds = sentinel1 .crop_burst_dataset (swath_ds , burst_index = 8 )
307- calibration_ds = sentinel1 .open_calibration_dataset (SLC_IW1_VV_calibration )
319+ cal_ds = sentinel1 .open_sentinel1_dataset (SLC_IW , group = "IW1/VH/calibration" )
320+
321+ res = sentinel1 .calibrate_intensity (burst_ds .measurement , cal_ds ["betaNought" ])
322+
323+ assert set (res .dims ) == {"azimuth_time" , "slant_range_time" }
324+ assert np .issubdtype (res .dtype , np .float32 )
325+
326+ cal_ds ["betaNought" ].attrs .pop ("long_name" )
308327
309328 res = sentinel1 .calibrate_intensity (
310- burst_ds .measurement , calibration_ds ["betaNought" ]
329+ burst_ds .measurement , cal_ds ["betaNought" ], as_db = True
311330 )
312331
313332 assert set (res .dims ) == {"azimuth_time" , "slant_range_time" }
314333 assert np .issubdtype (res .dtype , np .float32 )
334+
335+ res = sentinel1 .calibrate_intensity (
336+ burst_ds .measurement ,
337+ cal_ds ["betaNought" ],
338+ as_db = True ,
339+ min_db = None ,
340+ )
341+
342+ assert np .issubdtype (res .dtype , np .float32 )
343+
344+
345+ def test_slant_range_time_to_ground_range () -> None :
346+ swath_ds = sentinel1 .open_sentinel1_dataset (SLC_IW , group = "IW1/VV" )
347+ swath = swath_ds .measurement [:1000 , :1000 ]
348+ cc_ds = sentinel1 .open_sentinel1_dataset (
349+ GRD_IW , group = "IW/VV/coordinate_conversion"
350+ )
351+
352+ res = sentinel1 .slant_range_time_to_ground_range (
353+ swath .azimuth_time , swath .slant_range_time , cc_ds
354+ )
355+
356+ assert isinstance (res , xr .DataArray )
357+
358+
359+ def test_do_override_product_files () -> None :
360+ template = "{dirname}/{prefix}{swath}-{polarization}{ext}"
361+ _ , product_files = esa_safe .parse_manifest_sentinel1 (SLC_S3 / "manifest.safe" )
362+
363+ res = sentinel1 .do_override_product_files (template , product_files )
364+
365+ assert "./annotation/s3-vv.xml" in res
0 commit comments