From f5a4bd9e49a5306a684db61ee741d3e383df2838 Mon Sep 17 00:00:00 2001 From: "Gustavo H. X. Shiroma" Date: Fri, 16 May 2025 18:29:11 -0700 Subject: [PATCH 1/3] set `epsg_out` when calling Rdr2Geo --- src/rtc/rtc_s1_single_job.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rtc/rtc_s1_single_job.py b/src/rtc/rtc_s1_single_job.py index 098514f..626f677 100755 --- a/src/rtc/rtc_s1_single_job.py +++ b/src/rtc/rtc_s1_single_job.py @@ -915,6 +915,7 @@ def compute_layover_shadow_mask(radar_grid: isce3.product.RadarGridParameters, orbit, ellipsoid, grid_doppler, + epsg_out=dem_raster.get_epsg(), threshold=threshold_rdr2geo, numiter=numiter_rdr2geo, extraiter=extraiter_rdr2geo, From 5f21d527d0ffb1018076c01daf84784532939a82 Mon Sep 17 00:00:00 2001 From: "Gustavo H. X. Shiroma" Date: Mon, 19 May 2025 10:44:23 -0700 Subject: [PATCH 2/3] ensure that the to compute the layover/shadow mask matches the DEM's EPSG code --- src/rtc/h5_prep.py | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/src/rtc/h5_prep.py b/src/rtc/h5_prep.py index 61fdb6f..7aa8f08 100644 --- a/src/rtc/h5_prep.py +++ b/src/rtc/h5_prep.py @@ -181,7 +181,7 @@ def save_hdf5_file(hdf5_obj, output_hdf5_file, clip_max, del hdf5_obj[h5_ds] pol_list_s2 = np.array(pol_list, dtype='S2') dset = hdf5_obj.create_dataset(h5_ds, data=pol_list_s2) - dset.attrs['description'] = np.string_( + dset.attrs['description'] = np.bytes_( 'List of processed polarization layers') # save geogrid coordinates @@ -284,11 +284,11 @@ def create_hdf5_file(product_id, output_hdf5_file, orbit, burst, cfg, ''' hdf5_obj = h5py.File(output_hdf5_file, 'w') - hdf5_obj.attrs['Conventions'] = np.string_("CF-1.8") - hdf5_obj.attrs["contact"] = np.string_("operasds@jpl.nasa.gov") - hdf5_obj.attrs["institution"] = np.string_("NASA JPL") - hdf5_obj.attrs["project"] = np.string_("OPERA") - hdf5_obj.attrs["reference_document"] = np.string_( + hdf5_obj.attrs['Conventions'] = np.bytes_("CF-1.8") + hdf5_obj.attrs["contact"] = np.bytes_("operasds@jpl.nasa.gov") + hdf5_obj.attrs["institution"] = np.bytes_("NASA JPL") + hdf5_obj.attrs["project"] = np.bytes_("OPERA") + hdf5_obj.attrs["reference_document"] = np.bytes_( "Product Specification Document for the OPERA Radiometric" " Terrain-Corrected SAR Backscatter from Sentinel-1," " JPL D-108758, Rev. Working Version 1, Aug 31, 2023") @@ -296,9 +296,9 @@ def create_hdf5_file(product_id, output_hdf5_file, orbit, burst, cfg, # product type product_type = cfg.groups.primary_executable.product_type if product_type == STATIC_LAYERS_PRODUCT_TYPE: - hdf5_obj.attrs["title"] = np.string_("OPERA RTC-S1-STATIC Product") + hdf5_obj.attrs["title"] = np.bytes_("OPERA RTC-S1-STATIC Product") else: - hdf5_obj.attrs["title"] = np.string_("OPERA RTC-S1 Product") + hdf5_obj.attrs["title"] = np.bytes_("OPERA RTC-S1 Product") populate_metadata_group(product_id, hdf5_obj, burst, cfg, processing_datetime, is_mosaic) @@ -310,23 +310,24 @@ def create_hdf5_file(product_id, output_hdf5_file, orbit, burst, cfg, def save_orbit(orbit, orbit_group, orbit_file_path): + return orbit.save_to_h5(orbit_group) # Add description attributes. - orbit_group["time"].attrs["description"] = np.string_( + orbit_group["time"].attrs["description"] = np.bytes_( "Time vector record. This" " record contains the time corresponding to position, velocity," " acceleration records") - orbit_group["position"].attrs["description"] = np.string_( + orbit_group["position"].attrs["description"] = np.bytes_( "Position vector" " record. This record contains the platform position data with" " respect to WGS84 G1762 reference frame") - orbit_group["velocity"].attrs["description"] = np.string_( + orbit_group["velocity"].attrs["description"] = np.bytes_( "Velocity vector" " record. This record contains the platform velocity data with" " respect to WGS84 G1762 reference frame") orbit_group.create_dataset( 'referenceEpoch', - data=np.string_(orbit.reference_epoch.isoformat())) + data=np.bytes_(orbit.reference_epoch.isoformat())) # Orbit source/type orbit_type = 'Undefined' @@ -350,8 +351,8 @@ def save_orbit(orbit, orbit_group, orbit_file_path): orbit_type = '; '.join(orbit_type_list) d = orbit_group.require_dataset("orbitType", (), "S64", - data=np.string_(orbit_type)) - d.attrs["description"] = np.string_( + data=np.bytes_(orbit_type)) + d.attrs["description"] = np.bytes_( "Type of orbit file used in processing") @@ -1286,11 +1287,11 @@ def populate_metadata_group(product_id: str, continue if isinstance(data, str): dset = h5py_obj.create_dataset( - path_dataset_in_h5, data=np.string_(data)) + path_dataset_in_h5, data=np.bytes_(data)) else: dset = h5py_obj.create_dataset(path_dataset_in_h5, data=data) - dset.attrs['description'] = np.string_(description) + dset.attrs['description'] = np.bytes_(description) def save_hdf5_dataset(ds_filename, h5py_obj, root_path, @@ -1367,18 +1368,18 @@ def save_hdf5_dataset(ds_filename, h5py_obj, root_path, dset = h5py_obj.create_dataset(h5_ds, data=data) dset.dims[0].attach_scale(yds) dset.dims[1].attach_scale(xds) - dset.attrs['grid_mapping'] = np.string_("projection") + dset.attrs['grid_mapping'] = np.bytes_("projection") if standard_name is not None: - dset.attrs['standard_name'] = np.string_(standard_name) + dset.attrs['standard_name'] = np.bytes_(standard_name) if long_name is not None: - dset.attrs['long_name'] = np.string_(long_name) + dset.attrs['long_name'] = np.bytes_(long_name) - dset.attrs['description'] = np.string_(description) + dset.attrs['description'] = np.bytes_(description) if units is not None: - dset.attrs['units'] = np.string_(units) + dset.attrs['units'] = np.bytes_(units) if fill_value is not None: dset.attrs.create('_FillValue', data=fill_value) From 836e3f404a6b8719a962a2e674c1e0767f686111 Mon Sep 17 00:00:00 2001 From: "Gustavo H. X. Shiroma" Date: Wed, 21 May 2025 17:57:42 -0700 Subject: [PATCH 3/3] revert changes to h5_prep.py --- src/rtc/h5_prep.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rtc/h5_prep.py b/src/rtc/h5_prep.py index a236dbb..8cee659 100644 --- a/src/rtc/h5_prep.py +++ b/src/rtc/h5_prep.py @@ -320,6 +320,7 @@ def create_hdf5_file(product_id, output_hdf5_file, orbit, burst, cfg, def save_orbit(orbit, orbit_group, orbit_file_path): + # ensure that the orbit reference epoch has not fractional part # otherwise, trancate it to seconds precision orbit_reference_epoch = orbit.reference_epoch