Hillshade
- class eolab.georastertools.Hillshade(elevation: float, azimuth: float, resolution: float, radius: int | None = None)[source]
Bases:
Rastertool,WindowableRaster tool that computes the hillshades of a Digital Elevation / Surface / Height Model corresponding to a given solar position.
The input image is a raster that contains the height of the points as pixel values.
At a given position p, the Hillshade tool check if the point is in the hillshade generated by any other points in the direction of the sun. To achieve this goal, the algorithm computes the angle \(\gamma\): \(\tan \frac{Height}{Distance}\):
_____ x| | ^ x | | | Height (from Digital Model) x __ | | | ____p_______| |___| |__v____________ <--------------> Distance
The point is in the hillshade of another one if \(\gamma < elevation_{sun}\). To avoid testing too many points, the “radius” parameter defines the max distance of the pixel to test. The radius can be set by the user or automatically computed by the Hillshade tool. In this latter case, the radius is \(\frac{\Delta h}{\tan{elevation_{sun}}}\) where \(\Delta h\) is \(max - min\) of the pixel values in the input raster.
The output image is a mask where pixels corresponding to hillshades equal to 1.
Attributes
Return the azimuth of the sun (in degrees)
Return the elevation of the sun (in degrees)
Whether intermediate VRT images shall be kept
Path of the output directory where are stored the results
//numpy.org/doc/stable/reference/generated/numpy.pad.html>`_ the image when the window is on the edge of the image The mode can be self defined or among [constant (default), edge, linear_ramp, maximum, mean, median, minimum, reflect, symmetric, wrap, empty].
Return the maximum distance from current point (in pixels) for evaluating the maximum elevation angle
Return the resolution of a raster pixel (in meter)
Dir where to store intermediate VRT images
Size of the windows to split the image in small parts
Methods
Hillshade.__init__(elevation, azimuth, ...)Constructor for the Hillshade class.
Hillshade.postprocess_files(inputfiles, ...)Run a postprocess when all input files have been processed.
Hillshade.process_file(inputfile)Compute hillshade for the input file.
Hillshade.process_files(inputfiles)Run the rastertool to a set of input files.
Hillshade.with_output([outputdir])Set up the output.
Hillshade.with_vrt_stored(keep_vrt)Configure if the intermediate VRT images that are generated when handling the input files (which can be complex raster product composed of several band files) shall be stored to disk or not - for debug purpose for instance.
Hillshade.with_windows([window_size, pad_mode])Configure the window generation for processing image