Commit fdf44996 authored by Jordi Inglada's avatar Jordi Inglada
Browse files

TEST: write the merged SRTM DEM

parent 81237a7e
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)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment