georastertools package
Subpackages
- georastertools.cli package
- Submodules
- georastertools.cli.filtering module
- georastertools.cli.hillshade module
- georastertools.cli.radioindice module
- georastertools.cli.speed module
- georastertools.cli.svf module
- georastertools.cli.tiling module
- georastertools.cli.timeseries module
- georastertools.cli.utils_cli module
- georastertools.cli.zonalstats module
- Module contents
- georastertools.processing package
- georastertools.product package
Submodules
georastertools.filtering module
georastertools.georastertools module
georastertools.hillshade module
georastertools.main module
georastertools.radioindice module
georastertools.speed module
georastertools.svf module
georastertools.tiling module
georastertools.timeseries module
georastertools.utils module
This module defines several utility methods for:
handling path
transforming data
computing sliding windows
…
georastertools.zonalstats module
Module contents
This module defines the base class for every Rastertool, namely eolab.georastertools.Rastertool.
It also defines a specific Exception class that shall be raised when invalid rastertool’s configuration parameters are setup.
Finally, it defines additional decorator classes that factorize some rastertool configuration
features. For example, the class eolab.georastertools.Windowable enables to configure a
rastertool with windowable capabilities (i.e. capability to split the raster input file in small
parts in order to distribute the processing over several cpus).
- class georastertools.Rastertool[source]
Bases:
ABCBase class for every raster tool which contains the common configuration:
the output dir where to store the results (by default, current dir)
whether to save to disk the intermediate VRT images that can be created when handling the input raster products (that can be an archive of several band files for example). This parameter is mainly for debug purpose and is False by default.
- postprocess_files(inputfiles: List[str], outputfiles: List[str]) List[str][source]
Run a postprocess when all input files have been processed. This step may consist in transforming the outputs or mixing them to generate additional ones.
Note
This implementation does nothing. Override this method in the subclass to achieve special processing that needs the whole list of inputfiles and/or the output files generated when processing every single file (to mix them for instance).
- Parameters:
- Returns
[str]: Additional output files (by default empty list)
- process_file(inputfile: str) List[str][source]
Run the rastertool to a single input file.
Note
This implementation does nothing. Override this method in the subclass to achieve special processing of an inputfile.
- process_files(inputfiles: List[str])[source]
Run the rastertool to a set of input files. By default, this implementation recursively calls “process_file” on each input file and then calls “postprocess_files”.
Note
It is not meant to be overriden by subclasses. Prefer overriding process_file and postproces_files instead.
- Parameters:
inputfiles ([str]) – Input images to process
- Returns:
([str]) The list of the generated files
- with_output(outputdir: str = '.')[source]
Set up the output.
- Parameters:
outputdir (str, optional, default=".") – Output dir where to store results. If none, it is set to current dir
- Returns:
The current instance so that it is possible to chain the with… calls (fluent API)
- Return type:
- with_vrt_stored(keep_vrt: bool)[source]
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.
- Parameters:
keep_vrt (bool) – Whether intermediate VRT images shall be stored or not
- Returns:
The current instance so that it is possible to chain the with… calls (fluent API)
- Return type:
- exception georastertools.RastertoolConfigurationException(message, exit_code=2)[source]
Bases:
ExceptionThis class defines an exception that is raised when the configuration of the raster tool is invalid (wrong input parameter)
- class georastertools.Windowable[source]
Bases:
objectDecorator of a
eolab.georastertools.Rastertoolthat adds configuration parameters to set the windowable capability of the tool:the window size
the mode for padding the window when at the edge of the image
- property pad_mode: str
//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].
- Type:
Mode used to `pad <https
- with_windows(window_size: int = 1024, pad_mode: str = 'edge')[source]
Configure the window generation for processing image
- Parameters:
window_size (int, optional, default=1024) – Size of windows for splitting the processed image in small parts so that processing can be distributed on several cpus.
pad_mode (str, optional, default="edge") – Mode for padding data around the windows that are on the edge of the image. See https://numpy.org/doc/stable/reference/generated/numpy.pad.html
- Returns:
The current instance so that it is possible to chain the with… calls (fluent API)
- Return type: