comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » How to plot shaded relief image
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
How to plot shaded relief image [message #57830] Fri, 04 January 2008 03:03 Go to next message
Dave[4] is currently offline  Dave[4]
Messages: 38
Registered: December 2007
Member
Dear guys:

How to use IDL to plot shaded relief image, just like
http://denali.gsfc.nasa.gov/gridview/index.html? Thanks very much!


Dave
Re: How to plot shaded relief image [message #57953 is a reply to message #57830] Fri, 04 January 2008 11:29 Go to previous messageGo to next message
Dave[4] is currently offline  Dave[4]
Messages: 38
Registered: December 2007
Member
Yes, Rick. I find this web site, 'http://www.astro.washington.edu/
deutsch-bin/getpro/library09.html?TOPO', It's may be a good start!





On Jan 5, 2:33 am, Rick Towler <rick.tow...@nomail.noaa.gov> wrote:
> Dave wrote:
>> Dear david:
>>     2) I have try the SHADE_SURF with top view, it's good. But I want
>> to find a 2D way to do this.
>
> I'm a little slow, but how can you do this in 2D?  Don't you need to
> generate the shading from a 3D dataset and a light source?
>
> -Rick
Re: How to plot shaded relief image [message #57995 is a reply to message #57830] Thu, 10 January 2008 03:56 Go to previous message
JMB is currently offline  JMB
Messages: 13
Registered: January 2008
Junior Member
Very simple example in easy case:
South illumination, only sun angle (i) can be set:

;*********************************************************** *****
dem=read_tiff('dem.tif')
dims=size(dem,/dimensions)

; Edit a 3x3 gradient operator (vertical)

gradv=[[1,1,1],[0,0,0],[-1,-1,-1]]

; convolution of the dem with the 3x3 matrix

gradient=convol(float(dem),float(gradv))

; Sun angle respect to zenith (0 = vertical light, 90 = horizontal
light)

i=60
cosi=cos(i*!pi/180.)
sini=sin(i*!pi/180.)

; resx = Dem horizontal resolution in meter (needed for normalization)

resx=90 ; SRTM at 90 meter resolution in this test example
resxmat=make_array(dims[0],dims[1],value=2*resx) ; matrix used for the
scalar product

; Computation of the shading matrix:
; Scalar product of incident vector and normal gives cosinus angle

Norm=1/(sqrt(gradient^2+(2*resx)^2)) ; Normalization

costeta=Norm*(cosi*resxmat-sini*gradient)>0

window,0,xsize=dims[0],ysize=dims[1]
tvscl,dem
window,2,xsize=dims[0],ysize=dims[1]
tvscl,costeta

end
;*********************************************************** *****

Cheers,

Jérôme
Re: How to plot shaded relief image [message #58009 is a reply to message #57830] Wed, 09 January 2008 12:28 Go to previous message
JMB is currently offline  JMB
Messages: 13
Registered: January 2008
Junior Member
Hi all,

I have to correct my precedent post.
The "kind of shading matrix" I introduced before is NOT the shading
given by a source of light incident on the DEM,
It is a directional gradient of the DEM. High positive values
correspond to high slopes in uphill direction, low negative values
correspond to high slopes in downhill direction, zero values
correspond to flat areas. The 3x3 matrix operator defines the
direction of the gradient of interest.

I will try to give in a few days a better algorithm to compute shading
on a dem from an incident light defined by a 3D vector.

Cheers,

Jerome
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Problem Accessing Shared Objects
Next Topic: Window IDLDE 7.0 text copy idiosyncrasy

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:18:00 PDT 2025

Total time taken to generate the page: 0.00534 seconds