Help for RADAGEN

PURPOSE:
RADAGEN transforms a terrain image, in which DN corresponds to altitude, to a
radar image, that is, an image which appears as if imaged by a radar device
over the area represented by the terrain image.

It 1) shades the terrain,
   2) shadows areas hidden from the radar beam,
   3) adds slant range effect,
   4) corrects the slant range by offsets caused by the local terrain.

EXECUTION:

Example

	RADAGEN INP=TERRAIN OUT=RADAR HEIGHT=229. SSCALE=98.4252  	    LSCALE=98.4252 TOFF=0 ZSCALE=3.280840 EL=15.

	This is a typical call to RADAGEN.  HEIGHT is the altitude of 
        the satellite in km; the default is 1100.  SSCALE and LSCALE 
        are the scales in meters/pixel of the terrain image in the 
        sample and line directions, respectively; the default
        for each is 500 meters/pixel.  TOFF specifies the terrain offset;
        if unspecified, RADAGEN will calculate this for you.  ZSCALE
	specifies the altitude scale in the terrain image in meters/dn;
	the default is 30.  EL is the elevation of the radar source
	measured from the vertical perpendicular to the image plane;
	that is, if the satellite is directly overhead, EL equals
	zero degrees; the default for this parameter is 20.

OPERATION

The value of an output (radar) dn is equal to 

	SCALE*COS(THETA)/(SIN(THETA) + .1*COS(THETA))**3.

where

	COS(THETA) = R1/R2
	SIN(THETA) = R3/R2
	
	R2=MAGNITUDE(LxS)
	R1=The dot product of (LxS) and ILLUM_VECTOR
	R=MAGNITUDE((LxS)xILLUM_VECTOR)

	and

	L = (LSCALE*2.,0.,(DN(L+1)-DN(L-1))*ZSCALE)
	S = (0.,SSCALE*2.,(DN(S+1)-DN(S-1))*ZSCALE)

	ILLUM_VECTOR = unit vector pointing to the satellite from the
		terrain image (assumed the same from all pixels of
		the terrain image.)

If the pixel being processed is at L,S (line, sample), then

	DN(L+1) is the pixel dn at L+1,S
	DN(S+1) is the pixel dn at L,S+1

The location of the output pixel whose input is L,S is

	L'=L
	S'=-OUT_SCALE*A(S)+DN(L,S)*ZSCALE*B(S)

	where

	B(i)=SATELLITE_HEIGHT/R(i)
	A(i)=TOTAL_PIXELS_OUT*SSCALE-(R(i)-AUGMENTED_HT)
	R(i)=SQRT(((N_INPUT_SAMPLES-i) *
	    SSCALE+NADIR_OFFSET)**2.+SATELLITE_HEIGHT**2.)
	AUGMENTED_HT = SQRT(NADIR_OFFSET**2.  	    SATELLITE_HEIGHT**2.)
	TOTAL_PIXELS_OUT = (SQRT((NADIR_OFFSET+N_INPUT_SAMPLES *
	    SSCALE)**2.+SATTELITE_HEIGHT**2.) -
	    AUGMENTED_HT)/SSCALE

or in summary:

	output position = TOTA-(T'-A)+H*SIN(THETA)

	where

	TOTA=TOT-A
	TOT	the slant range to the terrain image left edge;
	A	the slant range to the terrain image right edge;
	T'	the slant range to the terrain sample;
	H	the terrain altitude at that sample;
	THETA	the angle between the illumination vector and
		the local terrain normal.

RESTRICTIONS:

H*SIN(THETA), above, is the local terrain correction, an approximation
which is good when the satellite altitude >> local terrain altitude.


TOPO LOCATOR MAP DESCRIPTION:

RADAGEN can also create a second output, a topo locator map to the simulated 
radar image.  This topo locator map contains the sample location in the 
simulated radar image of the corresponding pixel in the original digital 
terrain image.

You may have
          topo            simulated radar
        1 pixel     --->    1 pixel
        many pixels --->    1 pixel

   Example:

	      topo	      simulated radar	    locator map
        -----------------   ------------------   ------------------
        | s1  s2        |   |      s8    s12 |   |      s8    s12 |
        | __  __        |   |      __    __  |   |      __    __  |
        ||  ||  |       |   |     |  |  |  | |   |     |s1|  |s2| |
        | --  --        |   |      --  ^ --  |   |      --  ^ --  |
        | p1  p2        |   |      p1  | p2  |   |      p1  | p2  |
        -----------------   -----------+-------  -----------+------
                                       |                    |
			         interpolates      chooses s1 or s2
 
   s1 - sample 1    p1 - pixel 1
   s2 - sample 2    p2 - pixel 2

   Take two pixels from the topo data, p1 and p2, which are located at
   samples s1 and s2.  p1 has moved from sample location s1 to sample
   location s8 in the simulated radar image.  p2 has moved from sample 
   location s2 to sample location s12.  Pixels change only in the sample 
   direction, not in the line direction.  The maximum DN value of these 
   two pixels in the simulated radar is 254 for byte data and 16383 for
   halfword data.  The topo locator map shows that the pixel in sample
   location s8 came from sample s1 in the topo data, and the pixel in 
   sample location s12 came from sample s2 in the topo data.
   
   This example only shows what may happen to two pixels.  Actually many
   topo samples may contribute to the same pixel in the simulated radar.
   Therefore, one pixel in the simulated radar may come from the addition
   of all the radar DN's for several topo samples.  Since the locator map
   cannot keep track of all the topo samples which may contribute to one 
   pixel, it only saves the last sample which contributes to the one pixel.

   After all the topo image pixels have been assigned, there may be "holes"
   in the simulated radar image and topo locator map.  (as shown in the above
   diagram)  The subroutine RESAMP0 fills in all the zero DN's (the holes).
   It fills in zeros in the simulated radar by interpolating.  The locator 
   map is filled in by choosing one of the the nearby non-zero values.  The 
   zeros on the ends of the image and locator map are filled in with the 
   closest non-zero DN value.
 


WRITTEN BY:  Michael Girard, 27 January 1981
COGNIZANT PROGRAMMER:  Michael Girard
REVISION:  1.1		unknown date
CONVERTED TO VICAR2:	January 1986;  Jan Heyada
REVISION:  2.1		July 1986; Kurt Andersen
REVISION                5-SEPT-94 Randy Schenk (CRI)


PARAMETERS:


INP

STRING - Input image file

OUT

STRING - Output image file and optional topo locator map

REF

STRING - Reference image file

UPDATE

STRING - Update file !

PROJECT

KEYWORD - Project specific processing to be used (MAGELLAN only current option)

RECTIFY

KEYWORD - Correct the output image to projection of input image

DOMAIN

KEYWORD - LINEAR or LOG output

FILL

KEYWORD - Fill the end of lines with the last value !

SIZE

INTEGER - Standard VICAR size field

SL

INTEGER - Starting line

SS

INTEGER - Starting sample

NS

INTEGER - Number of samples

NL

INTEGER - Number of lines !

EL

REAL - Elevation of radar source from vertical (overhead = 0 deg)

TOP

REAL - Value to be scaled to maximum output dn -- overridden by SCALE parameter

HEIGHT

REAL - Satellite altitude in km

SSCALE

REAL - Real scale in m/pixel in sample direction

LSCALE

REAL - Real scale in m/pixel in line direction

ZSCALE

REAL - Altitude scale in terrain image in m/dn

SCALE

REAL - Dn scale in radar image

TOFF

REAL - Terrain offset !

MISCORR

REAL - Ration of miscorrection to sample number across line

PERIOD

INTEGER - Oscillation period for miscorrection in lines

DEGREE

REAL - Fraction of miscorrection affected by oscillation Valid: 0.0 to 1.0

LOG_SC

REAL - Scaling into log domain (dB/dn)

OFMT

KEYWORD - The data format of the output image, BYTE or HALF.

See Examples:


Cognizant Programmer: