Skip to content

RunningAddon

Bernardo Niebuhr edited this page Apr 16, 2018 · 1 revision

LSCorridors as a GRASS GIS addon

We are starting to adapt LSCorridors as a GRASS GIS addon, so that it may run as any other GRASS addon or module (e.g., r.in.gdal, r.stats). The script is located in the same folder as the main LSCorridors code and is called r.ls.corridors.py. For now, as this is still a working project, that may be run as a python script. In the future, once it is tested and running, it will be put in the formal format of GRASS GIS addons.

To use it, you just have to type, in the GRASS terminal (black screen), the command:

# First change to the folder where the LSCorridors code is located
cd "C:/Github/LS_CORRIDORS/_LS_Corridors_v1_0_0_stable"

# Then the simulation is performed using a code like the one below
python r.ls.corridors.py resistancemap=name_of_resistance_map stmap=name_of_ST_map stlist=list_of_sts
   output_prefix=output_prefix_chosen variability=variability_value scale=scale_value
   simulations=number_of_simulations method=method_chosen output_folder=folder_of_output_files

# An example of a real simulation
python r.ls.corridors.py resistancemap=Resistance_map1 stmap=ST_map1.img stlist=1,2,3,4,5,6
   output_prefix=test variability=2.0 scale=100,200
   simulations=20 method=MP,MLavg output_folder=C:/LSCorridors_output

This command can run only one resistance map/ST map at a time, but with as many ST pairs, variability and scale values as the user chooses, and for all methods at once. However, if you need to run LSCorridors for multiple maps, you can loop over you input maps, using the programming language of your preference (e.g., bash, Python, R).

You can also type python r.ls.corridors.py to know more about the parameters and options of the addon.

Description:
 Simulate multiple functional ecological corridors, given a resistance surface, a map of source-target
 locations, and a list of sources and targets.

Keywords:
 raster, corridor, resistance, cost, least-cost, species perception, landscape influence

Usage:
 r.ls.corridors.py resistancemap=name stmap=name stlist=name
   [output_prefix=name] [variability=value[,value,...]]
   [scale=value[,value,...]] [simulations=value]
   [method=string[,string,...]] [output_folder=string] [--overwrite]
   [--help] [--verbose] [--quiet] [--ui]

Flags:
 --o   Permitir que os ficheiros de saída reescrevam os ficheiros existentes
 --h   Print usage summary
 --v   Saída do módulo verbosa
 --q   Saída do módulo quiet
 --qq  Super quiet module output
 --ui  Force launching GUI dialog

Parameters:
  resistancemap   Name of input resistance map (raster map)
          stmap   Name of Source-Target (ST) map (raster map)
         stlist   List of Source-Target (ST) locations to be connected by corridors
                   Location or patch IDs in the list must be values of the ST map
  output_prefix   Text used as prefix of all output maps and files
    variability   Value (or list of values) of variability for simulating corridors
                  padrão: 2.0
          scale   Value (or list of values) of the scale of landscape influence in each pixel of the input
                  resistance map, in meters; it is relevant only for methods MLmin, MLavg, and MLmax
                  padrão: 100
    simulations   Number of corridor simulations to be run
                  padrão: 15
         method   method (or list of methods) to be simulated
                   MP does not consider landscape influence, i.e., resistance map is considered exactly as 
                   input. In MLmin, MLavg, MLmax, before simulating corridors, each pixel of the resistance 
                   map is replaced by the value of statistics inside a window around it (minimum, average, 
                   or maximum), whose size is defined by the scale parameter
                  opções: MP, MLmin, MLavg, MLmax
                  padrão: MP
  output_folder   Path of the folder where output maps and files will be saved