Professional Documents
Culture Documents
[vw@localhost~]$saga_cmd
Error:noargumentsforsagacall
Error:library
63loadedmodulelibraries(569modules):
imagery_tools
ta_morphometry
...
typehorhelpforfurtherinformation
Volker Wichmann
alpS GmbH Centre for Climate Change Adaptation
Laserdata GmbH
AGIT 2013
AGIT 2013
Why automatisation?Why
V. Wichmann
AGIT 2013
setSAGA_MLB=C:\my_path_to_saga_mlbs
exportSAGA_MLB=/my_path_to_saga_mlbs
[windows]
[linux]
V. Wichmann
AGIT 2013
[vw@localhost~]$saga_cmd
Error:noargumentsforsagacall
Error:library
63loadedmodulelibraries(569modules):
shapes_points
io_grid_grib2
imagery_tools
ta_morphometry
...
typehorhelpforfurtherinformation
V. Wichmann
AGIT 2013
AGIT 2013
[vw@localhost~]$saga_cmdta_lighting
...
Error:module
modules:
0 AnalyticalHillshading
2 PotentialIncomingSolarRadiation
3 SkyViewFactor
4 TopographicCorrection
5 TopographicOpenness
6 Visibility(points)
typehorhelpforfurtherinformation
V. Wichmann
AGIT 2013
ELEVATION:<str>
Elevation
Grid(input)
SHADE:<str>
AnalyticalHillshading
Grid(output)
METHOD:<str>
ShadingMethod
Choice
AvailableChoices:
[0]Standard
[1]Standard(max.90Degree)
[2]CombinedShading
[3]RayTracing
[4]AmbientOcclusion
Default:0
AZIMUTH:<str>
Azimuth[Degree]
Floatingpoint
Default:315.000000
DECLINATION:<str>
Floatingpoint
Default:45.000000
EXAGGERATION:<str>
Floatingpoint
Default:4.000000
NDIRS:<num>
Integer
Minimum:2
Default:8
RADIUS:<str>
Floatingpoint
Minimum:0.001000
Default:100.000000
Declination[Degree]
Exaggeration
NumberofDirections
SearchRadius
V. Wichmann
AGIT 2013
V. Wichmann
AGIT 2013
Dataobjects:
(Optional)Input
(Optional)Output
Dataobject Types:
Grid
Shapes
Tables
Pointclouds
File(path)
DataobjectLists
filename.sgrd
filename.shp
filename.txt or filename.dbf
filename.spc
filepath/filename.ext
filename.ext;filename.ext;filename.ext
V. Wichmann
AGIT 2013
Boolean
Value
Degree
Range
Choice
String
GridSystem
USER_XMIN
USER_XMAX
USER_YMIN
USER_YMAX
USER_SIZE
Left
Right
Bottom
Top
Cellsize
V. Wichmann
10
AGIT 2013
Windows:
Microsoft command interpreter (cmd.exe)
batch files (*.bat): text files containing a series of commands to be executed
http://en.wikibooks.org/wiki/Windows_Batch_Scripting
GNU/Linux, Mac OSX:
Bash command processor (Unix shell)
Bash files (*.sh): text files containing a series of commands to be executed
http://tldp.org/LDP/abs/html/
Drawbacks:
The parsing of a command line into a sequence of commands is complex and
varies from command interpreter to command interpreter, including
Variable substitution
Quoting
Syntax
Redirection
Different scripts are needed on different operating systems
V. Wichmann
11
AGIT 2013
Python:
Widely used general-purpose, high-level programming language
Often used as scripting language
http://docs.python.org/2/tutorial/
Advantages:
Platform independent --> use the same script on different operating systems
It's a complete programming language --> very powerful
Statements and flow control
Expressions, e.g. string manipulation
Functions
Libraries, providing tools suited to many tasks
Redirection (logging)
...
... and there is also a SAGA Python API available, providing even more
flexibility
V. Wichmann
12
AGIT 2013
Task:
Convert ESRI ASCII files (DEMs) stored in a folder to SAGA grids
Calculate an analytical hillshade for each tile
Next slides show scripts for Windows, GNU/Linux and Python
V. Wichmann
13
AGIT 2013
V. Wichmann
14
AGIT 2013
V. Wichmann
15
AGIT 2013
V. Wichmann
16
AGIT 2013
V. Wichmann
17
AGIT 2013
V. Wichmann
18
AGIT 2013
... and in case you really like to stick to batch scripting: create an example script file
from the GUI as template ;-)
V. Wichmann
19