Skip to content

Commit

Permalink
Merge pull request #464 from ASFHyP3/change_nodata_in_rtc_dem
Browse files Browse the repository at this point in the history
Change nodata in rtc dem
  • Loading branch information
cirrusasf authored Aug 14, 2023
2 parents 1c653f5 + bd600b0 commit 36adb7d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/)
and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [6.2.4]

### Changed
- Remove the NoData setting in the output dem.tif

## [6.2.3]

### Added
Expand Down
2 changes: 1 addition & 1 deletion hyp3_gamma/dem.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ def prepare_dem_geotiff(output_name: str, geometry: ogr.Geometry, pixel_size: fl

with TemporaryDirectory() as temp_dir:
temp_path = Path(temp_dir)

centroid = geometry.Centroid()
dem_file_paths = get_dem_file_paths(geometry.Buffer(0.15))

if geometry.GetGeometryName() == 'MULTIPOLYGON':
centroid = get_centroid_crossing_antimeridian(geometry)

dem_file_paths = shift_for_antimeridian(dem_file_paths, temp_path)

dem_vrt = temp_path / 'dem.vrt'
Expand Down
4 changes: 3 additions & 1 deletion hyp3_gamma/rtc/rtc_sentinel.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def prepare_dem(safe_dir: str, dem_name: str, bbox: List[float] = None, dem: str
geometry = ogr.CreateGeometryFromWkt(wkt)
else:
geometry = get_geometry_from_kml(f'{safe_dir}/preview/map-overlay.kml')

prepare_dem_geotiff(dem_tif, geometry, pixel_size)
run(f'dem_import {dem_tif} {dem_image} {dem_par} - - $DIFF_HOME/scripts/egm2008-5.dem '
f'$DIFF_HOME/scripts/egm2008-5.dem_par - - - 1')
Expand Down Expand Up @@ -390,7 +391,8 @@ def rtc_sentinel_gamma(safe_dir: str, resolution: float = 30.0, radiometry: str
if include_dem:
with NamedTemporaryFile() as temp_file:
run(f'data2geotiff dem_seg.par dem_seg 2 {temp_file.name}')
gdal.Translate(f'{product_name}/{product_name}_dem.tif', temp_file.name, outputType=gdalconst.GDT_Int16)
gdal.Translate(f'{product_name}/{product_name}_dem.tif', temp_file.name, noData="none",
outputType=gdalconst.GDT_Int16)
if include_inc_map:
run(f'data2geotiff dem_seg.par corrected.inc_map 2 {product_name}/{product_name}_inc_map.tif')
if include_scattering_area:
Expand Down

0 comments on commit 36adb7d

Please sign in to comment.