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.