I have DEM ( Digital Elevation Model ) data, and I want to perform a representation of it, in the form of heatmap or 3d surface.
I have the data converted from the .img DEM using gdal_translate in the following format in plain text csv of near 5000 lines :
-60.9998590004517638,-34.3334731637644026,69,
-60.9995812226737613,-34.3334731637644026,69,
-60.9993034448957587,-34.3334731637644026,70,
-60.9990256671177633,-34.3334731637644026,71,
-60.9987478893397608,-34.3334731637644026,72,
-60.9984701115617582,-34.3334731637644026,72,
-60.9981923337837628,-34.3334731637644026,72,
-60.9979145560057603,-34.3334731637644026,73,
-60.9976367782277649,-34.3334731637644026,73,
-60.9973590004497623,-34.3334731637644026,73,
-60.9970812226717598,-34.3334731637644026,72,
-60.9968034448937644,-34.3334731637644026,73,
-60.9965256671157618,-34.3334731637644026,72,
-60.9962478893377593,-34.3334731637644026,72,
-60.9959701115597639,-34.3334731637644026,70,
-60.9956923337817614,-34.3334731637644026,69,
-60.9954145560037588,-34.3334731637644026,69,
-60.9951367782257634,-34.3334731637644026,71,
-60.9948590004477609,-34.3334731637644026,73,
I want to know how should I proceed to normalize the data ( if its neccesary ) and then represent it as heatmap and/or grid/surface interpolating it.
I do like this kind of representation:
Im a Python developer, and whilet Im not restricted to this language, matplotlib, pandas, and his friends are welcome for myself.
Even when I don't know this field I was trying using this code example from github to represent it and Im not sure if its the correct way to do it.
# Based on example from:
# https://github.com/kjordahl/SciPy2013/blob/master/examples/kauai.py
import os
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from osgeo import gdal
import Image
gdal.UseExceptions()
DEM = gdal.Open("dem.tif")
DEM_Array = DEM.ReadAsArray()
DEM_ArrayM = np.ma.masked_equal(DEM_Array,DEM_Array==0)
i, j = np.where(DEM_ArrayM>0)
topo = DEM_ArrayM[0:max(i)+1, 0:max(j)+1]
fig = plt.figure(frameon=True)
plt.imshow(topo, cmap=cm.gist_earth)
plt.axis('off')
cbar = plt.colorbar(shrink=0.9)
cbar.set_label('meters')
plt.savefig('plot_name.png', dpi=300, bbox_inches='tight')
plt.show()
imshow
orplot_surface