Skip to content

Commit 3e270f8

Browse files
authored
Merge pull request #91 from gshiroma/updates_2025
Updates 2025
2 parents e3304e6 + be34866 commit 3e270f8

16 files changed

+726
-89
lines changed

Docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM oraclelinux:8
22

33
LABEL author="OPERA ADT" \
44
description="RTC cal/val release R4" \
5-
version="1.0.3-final"
5+
version="1.0.4-final"
66

77
RUN yum -y update &&\
88
yum -y install curl &&\

Docker/requirements.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
python>=3.9,<3.10
1+
python
22
cmake>=3.18
33
eigen>=3.3
44
fftw>=3.3
@@ -16,9 +16,12 @@ pyre>=1.11.2
1616
pytest
1717
cython
1818
ruamel.yaml
19-
scipy!=1.10.0
19+
scipy
2020
setuptools
2121
shapely
2222
yamale
2323
backoff
24-
isce3==0.15.0
24+
isce3
25+
libnetcdf
26+
libgdal-hdf5
27+
libgdal-netcdf

build_docker_image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
REPO=opera
44
IMAGE=rtc
5-
TAG=final_1.0.3
5+
TAG=final_1.0.4
66

77
echo "IMAGE is $REPO/$IMAGE:$TAG"
88

src/rtc/defaults/rtc_s1.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,6 @@ runconfig:
197197
# OPTIONAL - Choices: "single_block", "geogrid", "geogrid_and_radargrid", and "auto" (default)
198198
memory_mode:
199199

200-
# OPTIONAL - Processing upsampling factor applied to input geogrid
201-
geogrid_upsampling: 1
202-
203200
# Save the incidence angle
204201
save_incidence_angle: False
205202

src/rtc/defaults/rtc_s1_static.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,6 @@ runconfig:
198198
# OPTIONAL - Choices: "single_block", "geogrid", "geogrid_and_radargrid", and "auto" (default)
199199
memory_mode:
200200

201-
# OPTIONAL - Processing upsampling factor applied to input geogrid
202-
geogrid_upsampling: 1
203-
204201
# Save the incidence angle
205202
save_incidence_angle: True
206203

src/rtc/h5_prep.py

Lines changed: 53 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def save_hdf5_file(hdf5_obj, output_hdf5_file, clip_max,
191191
del hdf5_obj[h5_ds]
192192
pol_list_s2 = np.array(pol_list, dtype='S2')
193193
dset = hdf5_obj.create_dataset(h5_ds, data=pol_list_s2)
194-
dset.attrs['description'] = np.string_(
194+
dset.attrs['description'] = np.bytes_(
195195
'List of processed polarization layers')
196196

197197
# save geogrid coordinates
@@ -294,21 +294,21 @@ def create_hdf5_file(product_id, output_hdf5_file, orbit, burst, cfg,
294294
'''
295295

296296
hdf5_obj = h5py.File(output_hdf5_file, 'w')
297-
hdf5_obj.attrs['Conventions'] = np.string_("CF-1.8")
298-
hdf5_obj.attrs["contact"] = np.string_("[email protected]")
299-
hdf5_obj.attrs["institution"] = np.string_("NASA JPL")
300-
hdf5_obj.attrs["project"] = np.string_("OPERA")
301-
hdf5_obj.attrs["reference_document"] = np.string_(
297+
hdf5_obj.attrs['Conventions'] = np.bytes_("CF-1.8")
298+
hdf5_obj.attrs["contact"] = np.bytes_("[email protected]")
299+
hdf5_obj.attrs["institution"] = np.bytes_("NASA JPL")
300+
hdf5_obj.attrs["project"] = np.bytes_("OPERA")
301+
hdf5_obj.attrs["reference_document"] = np.bytes_(
302302
"Product Specification Document for the OPERA Radiometric"
303303
" Terrain-Corrected SAR Backscatter from Sentinel-1,"
304304
" JPL D-108758, Rev. Working Version 1, Aug 31, 2023")
305305

306306
# product type
307307
product_type = cfg.groups.primary_executable.product_type
308308
if product_type == STATIC_LAYERS_PRODUCT_TYPE:
309-
hdf5_obj.attrs["title"] = np.string_("OPERA RTC-S1-STATIC Product")
309+
hdf5_obj.attrs["title"] = np.bytes_("OPERA RTC-S1-STATIC Product")
310310
else:
311-
hdf5_obj.attrs["title"] = np.string_("OPERA RTC-S1 Product")
311+
hdf5_obj.attrs["title"] = np.bytes_("OPERA RTC-S1 Product")
312312

313313
populate_metadata_group(product_id, hdf5_obj, burst, cfg,
314314
processing_datetime, is_mosaic)
@@ -320,23 +320,44 @@ def create_hdf5_file(product_id, output_hdf5_file, orbit, burst, cfg,
320320

321321

322322
def save_orbit(orbit, orbit_group, orbit_file_path):
323+
324+
# ensure that the orbit reference epoch has not fractional part
325+
# otherwise, trancate it to seconds precision
326+
orbit_reference_epoch = orbit.reference_epoch
327+
if orbit_reference_epoch.frac != 0:
328+
logger.warning('the orbit reference epoch is not an'
329+
' integer number. Truncating it'
330+
' to seconds precision and'
331+
' updating the orbit ephemeris'
332+
' accordingly.')
333+
334+
epoch = isce3.core.DateTime(orbit_reference_epoch.year,
335+
orbit_reference_epoch.month,
336+
orbit_reference_epoch.day,
337+
orbit_reference_epoch.hour,
338+
orbit_reference_epoch.minute,
339+
orbit_reference_epoch.second)
340+
341+
orbit.update_reference_epoch(epoch)
342+
323343
orbit.save_to_h5(orbit_group)
344+
324345
# Add description attributes.
325-
orbit_group["time"].attrs["description"] = np.string_(
346+
orbit_group["time"].attrs["description"] = np.bytes_(
326347
"Time vector record. This"
327348
" record contains the time corresponding to position, velocity,"
328349
" acceleration records")
329-
orbit_group["position"].attrs["description"] = np.string_(
350+
orbit_group["position"].attrs["description"] = np.bytes_(
330351
"Position vector"
331352
" record. This record contains the platform position data with"
332353
" respect to WGS84 G1762 reference frame")
333-
orbit_group["velocity"].attrs["description"] = np.string_(
354+
orbit_group["velocity"].attrs["description"] = np.bytes_(
334355
"Velocity vector"
335356
" record. This record contains the platform velocity data with"
336357
" respect to WGS84 G1762 reference frame")
337358
orbit_group.create_dataset(
338359
'referenceEpoch',
339-
data=np.string_(orbit.reference_epoch.isoformat()))
360+
data=np.bytes_(orbit.reference_epoch.isoformat()))
340361

341362
# Orbit source/type
342363
orbit_type = 'Undefined'
@@ -359,9 +380,12 @@ def save_orbit(orbit, orbit_group, orbit_file_path):
359380
orbit_type_list.append(orbit_type_individual)
360381
orbit_type = '; '.join(orbit_type_list)
361382

362-
d = orbit_group.require_dataset("orbitType", (), "S64",
363-
data=np.string_(orbit_type))
364-
d.attrs["description"] = np.string_(
383+
if 'orbitType' in orbit_group:
384+
del orbit_group['orbitType']
385+
d = orbit_group.create_dataset("orbitType",
386+
data=np.bytes_(orbit_type))
387+
388+
d.attrs["description"] = np.bytes_(
365389
"Type of orbit file used in processing")
366390

367391

@@ -1296,11 +1320,11 @@ def populate_metadata_group(product_id: str,
12961320
continue
12971321
if isinstance(data, str):
12981322
dset = h5py_obj.create_dataset(
1299-
path_dataset_in_h5, data=np.string_(data))
1323+
path_dataset_in_h5, data=np.bytes_(data))
13001324
else:
13011325
dset = h5py_obj.create_dataset(path_dataset_in_h5, data=data)
13021326

1303-
dset.attrs['description'] = np.string_(description)
1327+
dset.attrs['description'] = np.bytes_(description)
13041328

13051329

13061330
def save_hdf5_dataset(ds_filename, h5py_obj, root_path,
@@ -1341,7 +1365,11 @@ def save_hdf5_dataset(ds_filename, h5py_obj, root_path,
13411365
logger.warning(f'WARNING Cannot open raster file: {ds_filename}')
13421366
return
13431367

1344-
ds_name = layer_hdf5_dict[layer_name]
1368+
if isinstance(layer_name, str):
1369+
ds_name = layer_hdf5_dict[layer_name]
1370+
else:
1371+
ds_name = [layer_hdf5_dict[l] for l in layer_name]
1372+
13451373
if long_name is not None:
13461374
description = long_name
13471375
else:
@@ -1377,25 +1405,27 @@ def save_hdf5_dataset(ds_filename, h5py_obj, root_path,
13771405
dset = h5py_obj.create_dataset(h5_ds, data=data)
13781406
dset.dims[0].attach_scale(yds)
13791407
dset.dims[1].attach_scale(xds)
1380-
dset.attrs['grid_mapping'] = np.string_("projection")
1408+
dset.attrs['grid_mapping'] = np.bytes_("projection")
13811409

13821410
if standard_name is not None:
1383-
dset.attrs['standard_name'] = np.string_(standard_name)
1411+
dset.attrs['standard_name'] = np.bytes_(standard_name)
13841412

13851413
if long_name is not None:
1386-
dset.attrs['long_name'] = np.string_(long_name)
1414+
dset.attrs['long_name'] = np.bytes_(long_name)
13871415

1388-
dset.attrs['description'] = np.string_(description)
1416+
dset.attrs['description'] = np.bytes_(description)
13891417

13901418
if units is not None:
1391-
dset.attrs['units'] = np.string_(units)
1419+
dset.attrs['units'] = np.bytes_(units)
13921420

13931421
if fill_value is not None:
13941422
dset.attrs.create('_FillValue', data=fill_value)
13951423
elif 'cfloat' in gdal.GetDataTypeName(raster.datatype()).lower():
13961424
dset.attrs.create('_FillValue', data=np.nan + 1j * np.nan)
13971425
elif 'float' in gdal.GetDataTypeName(raster.datatype()).lower():
13981426
dset.attrs.create('_FillValue', data=np.nan)
1427+
elif 'byte' in gdal.GetDataTypeName(raster.datatype()).lower():
1428+
dset.attrs.create('_FillValue', data=255)
13991429

14001430
if stats_vector is not None:
14011431
stats_obj = stats_vector[band]

src/rtc/rtc_s1.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -769,22 +769,21 @@ def run_parallel(cfg: RunConfig, logfile_path, flag_logger_full_format):
769769

770770
if flag_layover_shadow_mask_is_temporary:
771771
temp_files_list.append(layover_shadow_mask_file)
772-
layover_shadow_mask_file = None
773772
else:
774773
burst_output_file_list.append(layover_shadow_mask_file)
775774
logger.info(f'file saved: {layover_shadow_mask_file}')
776775

777-
# Take the layover shadow mask from HDF5 file if not exists
778-
if save_secondary_layers_as_hdf5:
779-
layover_shadow_mask_file = (
780-
f'NETCDF:{burst_hdf5_in_output}:'
781-
f'{DATA_BASE_GROUP}/'
782-
f'{layer_hdf5_dict[LAYER_NAME_LAYOVER_SHADOW_MASK]}')
783-
784-
if save_mask:
785-
output_metadata_dict[
786-
LAYER_NAME_LAYOVER_SHADOW_MASK][1].append(
787-
layover_shadow_mask_file)
776+
# Take the layover shadow mask from HDF5 file if not exists
777+
if save_secondary_layers_as_hdf5:
778+
layover_shadow_mask_file = (
779+
f'NETCDF:{burst_hdf5_in_output}:'
780+
f'{DATA_BASE_GROUP}/'
781+
f'{layer_hdf5_dict[LAYER_NAME_LAYOVER_SHADOW_MASK]}')
782+
783+
if save_mask:
784+
output_metadata_dict[
785+
LAYER_NAME_LAYOVER_SHADOW_MASK][1].append(
786+
layover_shadow_mask_file)
788787

789788
if not save_mask:
790789
layover_shadow_mask_file = None

src/rtc/rtc_s1_single_job.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,6 @@ def run_single_job(cfg: RunConfig):
12141214
cfg.groups.processing.correction_lut_range_spacing_in_meters
12151215

12161216
memory_mode = geocode_namespace.memory_mode
1217-
geogrid_upsampling = geocode_namespace.geogrid_upsampling
12181217
shadow_dilation_size = geocode_namespace.shadow_dilation_size
12191218
abs_cal_factor = geocode_namespace.abs_rad_cal
12201219
clip_max = geocode_namespace.clip_max
@@ -1323,7 +1322,7 @@ def run_single_job(cfg: RunConfig):
13231322

13241323
logger.info('Save layers:')
13251324
logger.info(f' {layer_names_dict[LAYER_NAME_LAYOVER_SHADOW_MASK]}:'
1326-
f' {save_rtc_anf}')
1325+
f' {save_mask}')
13271326
logger.info(f' RTC area normalization factor: {save_rtc_anf}')
13281327
logger.info(f' RTC area normalization factor Gamma0 to Beta0:'
13291328
f' {save_rtc_anf_gamma0_to_sigma0}')
@@ -1719,9 +1718,10 @@ def run_single_job(cfg: RunConfig):
17191718
else:
17201719
burst_output_file_list.append(layover_shadow_mask_file)
17211720
logger.info(f'file saved: {layover_shadow_mask_file}')
1722-
if save_mask:
1723-
output_metadata_dict[LAYER_NAME_LAYOVER_SHADOW_MASK][1].append(
1724-
layover_shadow_mask_file)
1721+
1722+
if save_mask:
1723+
output_metadata_dict[LAYER_NAME_LAYOVER_SHADOW_MASK][1].append(
1724+
layover_shadow_mask_file)
17251725

17261726
if not save_mask:
17271727
layover_shadow_mask_file = None
@@ -1803,6 +1803,8 @@ def run_single_job(cfg: RunConfig):
18031803
geo_obj.geogrid(geogrid.start_x, geogrid.start_y,
18041804
geogrid.spacing_x, geogrid.spacing_y,
18051805
geogrid.width, geogrid.length, geogrid.epsg)
1806+
1807+
geogrid_upsampling = 1
18061808

18071809
geo_obj.geocode(radar_grid=radar_grid,
18081810
input_raster=rdr_burst_raster,
@@ -1848,8 +1850,7 @@ def run_single_job(cfg: RunConfig):
18481850
if product_type != STATIC_LAYERS_PRODUCT_TYPE:
18491851
output_imagery_list.append(geo_burst_filename)
18501852

1851-
if (flag_process and save_mask and
1852-
not save_secondary_layers_as_hdf5):
1853+
if flag_process and save_mask:
18531854
set_mask_fill_value_and_ctable(layover_shadow_mask_file,
18541855
geo_burst_filename)
18551856

src/rtc/runconfig.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ def load_parameters(cfg):
3939
if geocode_namespace.clip_min is None:
4040
geocode_namespace.clip_min = np.nan
4141

42-
if geocode_namespace.geogrid_upsampling is None:
43-
geocode_namespace.geogrid_upsampling = 1.0
44-
4542
if geocode_namespace.memory_mode == 'single_block':
4643
geocode_namespace.memory_mode = \
4744
isce3.core.GeocodeMemoryMode.SingleBlock

src/rtc/schemas/rtc_s1.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,6 @@ geocoding_options:
223223
# Memory mode
224224
memory_mode: enum('auto', 'single_block', 'geogrid', 'geogrid_and_radargrid', required=False)
225225

226-
# Processing upsampling factor on top of the input geogrid
227-
geogrid_upsampling: int(required=False)
228-
229226
# Save the incidence angle
230227
save_incidence_angle: bool(required=False)
231228

0 commit comments

Comments
 (0)