Skip to content

t.rast.vi

Calculate vegetation indices for temporal datasets

t.rast.vi [red=string] [green=string] [blue=string] [nir=string] [band5=string] [band7=string] output=name [prefix=name] [clouds=string] [shadows=string] [viname=string] [where=sql_query] [soil_line_slope=float] [soil_line_intercept=float] [soil_noise_reduction=float] [nprocs=integer] [memory=integer] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

t.rast.vi output=name

grass.tools.Tools.t_rast_vi(red=None, green=None, blue=None, nir=None, band5=None, band7=None, output, prefix=None, clouds=None, shadows=None, viname="ndvi", where=None, soil_line_slope=None, soil_line_intercept=None, soil_noise_reduction=None, nprocs=1, memory=300, overwrite=None, verbose=None, quiet=None, superquiet=None)

Example:

tools = Tools()
tools.t_rast_vi(output="name")

This grass.tools API is experimental in version 8.5 and expected to be stable in version 8.6.

grass.script.run_command("t.rast.vi", red=None, green=None, blue=None, nir=None, band5=None, band7=None, output, prefix=None, clouds=None, shadows=None, viname="ndvi", where=None, soil_line_slope=None, soil_line_intercept=None, soil_noise_reduction=None, nprocs=1, memory=300, overwrite=None, verbose=None, quiet=None, superquiet=None)

Example:

gs.run_command("t.rast.vi", output="name")

Parameters

red=string
    Name of the input space time raster dataset with red band
green=string
    Name of the input space time raster dataset with green band
blue=string
    Name of the input space time raster dataset with blue band
nir=string
    Name of the input space time raster dataset with nir band
band5=string
    Name of the input space time raster dataset with 5th channel surface reflectance band
band7=string
    Name of the input space time raster dataset with 7th channel surface reflectance band
output=name [required]
    Name of the output space time raster dataset
prefix=name
    Prefix of the output raster names within the space time raster dataset
clouds=string
    Name of the input space time dataset with clouds
shadows=string
    Name of the input space time dataset with shadow
viname=string
    Type of vegetation index
    Allowed values: arvi, dvi, evi, evi2, gvi, gari, gemi, ipvi, msavi, msavi2, ndvi, ndwi, pvi, savi, sr, vari, wdvi
    Default: ndvi
where=sql_query
    WHERE conditions of SQL statement without 'where' keyword used in the temporal GIS framework
    Example: start_time > '2001-01-01 12:30:00'
soil_line_slope=float
    Value of the slope of the soil line (MSAVI only)
soil_line_intercept=float
    Value of the intercept of the soil line (MSAVI only)
soil_noise_reduction=float
    Value of the factor of reduction of soil noise (MSAVI only)
nprocs=integer
    Number of parallel processes to run
    Default: 1
memory=integer
    Maximum memory to be used if vector to raster operation is needed (in MB)
    Default: 300
--overwrite
    Allow output files to overwrite existing files
--help
    Print usage summary
--verbose
    Verbose module output
--quiet
    Quiet module output
--qq
    Very quiet module output
--ui
    Force launching GUI dialog

red : str, optional
    Name of the input space time raster dataset with red band
    Used as: input, strds
green : str, optional
    Name of the input space time raster dataset with green band
    Used as: input, strds
blue : str, optional
    Name of the input space time raster dataset with blue band
    Used as: input, strds
nir : str, optional
    Name of the input space time raster dataset with nir band
    Used as: input, strds
band5 : str, optional
    Name of the input space time raster dataset with 5th channel surface reflectance band
    Used as: input, strds
band7 : str, optional
    Name of the input space time raster dataset with 7th channel surface reflectance band
    Used as: input, strds
output : str, required
    Name of the output space time raster dataset
    Used as: output, strds, name
prefix : str, optional
    Prefix of the output raster names within the space time raster dataset
    Used as: output, strds, name
clouds : str, optional
    Name of the input space time dataset with clouds
    Used as: input, strds
shadows : str, optional
    Name of the input space time dataset with shadow
    Used as: input, strds
viname : str, optional
    Type of vegetation index
    Allowed values: arvi, dvi, evi, evi2, gvi, gari, gemi, ipvi, msavi, msavi2, ndvi, ndwi, pvi, savi, sr, vari, wdvi
    Default: ndvi
where : str, optional
    WHERE conditions of SQL statement without 'where' keyword used in the temporal GIS framework
    Example: start_time > '2001-01-01 12:30:00'
    Used as: sql_query
soil_line_slope : float, optional
    Value of the slope of the soil line (MSAVI only)
soil_line_intercept : float, optional
    Value of the intercept of the soil line (MSAVI only)
soil_noise_reduction : float, optional
    Value of the factor of reduction of soil noise (MSAVI only)
nprocs : int, optional
    Number of parallel processes to run
    Default: 1
memory : int, optional
    Maximum memory to be used if vector to raster operation is needed (in MB)
    Default: 300
overwrite : bool, optional
    Allow output files to overwrite existing files
    Default: None
verbose : bool, optional
    Verbose module output
    Default: None
quiet : bool, optional
    Quiet module output
    Default: None
superquiet : bool, optional
    Very quiet module output
    Default: None

Returns:

result : grass.tools.support.ToolResult | None
If the tool produces text as standard output, a ToolResult object will be returned. Otherwise, None will be returned.

Raises:

grass.tools.ToolError: When the tool ended with an error.

red : str, optional
    Name of the input space time raster dataset with red band
    Used as: input, strds
green : str, optional
    Name of the input space time raster dataset with green band
    Used as: input, strds
blue : str, optional
    Name of the input space time raster dataset with blue band
    Used as: input, strds
nir : str, optional
    Name of the input space time raster dataset with nir band
    Used as: input, strds
band5 : str, optional
    Name of the input space time raster dataset with 5th channel surface reflectance band
    Used as: input, strds
band7 : str, optional
    Name of the input space time raster dataset with 7th channel surface reflectance band
    Used as: input, strds
output : str, required
    Name of the output space time raster dataset
    Used as: output, strds, name
prefix : str, optional
    Prefix of the output raster names within the space time raster dataset
    Used as: output, strds, name
clouds : str, optional
    Name of the input space time dataset with clouds
    Used as: input, strds
shadows : str, optional
    Name of the input space time dataset with shadow
    Used as: input, strds
viname : str, optional
    Type of vegetation index
    Allowed values: arvi, dvi, evi, evi2, gvi, gari, gemi, ipvi, msavi, msavi2, ndvi, ndwi, pvi, savi, sr, vari, wdvi
    Default: ndvi
where : str, optional
    WHERE conditions of SQL statement without 'where' keyword used in the temporal GIS framework
    Example: start_time > '2001-01-01 12:30:00'
    Used as: sql_query
soil_line_slope : float, optional
    Value of the slope of the soil line (MSAVI only)
soil_line_intercept : float, optional
    Value of the intercept of the soil line (MSAVI only)
soil_noise_reduction : float, optional
    Value of the factor of reduction of soil noise (MSAVI only)
nprocs : int, optional
    Number of parallel processes to run
    Default: 1
memory : int, optional
    Maximum memory to be used if vector to raster operation is needed (in MB)
    Default: 300
overwrite : bool, optional
    Allow output files to overwrite existing files
    Default: None
verbose : bool, optional
    Verbose module output
    Default: None
quiet : bool, optional
    Quiet module output
    Default: None
superquiet : bool, optional
    Very quiet module output
    Default: None

DESCRIPTION

This module calculates vegetation indices from several space time raster datasets, using i.vi module.

It can apply cloud and shadow masks stored as space time datasets (raster or vector).

The output space time raster dataset can be a new dataset or an existing one, in this case the new created maps will be added to the existing space time raster dataset.

EXAMPLE

Calculate the NDVI for your Red and NIR STDRS bands

t.rast.vi red=red_monthly nir=nir_monthly output=ndvi_monthly viname=ndvi \
    prefix=ndvimonthly

If you have to calculate different indices that require more info, such as EVI or MSAVI, you need to set the correct parameters.

t.rast.vi red=red_monthly nir=nir_monthly blue=blue_monthly output=evi_monthly \
    viname=evi prefix=evimonthly
t.rast.vi red=red_monthly nir=nir_monthly output=evi_monthly viname=msavi \
    prefix=msavimonthly soil_line_slope=0.8 soil_line_intercept=0.5 \
    soil_noise_reduction=1

SEE ALSO

*i.vi.md

AUTHOR

Luca Delucchi, Fondazione Edmund Mach

SOURCE CODE

Available at: t.rast.vi source code (history)
Latest change: Friday Jul 17 18:23:02 2026 in commit 921afb4