Skip to content

Commit

Permalink
feat: remove srtm
Browse files Browse the repository at this point in the history
  • Loading branch information
roelofvandijkO committed Jul 11, 2024
1 parent a004ce1 commit d256f1c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ name: tests
on: [push, pull_request]

jobs:

tests:
env:
GOOGLE_APPLICATION_CREDENTIALS: /tmp/gcloud_key.json
runs-on: ubuntu-latest
steps:
- name: Install dependencies
Expand All @@ -21,6 +23,8 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -e ".[test]"
- name: Import GCS key # for rpcm.dem SRTM lookup
run: echo "${{ secrets.GCR_RW_SERVICEACCOUNT_KEY }}" | base64 -d > ${{ env.GOOGLE_APPLICATION_CREDENTIALS }}
- name: Run tests
run: |
pyproj sync -v --file us_nga_egm96_15
Expand Down
6 changes: 3 additions & 3 deletions s2p/image_coordinates_to_coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from shapely.geometry import Point
import geopy
import geopy.distance
import srtm4
from rpcm.dem import get_srtm_elevations

from rpcm import RPCModel, rpc_from_rpc_file

Expand Down Expand Up @@ -37,7 +37,7 @@ def localize_row_col_geometry(
corrected_lons, corrected_lats = [], []
for (lon, lat), col_idx, row_idx in zip(coords, col_indices, row_indices):

new_altitude = srtm4.srtm4(lon, lat)
new_altitude = get_srtm_elevations([lon], [lat], convert_ellipsoidal=True)
new_lon, new_lat = 0, 0
max_iterations = 10
ground_dist_tol = 50
Expand All @@ -51,7 +51,7 @@ def localize_row_col_geometry(
new_lon, new_lat = rpc_model.localization(
col_idx, row_idx, new_altitude
)
new_altitude = srtm4.srtm4(new_lon, new_lat)
new_altitude = get_srtm_elevations([new_lon], [new_lat], convert_ellipsoidal=True)
ground_distance = geopy.distance.distance(
(old_lat, old_lon), (new_lat, new_lon)
).m
Expand Down
6 changes: 3 additions & 3 deletions s2p/rpc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from pyproj import CRS
import rpcm
import srtm4
from rpcm.dem import get_srtm_elevations

from s2p import geographiclib
from s2p import common
Expand Down Expand Up @@ -198,7 +198,7 @@ def altitude_range(rpc, x, y, w, h, cfg, margin_top=0, margin_bottom=0):
points = [(lon, lat) for lon in np.arange(lon_m, lon_M, s)
for lat in np.arange(lat_m, lat_M, s)]
lons, lats = np.asarray(points).T
alts = srtm4.srtm4(lons, lats) # TODO use srtm4 nn interpolation option
alts = get_srtm_elevations(lons, lats, convert_ellipsoidal=True)
h_m = min(alts) + margin_bottom
h_M = max(alts) + margin_top
else:
Expand Down Expand Up @@ -262,7 +262,7 @@ def roi_process(rpc, ll_poly, use_srtm=False, exogenous_dem=None,
if exogenous_dem_geoid_mode is True:
z = geographiclib.geoid_to_ellipsoid(lat, lon, z)
elif use_srtm:
z = srtm4.srtm4(lon, lat)
z = get_srtm_elevations([lon], [lat], convert_ellipsoidal=True)
else:
z = rpc.alt_offset
img_pts = rpc.projection(ll_poly[:, 0], ll_poly[:, 1], z)
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def finalize_options(self):
'plyflatten>=0.2.0',
'ransac',
'rpcm @ git+https://github.com/20treeAI/[email protected]',
'srtm4',
'requests',
'opencv-python',
'geopandas',
Expand All @@ -63,7 +62,7 @@ def finalize_options(self):
}

setup(name="s2p",
version="1.6.7",
version="1.6.8",
description="Satellite Stereo Pipeline.",
long_description=readme(),
long_description_content_type='text/markdown',
Expand Down

0 comments on commit d256f1c

Please sign in to comment.