rvt.default

Relief Visualization Toolbox – Visualization Functions

Contains all default values for visualisation functions, which can be changed. Allows computing from rvt.visualization with using defined default values and saving output rasters with default names (dependent on default values).

class rvt.default.RVTVisualization(*values)[source]

Bases: Enum

SLOPE = 'slp'
HILLSHADE = 'hs'
SHADOW = 'shd'
MULTI_HILLSHADE = 'mhs'
SIMPLE_LOCAL_RELIEF_MODEL = 'slrm'
SKY_VIEW_FACTOR = 'svf'
ANISOTROPIC_SKY_VIEW_FACTOR = 'asvf'
POSITIVE_OPENNESS = 'pos_opns'
NEGATIVE_OPENNESS = 'neg_opns'
SKY_ILLUMINATION = 'sim'
LOCAL_DOMINANCE = 'ld'
MULTI_SCALE_RELIEF_MODEL = 'msrm'
MULTI_SCALE_TOPOGRAPHIC_POSITION = 'mstp'
class rvt.default.DefaultValues[source]

Bases: object

Class which define layer for blending. BlenderLayer is basic element in BlenderCombination.layers list.

overwrite

When saving visualisation functions and file already exists, if 0 it doesn’t compute it, if 1 it overwrites it.

Type:

bool

ve_factor

For all visualization functions. Vertical exaggeration.

Type:

float

slp_compute

If compute Slope. Parameter for GUIs.

Type:

bool

slp_output_units

Slope. Output units [radian, degree, percent].

Type:

str

hs_compute

If compute Hillshade. Parameter for GUIs.

Type:

bool

hs_sun_azi

Hillshade. Solar azimuth angle (clockwise from North) in degrees.

Type:

int

hs_sun_el

Hillshade. Solar vertical angle (above the horizon) in degrees.

Type:

int

hs_shadow

Hillshade. If 1 (Ture) computes binary shadow raster, if 0 (False) it doesn’t.

Type:

bool

mhs_compute

If compute Multi directional hillshade. Parameter for GUIs.

Type:

bool

mhs_nr_dir

Multi directional hillshade. Number of solar azimuth angles (clockwise from North).

Type:

int

mhs_sun_el

Multi directional hillshade. Solar vertical angle (above the horizon) in degrees.

Type:

int

slrm_compute

If compute Simple local relief model. Parameter for GUIs.

Type:

bool

slrm_rad_cell

Simple local relief model. Radius for trend assessment in pixels.

Type:

int

svf_compute

If compute Sky-View Factor. Parameter for GUIs.

Type:

bool

svf_n_dir

Sky-View Factor (Anisotropic Sky-View Factor, Openness). Number of directions.

Type:

int

svf_r_max

Sky-View Factor (Anisotropic Sky-View Factor, Openness). Maximal search radius in pixels.

Type:

int

svf_noise

Sky-View Factor (Anisotropic Sky-View Factor, Openness). The level of noise remove [0-don’t remove, 1-low, 2-med , 3-high].

Type:

int

asvf_compute

If compute Anisotropic Sky-View Factor. Parameter for GUIs.

Type:

bool

asvf_dir

Anisotropic Sky-View Factor. Direction of anisotropy in degrees.

Type:

int

asvf_level

Anisotropic Sky-View Factor. Level of anisotropy [1-low, 2-high].

Type:

int

pos_opns_compute

If compute Positive Openness. Parameter for GUIs.

Type:

bool

neg_opns_compute

If compute Negative Openness. Parameter for GUIs.

Type:

bool

sim_compute

If compute Sky illumination. Parameter for GUIs.

Type:

bool

sim_sky_mod

Sky illumination. Sky model [overcast, uniform].

Type:

str

sim_compute_shadow

Sky illumination. If 1 it computes shadows, if 0 it doesn’t.

Type:

bool

sim_nr_dir

Sky illumination. Number of directions.

Type:

int

sim_shadow_dist

Sky illumination. Max shadow modeling distance in pixels.

Type:

int

sim_shadow_az

Sky illumination. Shadow azimuth in degrees.

Type:

int

sim_shadow_el

Sky illumination. Shadow elevation in degrees.

Type:

int

ld_compute

If compute Local dominance. Parameter for GUIs.

Type:

bool

ld_min_rad

Local dominance. Minimum radial distance (in pixels) at which the algorithm starts with visualization computation.

Type:

int

ld_max_rad

Local dominance. Maximum radial distance (in pixels) at which the algorithm ends with visualization computation.

Type:

int

ld_rad_inc

Local dominance. Radial distance steps in pixels.

Type:

int

ld_anglr_res

Local dominance. Angular step for determination of number of angular directions.

Type:

int

ld_observer_h

Local dominance. Height at which we observe the terrain.

Type:

float

msrm_compute

If compute Multi-scale relief model. Parameter for GUIs.

Type:

bool

msrm_feature_min

Minimum size of the feature you want to detect in meters.

Type:

float

msrm_feature_max

Maximum size of the feature you want to detect in meters.

Type:

float

msrm_scaling_factor

Scaling factor.

Type:

int

mstp_compute

If compute Multi-scale topographic position (MSTP).

Type:

bool

mstp_local_scale

Local scale minimum radius, maximum radius and step in pixels to calculate maximum mean deviation from elevation. All have to be integers!

Type:

tuple(min_radius, max_radius, step)

mstp_meso_scale

Meso scale minimum radius, maximum radius and step in pixels to calculate maximum mean deviation from elevation. All have to be integers!

Type:

tuple(min_radius, max_radius, step)

mstp_broad_scale

Broad scale minimum radius, maximum radius and step in pixels to calculate maximum mean deviation from elevation. All have to be integers!

Type:

tuple(min_radius, max_radius, step)

mstp_lightness

Lightness of image.

Type:

float

slp_save_float

Slope. If 1 (True) it saves float, if 0 (False) it doesn’t.

Type:

bool

hs_save_float

Hillshade. If 1 (True) it saves float, if 0 (False) it doesn’t.

Type:

bool

mhs_save_float

Multi hillshade. If 1 (True) it saves float, if 0 (False) it doesn’t.

Type:

bool

slrm_save_float

Simplified local relief model. If 1 (True) it saves float, if 0 (False) it doesn’t.

Type:

bool

svf_save_float

Sky-view factor (asvf, pos_opns). If 1 (True) it saves float, if 0 (False) it doesn’t.

Type:

bool

neg_opns_save_float

Negative openness. If 1 (True) it saves float, if 0 (False) it doesn’t.

Type:

bool

sim_save_float

Sky illumination. If 1 (True) it saves float, if 0 (False) it doesn’t.

Type:

bool

ld_save_float

Local dominance. If 1 (True) it saves float, if 0 (False) it doesn’t.

Type:

bool

msrm_save_float

Multi-scale relief model. If 1 (True) it saves float, if 0 (False) it doesn’t.

Type:

bool

slp_save_8bit

Slope. If 1 (True) it saves 8bit, if 0 (False) it doesn’t.

Type:

bool

hs_save_8bit

Hillshade. If 1 (True) it saves 8bit, if 0 (False) it doesn’t.

Type:

bool

mhs_save_8bit

Multi hillshade. If 1 (True) it saves 8bit, if 0 (False) it doesn’t.

Type:

bool

slrm_save_8bit

Simplified local relief model. If 1 (True) it saves 8bit, if 0 (False) it doesn’t.

Type:

bool

svf_save_8bit

Sky-view factor (asvf, pos_opns). If 1 (True) it saves 8bit, if 0 (False) it doesn’t.

Type:

bool

neg_opns_save_8bit

Negative openness. If 1 (True) it saves 8bit, if 0 (False) it doesn’t.

Type:

bool

sim_save_8bit

Sky illumination. If 1 (True) it saves 8bit, if 0 (False) it doesn’t.

Type:

bool

ld_save_8bit

local dominance. If 1 (True) it saves 8bit, if 0 (False) it doesn’t.

Type:

bool

msrm_save_8bit

Multi-scale relief model. If 1 (True) it saves 8bit, if 0 (False) it doesn’t.

Type:

bool

slp_bytscl

Slope, bytescale (0-255) for 8bit raster. Mode can be ‘value’ (linear stretch) or ‘percent’ (histogram equalization, cut-off). Values min and max define stretch/cut-off borders.

Type:

tuple(mode, min, max)

hs_bytscl

Hillshade, linear stretch, bytescale (0-255) for 8bit raster. Mode can be ‘value’ or ‘percent’ (cut-off units). Values min and max define stretch borders (in mode units).

Type:

tuple(mode, min, max)

mhs_bytscl

Multi directional hillshade, linear stretch, bytescale (0-255) for 8bit raster. Mode can be ‘value’ or ‘percent’ (cut-off units). Values min and max define stretch borders (in mode units).

Type:

tuple(mode, min, max)

slrm_bytscl

Simplified local relief model, linear stretch, bytescale (0-255) for 8bit raster. Mode can be ‘value’ or ‘percent’ (cut-off units). Values min and max define stretch borders (in mode units).

Type:

tuple(mode, min, max)

svf_bytscl

Sky-view factor, linear stretch, bytescale (0-255) for 8bit raster. Mode can be ‘value’ or ‘percent’ (cut-off units). Values min and max define stretch borders (in mode units).

Type:

tuple(mode, min, max)

asvf_bytscl

Anisotropic Sky-view factor, linear stretch, bytescale (0-255) for 8bit raster. Mode can be ‘value’ or ‘percent’ (cut-off units). Values min and max define stretch borders (in mode units).

Type:

tuple(mode, min, max)

pos_opns_bytscl

Positive Openness, linear stretch, bytescale (0-255) for 8bit raster. Mode can be ‘value’ or ‘percent’ (cut-off units). Values min and max define stretch borders (in mode units).

Type:

tuple(mode, min, max)

neg_opns_bytscl

Negative Openness, linear stretch, bytescale (0-255) for 8bit raster. Mode can be ‘value’ or ‘percent’ (cut-off units). Values min and max define stretch borders (in mode units).

Type:

tuple(mode, min, max)

sim_bytscl

Sky illumination, linear stretch, bytescale (0-255) for 8bit raster. Mode can be ‘value’ or ‘percent’ (cut-off units). Values min and max define stretch borders (in mode units).

Type:

tuple(mode, min, max)

ld_bytscl

Local dominance, linear stretch, bytescale (0-255) for 8bit raster. Mode can be ‘value’ or ‘percent’ (cut-off units). Values min and max define stretch borders (in mode units).

Type:

tuple(mode, min, max)

msrm_bytscl

Multi-scale relief model, linear stretch, bytescale (0-255) for 8bit raster. Mode can be ‘value’ or ‘percent’ (cut-off units). Values min and max define stretch borders (in mode units).

Type:

tuple(mode, min, max)

tile_size_limit

If array size bigger than tile_size_limit it uses saving tile by tile (rvt.tile module).

Type:

int

tile_size

Size of single tile when saving tile by tile.

Type:

tuple(x_size, y_size)

save_default_to_file(file_path=None)[source]

Saves default attributes into .json file.

read_default_from_file(file_path)[source]

Reads default attributes from file.

get_shadow_file_name(dem_path)[source]

Returns shadow name, with added hillshade parameters (hs_sun_azi == shadow azimuth, hs_sun_el == shadow_elevation).

get_shadow_path(dem_path)[source]

Returns path to Shadow. Generates shadow name (uses default attributes and dem name from dem_path) and adds dem directory (dem_path) to it.

get_hillshade_file_name(dem_path, bit8=False)[source]

Returns Hillshade name, dem name (from dem_path) with added hillshade parameters. If bit8 it returns 8bit file name.

get_hillshade_path(dem_path, bit8=False)[source]

Returns path to Hillshade. Generates hillshade name (uses default attributes and dem name from dem_path) and adds dem directory (dem_path) to it. If bit8 it returns 8bit file path.

get_slope_file_name(dem_path, bit8=False)[source]

Returns Slope name, dem name (from dem_path) with added slope parameters. If bit8 it returns 8bit file name.

get_slope_path(dem_path, bit8=False)[source]

Returns path to slope. Generates slope name and adds dem directory (dem_path) to it. If bit8 it returns 8bit file path.

get_multi_hillshade_file_name(dem_path, bit8=False)[source]

Returns Multiple directions hillshade name, dem name (from dem_path) with added multi hillshade parameters. If bit8 it returns 8bit file name.

get_multi_hillshade_path(dem_path, bit8=False)[source]

Returns path to Multiple directions hillshade. Generates multi hillshade name (uses default attributes and dem name from dem_path) and adds dem directory (dem_path) to it. If bit8 it returns 8bit file path.

get_slrm_file_name(dem_path, bit8=False)[source]

Returns Simple local relief model name, dem name (from dem_path) with added slrm parameters. If bit8 it returns 8bit file name.

get_slrm_path(dem_path, bit8=False)[source]

Returns path to Simple local relief model. Generates slrm name (uses default attributes and dem name from dem_path) and adds dem directory (dem_path) to it. If bit8 it returns 8bit file path.

get_svf_file_name(dem_path, bit8=False)[source]

Returns Sky-view factor name, dem name (from dem_path) with added svf parameters. If bit8 it returns 8bit file name.

get_svf_path(dem_path, bit8=False)[source]

Returns path to Sky-view factor. Generates svf name (uses default attributes and dem name from dem_path) and adds dem directory (dem_path) to it. If bit8 it returns 8bit file path.

get_asvf_file_name(dem_path, bit8=False)[source]

Returns Anisotropic Sky-view factor name, dem name (from dem_path) with added asvf parameters. If bit8 it returns 8bit file name.

get_asvf_path(dem_path, bit8=False)[source]

Returns path to Anisotropic Sky-view factor. Generates asvf name (uses default attributes and dem name from dem_path) and adds dem directory (dem_path) to it. If bit8 it returns 8bit file path.

get_opns_file_name(dem_path, bit8=False)[source]

Returns Positive Openness name, dem name (from dem_path) with added pos opns parameters. If bit8 it returns 8bit file name.

get_opns_path(dem_path, bit8=False)[source]

Returns path to Positive Openness. Generates pos opns name (uses default attributes and dem name from dem_path) and adds dem directory (dem_path) to it. If bit8 it returns 8bit file path.

get_neg_opns_file_name(dem_path, bit8=False)[source]

Returns Negative Openness name, dem name (from dem_path) with added neg opns parameters. If bit8 it returns 8bit file name.

get_neg_opns_path(dem_path, bit8=False)[source]

Returns path to Negative Openness. Generates pos neg name (uses default attributes and dem name from dem_path) and adds dem directory (dem_path) to it. If bit8 it returns 8bit file path.

get_sky_illumination_file_name(dem_path, bit8=False)[source]

Returns Sky illumination name, dem name (from dem_path) with added sim parameters. If bit8 it returns 8bit file name.

get_sky_illumination_path(dem_path, bit8=False)[source]

Returns path to Sky illumination. Generates sim name (uses default attributes and dem name from dem_path) and adds dem directory (dem_path) to it. If bit8 it returns 8bit file path.

get_local_dominance_file_name(dem_path, bit8=False)[source]

Returns Local dominance name, dem name (from dem_path) with added ld parameters. If bit8 it returns 8bit file name.

get_local_dominance_path(dem_path, bit8=False)[source]

Returns path to Local dominance. Generates ld name (uses default attributes and dem name from dem_path) and adds dem directory (dem_path) to it. If bit8 it returns 8bit file path.

get_msrm_file_name(dem_path, bit8=False)[source]

Returns Multi-scale relief model name, dem name (from dem_path) with added msrm parameters. If bit8 it returns 8bit file name.

get_msrm_path(dem_path, bit8=False)[source]

Returns path to Multi-scale relief model. Generates msrm name (uses default attributes and dem name from dem_path) and adds dem directory (dem_path) to it. If bit8 it returns 8bit file path.

get_mstp_file_name(dem_path, bit8=False)[source]

Returns Multi-scale topographic position name, dem name (from dem_path) with added mstp parameters. If bit8 it returns 8bit file name.

get_mstp_path(dem_path, bit8=False)[source]
get_visualization_file_name(rvt_visualization: RVTVisualization, dem_path: Path, path_8bit: bool) str[source]

“Return visualization path.

get_visualization_path(rvt_visualization: RVTVisualization, dem_path: Path, output_dir_path: Path, path_8bit: bool) Path[source]

“Return visualization path.

float_to_8bit(float_arr: array, visualization: RVTVisualization, x_res: float = None, y_res: float = None, no_data: float | None = None)[source]

Converts (byte scale) float visualization to 8bit. Resolution (x_res, y_res) and no_data needed only for multiple directions hillshade! Method first normalize then byte scale (0-255).

get_slope(dem_arr, resolution_x, resolution_y, no_data=None)[source]
save_slope(dem_path, custom_dir=None, save_float=None, save_8bit=None)[source]

Calculates and saves Slope from dem (dem_path) with default parameters. If custom_dir is None it saves in dem directory else in custom_dir. If path to file already exists we can overwrite file (overwrite=0) or not (overwrite=1). If save_float is True method creates Gtiff with real values, if save_8bit is True method creates GTiff with bytescaled values (0-255).

get_shadow(dem_arr, resolution, no_data=None)[source]
get_hillshade(dem_arr, resolution_x, resolution_y, no_data=None)[source]
save_hillshade(dem_path, custom_dir=None, save_float=None, save_8bit=None, save_shadow=None)[source]

Calculates and saves Hillshade from dem (dem_path) with default parameters. If custom_dir is None it saves in dem directory else in custom_dir. If path to file already exists we can overwrite file (overwrite=1) or not (overwrite=0). If save_float is True method creates Gtiff with real values, if save_8bit is True method creates GTiff with bytescaled values (0-255).

get_multi_hillshade(dem_arr, resolution_x, resolution_y, no_data=None)[source]
save_multi_hillshade(dem_path, custom_dir=None, save_float=None, save_8bit=None)[source]

Calculates and saves Multidirectional hillshade from dem (dem_path) with default parameters. If custom_dir is None it saves in dem directory else in custom_dir. If path to file already exists we can overwrite file (overwrite=1) or not (overwrite=0). If save_float is True method creates Gtiff with real values, if save_8bit is True method creates GTiff with bytescaled values (0-255).

get_slrm(dem_arr, no_data=None)[source]
save_slrm(dem_path, custom_dir=None, save_float=None, save_8bit=None)[source]

Calculates and saves Simple local relief model from dem (dem_path) with default parameters. If custom_dir is None it saves in dem directory else in custom_dir. If path to file already exists we can overwrite file (overwrite=1) or not (overwrite=0). If save_float is True method creates Gtiff with real values, if save_8bit is True method creates GTiff with bytescaled values (0-255).

get_sky_view_factor(dem_arr, resolution, compute_svf=True, compute_asvf=False, compute_opns=False, no_data=None)[source]
save_sky_view_factor(dem_path, save_svf=True, save_asvf=False, save_opns=False, custom_dir=None, save_float=None, save_8bit=None)[source]

Calculates and saves Sky-view factor(save_svf=True), Anisotropic Sky-view factor(save_asvf=True) and Positive Openness(save_opns=True) from dem (dem_path) with default parameters. If custom_dir is None it saves in dem directory else in custom_dir. If path to file already exists we can overwrite file (overwrite=1) or not (overwrite=0). If save_float is True method creates Gtiff with real values, if save_8bit is True method creates GTiff with bytescaled values (0-255).

get_neg_opns(dem_arr, resolution, no_data=None)[source]
save_neg_opns(dem_path, custom_dir=None, save_float=None, save_8bit=None)[source]

Calculates and saves Negative Openness from dem (dem_path) with default parameters. If custom_dir is None it saves in dem directory else in custom_dir. If path to file already exists we can overwrite file (overwrite=1) or not (overwrite=0). If save_float is True method creates Gtiff with real values, if save_8bit is True method creates GTiff with bytescaled values (0-255).

get_sky_illumination(dem_arr, resolution, no_data=None)[source]
save_sky_illumination(dem_path, custom_dir=None, save_float=None, save_8bit=None)[source]

Calculates and saves Sky illumination from dem (dem_path) with default parameters. If custom_dir is None it saves in dem directory else in custom_dir. If path to file already exists we can overwrite file (overwrite=1) or not (overwrite=0). If save_float is True method creates Gtiff with real values, if save_8bit is True method creates GTiff with bytescaled values (0-255).

get_local_dominance(dem_arr, no_data=None)[source]
save_local_dominance(dem_path, custom_dir=None, save_float=None, save_8bit=None)[source]

Calculates and saves Local dominance from dem (dem_path) with default parameters. If custom_dir is None it saves in dem directory else in custom_dir. If path to file already exists we can overwrite file (overwrite=1) or not (overwrite=0). If save_float is True method creates Gtiff with real values, if save_8bit is True method creates GTiff with bytescaled values (0-255).

get_msrm(dem_arr, resolution, no_data=None)[source]
save_msrm(dem_path, custom_dir=None, save_float=None, save_8bit=None)[source]

Calculates and saves Multi-scale relief model from dem (dem_path) with default parameters. If custom_dir is None it saves in dem directory else in custom_dir. If path to file already exists we can overwrite file (overwrite=1) or not (overwrite=0). If save_float is True method creates Gtiff with real values, if save_8bit is True method creates GTiff with bytescaled values (0-255).

get_mstp(dem_arr, no_data=None)[source]
save_mstp(dem_path, custom_dir=None, save_float=None, save_8bit=None)[source]

Calculates and saves Multi-scale topographic position from dem (dem_path) with default parameters. If custom_dir is None it saves in dem directory else in custom_dir. If path to file already exists we can overwrite file (overwrite=1) or not (overwrite=0).

save_visualizations(dem_path, custom_dir=None)[source]

Save all visualizations where self.’visualization’_compute = True also saves float where self.’visualization’ _save_float = True and 8bit where self.’visualization’_save_8bit = True. In the end method creates log file.

calculate_visualization(visualization: RVTVisualization, dem: array, resolution_x: float, resolution_y: float, no_data: float | None = None, save_float: bool = True, save_8bit: bool = False) Tuple[array, array] | None[source]
create_log_file(dem_path, custom_dir=None, compute_time=None)[source]

Creates log file in custom_dir, if custom_dir=None it creates it in dem directory (dem_path). Be aware, all default parameters have to be right! Parameter compute_time is in seconds.

rvt.default.get_raster_arr(raster_path)[source]

Reads raster from raster_path and returns its array(value) and resolution.

Parameters:

raster_path (str) – Path to raster

Returns:

dict_out – Returns {“array”: array, “resolution”: (x_res, y_res), “no_data”: no_data} : dict(“array”: np.array, “resolution”: tuple(float, float), “no_data”: float). Returns dictionary with keys: array, resolution and no_data. Key resolution is tuple where first element is x resolution and second is y resolution. Key no_data represent value of no data.

Return type:

dict

rvt.default.get_raster_size(raster_path, band=1)[source]

Opens raster path and returns selected band size.

Parameters:
  • raster_path (str) – Path to raster.

  • band (int) – Selected band number.

Return type:

tuple(x_size, y_size)

rvt.default.save_raster(src_raster_path, out_raster_path, out_raster_arr: ndarray, no_data=None, e_type=6)[source]

Saves raster array (out_rast_arr) to out_raster_path (GTiff), using src_rast_path information.

Parameters:
  • src_raster_path (str) – Path to source raster.

  • out_raster_path (str) – Path to new file, where to save raster (GTiff).

  • out_raster_arr (np.array (2D - one band, 3D - multiple bands)) – Array with raster data.

  • no_data (float) – Value that represents no data pixels.

  • e_type (GDALDataType) – https://gdal.org/api/raster_c_api.html#_CPPv412GDALDataType, (GDT_Float32 = 6, GDT_UInt8 = 1, …)