
    nj,                         S SK r S SKrS SKrS SKJrJr  \R                  \l        S r	S r
\R                  4S jr\S:X  a#  \R                  " \" \R                  5      5        gg)    N)gdal
gdal_arrayc                     [        S5        [        S5        [        S5        [        S5        [        S5        [        S5        [        S5        [        S5        [        S	5        [        S
5        [        S5        [        S5        [        S5        [        S5        [        S5        [        S5        [        S5        [        S5        g)Nz>Usage: rel.py -lsrcaz azimuth -lsrcel elevation [-elstep step]zB       [-dx xsize] [-dy ysize] [-b band] [-ot type] infile outfilez1Produce a shaded relief image from elevation data zN  -lsrcaz azimuth   Azimuth angle of the diffuse light source (0..360 degrees)zP  -lsrcel elevation Elevation angle of the diffuse light source (0..180 degrees)zP  -elstep step      Elevation change corresponding to a change of one grey levelz                    (default 1)zM  -dx xsize         X and Y dimensions (in meters) of one pixel on the groundzC  -dy ysize         (taken from the geotransform matrix by default)z>  -r range	       Dynamic range for output image (default 255)z<  -b band	       Select a band number to convert (default 1)z1  -ot type	       Data type of the output datasetzD                    (Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/zF                     CInt16/CInt32/CFloat32/CFloat64, default is Byte)z&  infile	       Name of the input filez(  outfile	       Name of the output file   )print     S/var/www/html/pdf-tiff/venv/lib/python3.13/site-packages/osgeo_utils/samples/rel.pyUsager   -   s    	
JK	
NO	
=>	"I	X 
Z 
Z 

+,	W 

OP	
JK	
HI	
=>	
PQ	
RS	
23	
45	"Ir
   c                    U S:X  a  [         R                  $ U S:X  a  [         R                  $ U S:X  a  [         R                  $ U S:X  a  [         R                  $ U S:X  a  [         R
                  $ U S:X  a  [         R                  $ U S:X  a  [         R                  $ U S:X  a  [         R                  $ U S	:X  a  [         R                  $ U S
:X  a  [         R                  $ U S:X  a  [         R                  $ [         R                  $ )NByteInt16UInt16Int32UInt32Float32Float64CInt16CInt32CFloat32CFloat64)r   GDT_Byte	GDT_Int16
GDT_UInt16	GDT_Int32
GDT_UInt32GDT_Float32GDT_Float64
GDT_CInt16
GDT_CInt32GDT_CFloat32GDT_CFloat64)typs    r   	ParseTyper%   K   s    
f}}}
g~~~
h
g~~~
h
i
i
h
h
j   
j   ==r
   c           	      P   S nS nSnSn[         R                  nS nS nSnS n	S n
SnSnU[        U 5      :  a  X   nUS:X  a  US-  n[        X   5      nOUS:X  a  US-  n[	        X   5      nOUS:X  a  US-  n[        X   5      nOUS:X  a  US-  n[        X   5      nOzUS	:X  a  US-  n[        X   5      nOaUS
:X  a  US-  n[        X   5      n	OHUS:X  a  US-  n[        X   5      n
O/US:X  a  US-  n[        X   5      nOUc  UnOUc  UnO
[        5       $ US-  nU[        U 5      :  a  M  Uc
  [        5       $ Uc
  [        5       $ Uc
  [        5       $ Uc
  [        5       $ US-  [        R                  -  nUS-  [        R                  -  n[        R                  " U5      * [        R                  " U5      -  n[        R                  " U5      [        R                  " U5      -  n[        R                  " U5      n[        R                  " US-  US-  -   US-  -   5      n[         R                  " U[         R                  5      nUc  [        SU5        gUR                  S:  d  UR                   S:  a  [        S5        g[         R"                  " U5      nUR%                  UUR                  UR                   UR&                  U5      nUR)                  S5      nUR+                  5       nUR-                  5       nU	c  [/        US   5      n	U
c  [/        US   5      n
UR)                  U5      nUc  [        SUSU5        g[0        R2                  " U5      n[4        R6                  " SUR8                  4U5      nUR;                  SSUR8                  SUR8                  S5      S   nUR=                  USS5        [         R>                  " S5        UR;                  SSUR8                  SUR8                  S5      S   nUR=                  USUR@                  S-
  5        [         R>                  " SUR@                  -  5        SU	-  nSU
-  n[C        SUR@                  S-
  5       GH  nUR;                  SUS-   UR8                  SUR8                  S5      S   nUSS USS  -
  U-  n USS USS -
  U-  n!U* U -  n"UU!-  n#UU-  n$U"U"-  U#U#-  -   U$U$-  -   n%U"U-  U#U-  -   U$U-  -   n&UU&U[4        R                  " U%5      -  -  -  n'[4        RD                  " U'SU5      n'U'RG                  U5      USSS24'   UR=                  USU5        UnUn[         R>                  " [        US-   5      UR@                  S-
  -  5        GM     URI                  U5        URK                  U5        g)N   GTiffg      ?g     o@z-bz-otz-lsrcazz-lsrcelz-elstepz-dxz-dyz-rg     f@r   zCannot open   z8Input image is too small to process, minimum size is 3x3   zCannot load bandzfrom ther   g        )&r   r   lenintr%   floatr   mathpisincossqrtOpenGA_ReadOnlyr   RasterXSizeRasterYSizeGetDriverByNameCreateRasterCountGetRasterBandGetGeoTransformGetProjectionabsr   GDALTypeCodeTonpTypeCodenpemptyXSizeReadAsArray
WriteArrayTermProgressYSizerangeclipastypeSetGeoTransformSetProjection)(argvinfileoutfileiBanddriver_namer$   lsrcazlsrcelelstepxsizeysize	dyn_rangeiarglxlylzlxyz	indataset
out_driver
outdatasetoutbandgeotransform
projectioninbandnumtypeoutlineprevcurdxdynext_dzxdzynxnynznxyznlxyzcosines(                                           r   mainrt   e   s   FGEK
--CFFFEEI 	
A
c$i-g$;FALEE\FADG$CIFA47^FIFA47^FIFA47^FE\FA$'NEE\FA$'NED[FAdgI^F_G 7N	QY c$i-\ ~ww~w~w e^dgg%Fe^dgg%F
((6
	TXXf-	-B	&	DHHV,	,B	&	B99RURU]RU*+D		&$"2"23ImV$q I$9$9A$=HI%%k2J""J &&q)G,,.L((*J}LO$}LO$$$U+F~ %V<11#6Ghh6<<('2GaFLL!V\\1EaHDw1%c


Q6<<FLL!
DQ
GCw6<<!#34cFLL()	
UB	
UB1fllQ&'""1a!eV\\1fllANqQ1Ry3qr7"f,AbzE!BK'61S3Y#X"WBwb 27*R"r'!BG+etbggdm';<=i0!==11R47Aq) 	%A,&,,*:;<% (( |,Z(r
   __main__)r0   sysnumpyrA   osgeor   r   TermProgress_nocbrF   r   r%   rM   rt   __name__exitr	   r
   r   <module>r|      s_   @  
  "** <4 hh Up zHHT#((^ r
   