0

I am trying to topographically correct my already atmospherically and radiometrically corrected images. To do so I need to calculate illumination conditions at the time of image acquisition. Terms in this equation are slope and aspect. The two files are stored in a raster ENVI file format, generated from a ASTER-II DEM in ArcGIS. There are other lines beforehand where i define wdir and other variables, but assume that everything works super smooth until this point. Code is:

rgb = np.stack([refl_surf[5,:,:],refl_surf[3,:,:],refl_surf[2,:,:]],  axis=2)  
imshow(rgb)
show()

def enviread(datafile, hdrfile):
   info = envi.open(wdir+hdrfile, wdir+datafile)
   data = info.load()
   return data, info


[slope,info1]=enviread('Slope_DEM_UT11.dat','Slope_DEM_UT11.hdr')
[aspect,info1]=enviread('Aspect_DEM_U11.dat','Aspect_DEM_U11.hdr') 

fig = plt.figure()

plt.subplot(121)
imshow(np.squeeze(slope))
colorbar()

plt.subplot(122)
imshow(np.squeeze(aspect))
colorbar()

plt.show()

When showing the images, instead of some topography I see just the following yellow image:

enter image description here

This is wrong because when I do it with the slope and aspect maps, provided by my teacher, running the same code they display like so: enter image description here

It must be something I've done while generating the slope and aspect but what can it be?

Slope and aspect display without any problems in ArcGIS.

DEM Coordinate system was converted from its original geographic one to the UTM zone where my study area is before extracting any of the derivatives.


It turns out I was looking not at the exported ENVI files, but at my original images. Apparently exporting to an ENVI file format messes the images up, they show just a black monotone image even in ArcGIS.

Is this some kind of inherent flaw of exporting to ENVI?

1

Ok, the solution found its way through a series of modes. The first thing to become apparent is that there is some clear offset between my satellite image and the DEM I was using in the sense that they did not overlap. This causes the distortion on the edges of the image, making it impossible to display properly. Strictly speaking the pixel values are there, but the scale is off, because of the edges effect. A simple solution to this would be to clip the DEM raster and satellite image so that they overlap exactly (same cell size, same columns and rows, same extent). Once that was accomplished (I suggest using gdalwarp) the images displayed, the topographic correction ran and everyone lived happily ever after.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.