TransWikia.com

Reading same hgt file downloaded from two sources

Geographic Information Systems Asked by Khaled on December 24, 2020

I have two tiles for SRTM1 for the same bounding box region, but downloaded from two sources.

I read a value for a given latitude and longitude with python.
I get always a difference of one meter for the same latitude and longitude, I changed random numbers within the boundary, the same problem remains.
Then I opened both the hgt files with binary viewer, indeed there are not the same in binary.
My question is, which one should I trust and from where comes this error.

My python code:

import numpy as np

#https://e4ftl01.cr.usgs.gov/provisional/MEaSUREs/NASADEM/Africa/hgt_merge/
file_1 = 'n34e036.hgt'   #Source of file is from the link above

#https://cloud.sdsc.edu/v1/AUTH_opentopography/Raster/SRTM_GL1/SRTM_GL1_srtm/North/North_30_60/
file_2 = 'N34E036.hgt'   #Source of file is from the link above

SAMPLES = 3601 # Change this to 1201 for SRTM3

def read_elevation_from_file(hgt_file, lon, lat):
    with open(hgt_file, 'rb') as hgt_data:
        # Each data is 16bit signed integer(i2) - big endian(>)
        elevations = np.fromfile(hgt_data, np.dtype('>i2'), SAMPLES*SAMPLES).reshape((SAMPLES, SAMPLES))
        lat_row = int(round((lat - int(lat)) * (SAMPLES - 1), 0))
        lon_row = int(round((lon - int(lon)) * (SAMPLES - 1), 0))
    return elevations[SAMPLES - 1 - lat_row, lon_row].astype(int)

#test example
lat = 34.0 + (3599.0/3600.0)
lon = 36.0 + (4.0/3600.0)

elv_1 = read_elevation_from_file(file_1,lon,lat)
elv_2 = read_elevation_from_file(file_2,lon,lat)

print(elv_1)  # this yields 423
print(elv_2)  # this yields 422

Edit: I tried also for tile N52E009.hgt, there is also difference but here for two meters.

In binary viewer:
The right side is for file_2 and the left side for file_1
viewed as binary

One Answer

You should trust the one from NASA's MEaSUREs project.

Both dataset are based on the data collected by the space Shuttle in February 2000 (SRTM mission) but the processing and calibration procedure is different, and perhaps those differences account for the 1 meter offset you are observing. But the MEaSUREs NASADEM objective was precisely to re-process SRTM data with the latest technology and more calibration and validation data. Therefore, I would trust that one.

Answered by Camilo Rada on December 24, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP