53
53
/ "measurement"
54
54
/ "s1a-s3-slc-vh-20210401t152855-20210401t152914-037258-04638e-001.tiff"
55
55
)
56
- GRD_IW_VV_annotation = (
56
+ GRD_IW = (
57
57
DATA_FOLDER
58
58
/ "S1B_IW_GRDH_1SDV_20210401T052623_20210401T052648_026269_032297_ECC8.SAFE"
59
+ )
60
+ GRD_IW_VV_annotation = (
61
+ GRD_IW
59
62
/ "annotation"
60
63
/ "s1b-iw-grd-vv-20210401t052623-20210401t052648-026269-032297-001.xml"
61
64
)
@@ -70,6 +73,9 @@ def test_get_fs_path() -> None:
70
73
71
74
assert path == str ((SLC_IW / "manifest.safe" ))
72
75
76
+ with pytest .raises (TypeError ):
77
+ sentinel1 .get_fs_path ("*" , fs = fs , storage_options = {})
78
+
73
79
with pytest .raises (ValueError ):
74
80
sentinel1 .get_fs_path ("non-existent-path/*" )
75
81
@@ -288,14 +294,20 @@ def test_crop_burst_dataset() -> None:
288
294
sentinel1 .crop_burst_dataset (swath_ds , burst_id = 1 )
289
295
290
296
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
+
291
305
def test_calibrate_amplitude () -> None :
292
306
swath_ds = sentinel1 .open_sentinel1_dataset (SLC_IW , group = "IW1/VH" )
293
307
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" )
295
309
296
- res = sentinel1 .calibrate_amplitude (
297
- burst_ds .measurement , calibration_ds ["betaNought" ]
298
- )
310
+ res = sentinel1 .calibrate_amplitude (burst_ds .measurement , cal_ds ["betaNought" ])
299
311
300
312
assert set (res .dims ) == {"azimuth_time" , "slant_range_time" }
301
313
assert np .issubdtype (res .dtype , np .complex64 )
@@ -304,11 +316,50 @@ def test_calibrate_amplitude() -> None:
304
316
def test_calibrate_intensity () -> None :
305
317
swath_ds = sentinel1 .open_sentinel1_dataset (SLC_IW , group = "IW1/VH" )
306
318
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" )
308
327
309
328
res = sentinel1 .calibrate_intensity (
310
- burst_ds .measurement , calibration_ds ["betaNought" ]
329
+ burst_ds .measurement , cal_ds ["betaNought" ], as_db = True
311
330
)
312
331
313
332
assert set (res .dims ) == {"azimuth_time" , "slant_range_time" }
314
333
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