Advanced Spatial Modeler, Scripting and Batch
Document Sample


Advanced Spatial Modeler,
Scripting and Batch Processes:
How to do crosswords and drink beer while “working!”
Forrest R. Stevens
Department of Geography
University of Florida
Advanced Environmental Remote Sensing
February 22nd, 2007
Outline
Batching
– To batch or not to batch?
– Examples March 1987
NDVI
March 2000
NDVI
– Time saved or time wasted…
Standardize Standardize
Normal Normal
Scripting
Deviates Deviates
– Batches of batches, oh my!
– Things you can‟t do with your clicking finger
87 NDVI 00 NDVI
SND SND
Examples
Layer Stack
Image
Difference
(2000-1987)
– ERDAS Batches
– ERDAS Spatial Modeler + Batches
00-87_ndvi_snd
00-87 NDVI ndvi_4year_sd
SND
– ENVI and IDL
Degrade
Discussion and Questions
30m x 30m
120 x 120
60 x 60 90 x 90
180 210 240 270
150 x 150 x 180 x 210 x 240 x 270
330 390 360 430
300 x 300 x 330 x 390 x 360 x 430
Batch Processing
Batching can be:
– A huge time saver…
– Why?
• Layer stacking
• Statistics / Indices
• Filtering
• Subsetting
• Unsupervised classification, etc.
– But sometimes a huge time waster?!
FUNCTION KILL_CENTER_GROW, image
if N_params() LT 1 then begin
print,'Syntax - Result = kill_grow_center(
Scripting
return, -1
endif
sim = size( image )
if (sim[0] NE 2) OR (sim[4] LE 4) then begin
message,"input must be an image (a matrix)",
Coding, by any other name… return,image
endif
Lx = sim[1] - 1 ; Last X index of image...
Ly = sim[2] - 1 ; Last Y index of image...
– Scripts are interpreted programs ; Recall that the images are even rows, even s
; based on even halves, so "center" X and Y i
• Call functions, perform calculations ; block making up the exact center of the ima
;
• Can interface with system, programs, and other functions
centerX = ROUND(Lx / 2)
centerY = ROUND(Ly / 2)
• Often integrated with software (VBA, Python for ArcGIS)can be addressed by a
; Remember that an image
; row... That is the address convention that
; as calculated here is the NW corner of the
; image array...
– Common scripting environments: indexCenter = (sim[1] * (centerY - 1) + center
imf = image
UNIX-style [indexCenter], THRES
• Python (ArcGIS), IDL (ENVI), Perl, DOS .bat, REGION_GROW(imf, shell
result =
if (size(result, /DIMENSIONS) eq 0) then begin
– Often have a cute front-end like ERDAS Spatial Modeler
print, 'WARN: No center...'
endif else begin
or ArcGIS Modeler
; Set result of region grow from center to z
imf[result] = 0
; Inverse of above, set everything in image
;imf[0:Lx, 0:Ly] = 0
;imf[result] = 1
Home Grown Tools
Sometimes if you want it done right (or done at
all)…
– Built-in tools are unavailable or don‟t work
• Scripting can be employed to build your own tools
– Scripting can be the glue between tools and even between
programs/systems
– Once you know one scripting language, you can learn
them all
Simple ERDAS Batches
Look for the „Batch‟ button
on the tool dialogs within
ERDAS…
If it‟s there, it can be
batched!
To batch a process, set
your tool options and press
the button (you can‟t go
back!)
Simple ERDAS Batches
Simple ERDAS Batches
Once you have a batch set up with the wizard, you
may edit the batch command manually!
Simple ERDAS Batches
Once you have a batch set up with the wizard, you
may edit the batch command manually!
Note the slashes, not backslashes!
Conclusion and Questions
Batch processing can be a huge time saver for repeated
tasks, but can easily cost you more in time than it
saves
– Consider delayed batch processing for very long tasks
Scripting is fabulous magic that is necessary for
implementing things that don‟t appear in the menus
(and even some things that do but don‟t work)
Consider scripting the “glue” that holds separate
utilities, functions and processes together
References
ERDAS Macro Language (EML) Reference
ERDAS Spatial Modeler Language (SML) Reference
ENVI IDL Tutorial:
http://www.msi.umn.edu/software/idl/tutorial/
ENVI ITT Product Tutorials:
http://www.ittvis.com/tutorials/index.asp
Coyote's Guide to IDL Programming:
http://www.dfanning.com/index.html
Related docs
Get documents about "