shade.rel.sh(1) 	      Grass User's Manual	       shade.rel.sh(1)



NNAAMMEE
       sshhaaddee..rreell..sshh  - Creates a shaded relief map based on current resolution
       settings and sun altitude and azimuth values entered by the user.
       _(_G_R_A_S_S _S_h_e_l_l _S_c_r_i_p_t_)

SSYYNNOOPPSSIISS
       sshhaaddee..rreell..sshh

       sshhaaddee..rreell..sshh hheellpp

       sshhaaddee..rreell..sshh    [aallttiittuuddee==_v_a_l_u_e]    [aazziimmuutthh==_v_a_l_u_e]    [eelleevvaattiioonn==_n_a_m_e]
       [sshhaaddee==_v_a_l_u_e_|_m_|_f]

DDEESSCCRRIIPPTTIIOONN
       _s_h_a_d_e_._r_e_l_._s_h  is  a  Bourne  shell (sh(1)) script that creates a raster
       shaded relief map based on current resolution settings and on sun alti-
       tude and azimuth values entered by the user.  The new shaded relief map
       is named _._s_h_a_d_e and stored in the user's current mapset.   The  map  is
       assigned a grey-scale color table.


       If  no parameters are provided on startup, this program is interactive;
       thus if the user enters the command: sshhaaddee..rreell..sshh

       The program then prompts the user to enter values for:

	      The aallttiittuuddee of the sun in degrees above the  horizon  (a  value
	      between 0 and 90 degrees), and

	      The  aazziimmuutthh of the sun in degrees to the east of north (a value
	      between -1 and 360 degrees).

	      The name of a raster map layer whose cell category values are to
	      provide  eelleevvaattiioonn values for the shaded relief map.  Typically,
	      this would be a map layer of elevation;  however, any raster map
	      layer can be named.

	      The  scaling  parameter, which compensates for a different hori-
	      zontal ssccaallee than vertical scale.  For example, when a latitude-
	      longitude  projection  is used with an elevation map measured in
	      meters.  If 'scale' is a number then the	ewres  and  nsres  are
	      multiplied by that scale to calculate the shading. If 'scale' is
	      the letter M (either case) the number of meters in a  degree  of
	      latitude	is  used  as  the  scale.   If 'scale' is the letter F
	      (either case) then the number of feet in a degree is used.   The
	      script  scales  latitude	and  longitude	equally,  so it's only
	      approximately right, but for shading its close enough. It  makes
	      the difference between a usable and unusable shade.

       Specifically, _s_h_a_d_e_._r_e_l_._s_h executes the following _r_._m_a_p_c_a_l_c statement:

       r.mapcalc << EOF

	      $ELEV.shade = eval( \

	      x=($elev[-1,-1] + 2*$elev[0,-1] + $elev[1,-1] \

	      -$elev[-1,1]  - 2*$elev[0,1] - $elev[1,1])/(8.*ewres()*$scale) ,
	      \

	      y=($elev[-1,-1] + 2*$elev[-1,0] + $elev[-1,1] \

	      -$elev[1,-1] - 2*$elev[1,0] - $elev[1,1])/(8.*nsres()*$scale)  ,
	      \

	      slope=90.-atan(sqrt(x*x + y*y)), \

	      a=round(atan(x,y)), \

	      a=if(isnull(a),1,a), \

	      aspect=if(x!=0||y!=0,if(a,a,360.)), \

	      cang  =  sin($alt)*sin(slope)  + cos($alt)*cos(slope) * cos($az-
	      aspect), \

	      if(cang < 0.,0.,100.*cang), \

	      if(isnull(cang), null(), 100.*cang))


       EOF



       Refer to the manual entry for _r_._m_a_p_c_a_l_c for an explanation of the  fil-
       tering  syntax  shown  in  the above expression.  See, for example, the
       section on "The Neighborhood Modifier".


       _s_h_a_d_e_._r_e_l_._s_h then runs _r_._c_o_l_o_r_s to assign a grey-scale color  table  to
       the new shaded relief map _._s_h_a_d_e, by executing the command:


       rr..ccoolloorrss sshhaaddee ccoolloorr==grey


FFIILLEESS
       This  program  is  simply a shell script.  Users are encouraged to make
       their  own  shell  scripts  using  similar   techniques.    See	 $GIS-
       BASE/scripts/shade.rel.sh.

SSEEEE AALLSSOO
       _A_n  _A_l_g_e_b_r_a  _f_o_r  _G_I_S  _a_n_d _I_m_a_g_e _P_r_o_c_e_s_s_i_n_g, by Michael Shapiro and Jim
       Westervelt, U.S.  Army  Construction  Engineering  Research  Laboratory
       (March/1991) (get from GRASS web site).


       _s_h_a_d_e_._c_l_r_._s_h

       _b_l_e_n_d_._s_h

       _g_._a_s_k

       _g_._r_e_g_i_o_n

       _r_._c_o_l_o_r_s

       _r_._m_a_p_c_a_l_c

AAUUTTHHOORR
       Jim Westervelt, U.S. Army Construction Engineering Research Laboratory

       _L_a_s_t _c_h_a_n_g_e_d_: _$_D_a_t_e_: _2_0_0_3_/_0_8_/_2_6 _0_7_:_0_3_:_4_7 _$



GRASS 5.0						       shade.rel.sh(1)
