Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Julien Michel
sensorsio
Commits
fdf44996
Commit
fdf44996
authored
Dec 24, 2021
by
Jordi Inglada
Browse files
TEST: write the merged SRTM DEM
parent
81237a7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/test_dem.py
View file @
fdf44996
import
pytest
import
src.sensorsio.srtm
as
srtm
import
rasterio
as
rio
def
test_srtm_id_to_name
():
...
...
@@ -30,3 +31,22 @@ def test_srtm_tiles_from_mgrs_tile():
assert
build_tile_list
(
"19GEP"
)
==
[
'S43W070'
,
'S43W069'
,
'S43W068'
,
'S42W070'
,
'S42W069'
,
'S42W068'
]
def
test_generate_dem
():
dem_handler
=
srtm
.
SRTM
()
dem
=
dem_handler
.
get_dem_for_mgrs_tile
(
"31TCJ"
)
with
rio
.
open
(
"/tmp/dem.tif"
,
'w'
,
driver
=
'GTiff'
,
height
=
dem
.
elevation
.
shape
[
0
],
width
=
dem
.
elevation
.
shape
[
1
],
count
=
3
,
nodata
=-
32768.0
,
dtype
=
dem
.
elevation
.
dtype
,
compress
=
'lzw'
,
crs
=
'+proj=latlong'
,
transform
=
dem
.
transform
)
as
ds
:
ds
.
write
(
dem
.
elevation
,
1
)
ds
.
write
(
dem
.
slope
,
2
)
ds
.
write
(
dem
.
aspect
,
3
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment