|
29 | 29 |
|
30 | 30 | LAYER_NAME_VV = 'VV' |
31 | 31 | LAYER_NAME_VH = 'VH' |
| 32 | +LAYER_NAME_HH = 'HH' |
| 33 | +LAYER_NAME_HV = 'HV' |
32 | 34 | LAYER_NAME_LAYOVER_SHADOW_MASK = 'mask' |
33 | 35 | LAYER_NAME_RTC_ANF_GAMMA0_TO_BETA0 = 'rtc_anf_gamma0_to_beta0' |
34 | 36 | LAYER_NAME_RTC_ANF_GAMMA0_TO_SIGMA0 = 'rtc_anf_gamma0_to_sigma0' |
|
46 | 48 | layer_hdf5_dict = { |
47 | 49 | LAYER_NAME_VV: 'VV', |
48 | 50 | LAYER_NAME_VH: 'VH', |
| 51 | + LAYER_NAME_HH: 'HH', |
| 52 | + LAYER_NAME_HV: 'HV', |
49 | 53 | LAYER_NAME_LAYOVER_SHADOW_MASK: 'mask', |
50 | 54 | LAYER_NAME_RTC_ANF_GAMMA0_TO_BETA0: |
51 | 55 | 'rtcAreaNormalizationFactorGamma0ToBeta0', |
|
68 | 72 | layer_names_dict = { |
69 | 73 | LAYER_NAME_VV: 'RTC-S1 VV Backscatter', |
70 | 74 | LAYER_NAME_VH: 'RTC-S1 VH Backscatter', |
| 75 | + LAYER_NAME_HH: 'RTC-S1 HH Backscatter', |
| 76 | + LAYER_NAME_HV: 'RTC-S1 HV Backscatter', |
71 | 77 | LAYER_NAME_LAYOVER_SHADOW_MASK: 'Mask Layer', |
72 | 78 | LAYER_NAME_RTC_ANF_GAMMA0_TO_BETA0: ('RTC Area Normalization Factor' |
73 | 79 | ' Gamma0 to Beta0'), |
|
96 | 102 | ' coefficient normalized to gamma0'), |
97 | 103 | LAYER_NAME_VH: ('Radiometric terrain corrected Sentinel-1 VH backscatter' |
98 | 104 | ' coefficient normalized to gamma0'), |
| 105 | + LAYER_NAME_HH: ('Radiometric terrain corrected Sentinel-1 HH backscatter' |
| 106 | + ' coefficient normalized to gamma0'), |
| 107 | + LAYER_NAME_HV: ('Radiometric terrain corrected Sentinel-1 HV backscatter' |
| 108 | + ' coefficient normalized to gamma0'), |
99 | 109 | LAYER_NAME_LAYOVER_SHADOW_MASK: ('Mask Layer. Values: 0: not' |
100 | 110 | ' masked; 1: shadow; 2: layover;' |
101 | 111 | ' 3: layover and shadow;' |
@@ -310,8 +320,27 @@ def create_hdf5_file(product_id, output_hdf5_file, orbit, burst, cfg, |
310 | 320 |
|
311 | 321 |
|
312 | 322 | def save_orbit(orbit, orbit_group, orbit_file_path): |
313 | | - return |
| 323 | + # ensure that the orbit reference epoch has not fractional part |
| 324 | + # otherwise, trancate it to seconds precision |
| 325 | + orbit_reference_epoch = orbit.reference_epoch |
| 326 | + if orbit_reference_epoch.frac != 0: |
| 327 | + logger.warning('the orbit reference epoch is not an' |
| 328 | + ' integer number. Truncating it' |
| 329 | + ' to seconds precision and' |
| 330 | + ' updating the orbit ephemeris' |
| 331 | + ' accordingly.') |
| 332 | + |
| 333 | + epoch = isce3.core.DateTime(orbit_reference_epoch.year, |
| 334 | + orbit_reference_epoch.month, |
| 335 | + orbit_reference_epoch.day, |
| 336 | + orbit_reference_epoch.hour, |
| 337 | + orbit_reference_epoch.minute, |
| 338 | + orbit_reference_epoch.second) |
| 339 | + |
| 340 | + orbit.update_reference_epoch(epoch) |
| 341 | + |
314 | 342 | orbit.save_to_h5(orbit_group) |
| 343 | + |
315 | 344 | # Add description attributes. |
316 | 345 | orbit_group["time"].attrs["description"] = np.bytes_( |
317 | 346 | "Time vector record. This" |
@@ -350,8 +379,11 @@ def save_orbit(orbit, orbit_group, orbit_file_path): |
350 | 379 | orbit_type_list.append(orbit_type_individual) |
351 | 380 | orbit_type = '; '.join(orbit_type_list) |
352 | 381 |
|
353 | | - d = orbit_group.require_dataset("orbitType", (), "S64", |
354 | | - data=np.bytes_(orbit_type)) |
| 382 | + if 'orbitType' in orbit_group: |
| 383 | + del orbit_group['orbitType'] |
| 384 | + d = orbit_group.create_dataset("orbitType", |
| 385 | + data=np.bytes_(orbit_type)) |
| 386 | + |
355 | 387 | d.attrs["description"] = np.bytes_( |
356 | 388 | "Type of orbit file used in processing") |
357 | 389 |
|
@@ -1332,7 +1364,11 @@ def save_hdf5_dataset(ds_filename, h5py_obj, root_path, |
1332 | 1364 | logger.warning(f'WARNING Cannot open raster file: {ds_filename}') |
1333 | 1365 | return |
1334 | 1366 |
|
1335 | | - ds_name = layer_hdf5_dict[layer_name] |
| 1367 | + if isinstance(layer_name, str): |
| 1368 | + ds_name = layer_hdf5_dict[layer_name] |
| 1369 | + else: |
| 1370 | + ds_name = [layer_hdf5_dict[l] for l in layer_name] |
| 1371 | + |
1336 | 1372 | if long_name is not None: |
1337 | 1373 | description = long_name |
1338 | 1374 | else: |
@@ -1387,6 +1423,8 @@ def save_hdf5_dataset(ds_filename, h5py_obj, root_path, |
1387 | 1423 | dset.attrs.create('_FillValue', data=np.nan + 1j * np.nan) |
1388 | 1424 | elif 'float' in gdal.GetDataTypeName(raster.datatype()).lower(): |
1389 | 1425 | dset.attrs.create('_FillValue', data=np.nan) |
| 1426 | + elif 'byte' in gdal.GetDataTypeName(raster.datatype()).lower(): |
| 1427 | + dset.attrs.create('_FillValue', data=255) |
1390 | 1428 |
|
1391 | 1429 | if stats_vector is not None: |
1392 | 1430 | stats_obj = stats_vector[band] |
|
0 commit comments