Update Workspaces

From Software Product Documentation
Jump to navigation Jump to search

Introduction

You can use a pipeline to loop over a series of CMZ files to update them (i.e. calculate measures you decided to create after creating the CMZ files).

This can also be done by creating a series of smaller scripts (ex. GRF_Impulse.v3s, Temporal_Distance_Metrics.v3s) and storing them in one folder. The benefit of creating a series of smaller scripts is that they're often easier to test and debug than one long script. Note that if name the scripts with numerals in front, they will be run in alphabetical order, so you can force the order the sub scripts are run (ex. 01_GRF_Impulse.v3s, 02_Temporal_Distance_Metrics.v3s).

You can copy/paste the example below into Visual3D/a text file or download the script here.

Example

! ============================================================================================
! Update a group of CMZ files
! ============================================================================================

! --------------------------------------------------------------------------------------------
! Pipeline Parameters
! --------------------------------------------------------------------------------------------

! Folder path containing data to be updated
! Note: This would be the top level folder:
!   C:\Data
! The data would then be in subfolders:
!   C:\Data\Sub01
!   C:\Data\Sob02

Set_Pipeline_Parameter
/PARAMETER_NAME=FOLDER_PATH
/PARAMETER_VALUE=C:\Data
! /PARAMETER_VALUE_SEARCH_FOR=
! /PARAMETER_VALUE_REPLACE_WITH=
! /PARAMETER_VALUE_PREFIX=
! /PARAMETER_VALUE_APPEND=
! /MULTI_PASS=FALSE
;

! Specify where the scripts you want to run on each CMZ file are located

Set_Pipeline_Parameter
/PARAMETER_NAME=SCRIPT_FOLDER_PATH
/PARAMETER_VALUE=C:\Data\Update_Scripts
! /PARAMETER_VALUE_SEARCH_FOR=
! /PARAMETER_VALUE_REPLACE_WITH=
! /PARAMETER_VALUE_PREFIX=
! /PARAMETER_VALUE_APPEND=
! /MULTI_PASS=FALSE
;

! --------------------------------------------------------------------------------------------
! Get List of CMZ Files to Update
! --------------------------------------------------------------------------------------------

Set_Pipeline_Parameter_To_List_Of_Files
/PARAMETER_NAME=CMZ_LIST
/FOLDER=::FOLDER_PATH&
/SEARCH_SUBFOLDERS=TRUE
/FILE_MASK=*.cmz
;

! --------------------------------------------------------------------------------------------
! Get List of Scripts to run
! --------------------------------------------------------------------------------------------

Set_Pipeline_Parameter_To_List_Of_Files
/PARAMETER_NAME=SCRIPT_LIST
/FOLDER=::SCRIPT_FOLDER_PATH&
/SEARCH_SUBFOLDERS=TRUE
/FILE_MASK=*.v3s
;

! --------------------------------------------------------------------------------------------
! Process Each CMZ
! --------------------------------------------------------------------------------------------

For_Each
/ITERATION_PARAMETER_NAME=CURRENT_CMZ
! /ITERATION_PARAMETER_COUNT_NAME=
/ITEMS=::CMZ_LIST
;

	! Clear the Workspace

	File_New

	;

	! Open one CMZ file

	File_Open
	/FILE_NAME=::CURRENT_CMZ
	! /SUFFIX=
	! /SET_PROMPT=File_Open
	! /FILTER=
	;

	! --------------------------------------------------------------------------------------------
	! Run Scripts
	! --------------------------------------------------------------------------------------------

	! Loop over each script in the Update Script folder

	For_Each
	/ITERATION_PARAMETER_NAME=CURRENT_SCRIPT
	! /ITERATION_PARAMETER_COUNT_NAME=
	/ITEMS=::SCRIPT_LIST
	;

		! Run the current script

		Call_Script 
		/SCRIPT_FILE_NAME=::CURRENT_SCRIPT
		! /SCRIPT_PATH=
		;

	End_For_Each
	/ITERATION_PARAMETER_NAME=CURRENT_SCRIPT
	;

	! Save CMZ File

	File_Save
	! /SET_PROMPT=Save CMO file
	;

	! Clear the workspace

	File_New

	;

End_For_Each
/ITERATION_PARAMETER_NAME=CURRENT_CMZ
;
Retrieved from ""