-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Zachary Norman
committed
Jun 4, 2018
1 parent
320f4cb
commit baa13ab
Showing
6 changed files
with
146 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
;h+ | ||
; Copyright (c) 2018, Harris Geospatial Solutions, Inc. | ||
; | ||
; Licensed under MIT, see LICENSE.txt for more details | ||
;h- | ||
|
||
;+ | ||
; :Description: | ||
; Routine that allows users to execute any IDL | ||
; statement in an ENVI task and the ENVI modeler. | ||
; | ||
; This task does not return anything while running. | ||
; | ||
; | ||
; | ||
; :Keywords: | ||
; STATEMENT: in, required, type=string | ||
; Specify an IDL statement that you want to execute | ||
; as a task. | ||
; | ||
; :Author: Zachary Norman - GitHub: znorman-harris | ||
;- | ||
pro xtExecuteStatement,$ | ||
STATEMENT = statement | ||
compile_opt idl2, hidden | ||
|
||
;validate the input | ||
if (statement eq !NULL) then begin | ||
message, 'STATEMENT not specified, required!', LEVEL = -1 | ||
endif | ||
if ~isa(statement, /STRING) then begin | ||
message, 'STATEMENT specified, but is not a string!', LEVEL = -1 | ||
endif | ||
|
||
;execute the line | ||
if ~execute(statement) then begin | ||
help, /LAST_MESSAGE | ||
message, 'Error while executing statement!', LEVEL = -1 | ||
endif | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
;h+ | ||
; Copyright (c) 2018, Harris Geospatial Solutions, Inc. | ||
; | ||
; Licensed under MIT, see LICENSE.txt for more details | ||
;h- | ||
|
||
;+ | ||
; :Description: | ||
; Tests for the xtexecutestatement procedure and task. | ||
; | ||
; Running these tests requires additional code that | ||
; is not a part of this repository. | ||
; | ||
; :Author: Zachary Norman - GitHub: znorman-harris | ||
;- | ||
|
||
;get the current directory | ||
thisdir = file_dirname(routine_filepath()) | ||
|
||
;specify the task and PRO file | ||
taskFile = thisdir + path_sep() + 'xtexecutestatement.task' | ||
proFile = thisdir + path_sep() + 'xtexecutestatement.pro' | ||
|
||
;start ENVI | ||
e = envi(/HEADLESS) | ||
|
||
;create a luna tester | ||
l = luna(CONFIG_FILE = './../../idl.test.json') | ||
|
||
;create a suite | ||
s = l.suite('Test that our task file') | ||
|
||
; amke sure the task exist | ||
it = s.test('exists') | ||
|
||
(it.expects(1)).toEqual, file_test(taskFile) | ||
|
||
; make sure we have a valid task file | ||
it = s.test('is a valid task file') | ||
|
||
(it.expects(taskFile)).toBeAValidENVITask | ||
|
||
;create a suite | ||
s = l.suite('Test that we can') | ||
|
||
;validate procedure | ||
it = s.test('run as a procedure') | ||
|
||
; run procedure | ||
(it.expects('xtExecuteStatement')).toRunProcedure, $ | ||
STATEMENT = 'print, 5' | ||
|
||
; validate our task | ||
it = s.test('run as a task') | ||
|
||
task = ENVITask(taskFile) | ||
task.STATEMENT = 'print, 5' | ||
|
||
(it.expects(task)).toExecuteENVITask | ||
|
||
;generate a test summary | ||
l.GenerateTestSummary | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "XTExecuteStatement", | ||
"version": "5.3", | ||
"baseClass": "ENVITaskFromProcedure", | ||
"routine": "xtexecutestatement", | ||
"displayName": "XT Execute Statement", | ||
"description": "This task will execute any valid IDL statement. You will not get results back from running the code. The intended use was, but is not limited to, being able to run different IDL procedures that might initialize your environment prior to task processing. Note that this tool **requires** that you have ENVI + IDL started for use.", | ||
"parameters": [ | ||
{ | ||
"name": "STATEMENT", | ||
"displayName": "Statement", | ||
"description": "Specify the IDL statement that you want to execute.", | ||
"direction": "input", | ||
"parameterType": "required", | ||
"dataType": "string" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,4 +124,4 @@ pro xtQuacWithBadBandsList,$ | |
|
||
;clean up | ||
subset.close | ||
end | ||
end |