The official gave some explanations (address: SARscape/SARscape IDL Scripting/SARscape batch object) and some reference examples (address: SARscape/SARscape IDL Scripting/Example).
The secondary development of SARscape can be divided into 10 detailed steps. I will take the code developed by MultiLooking as an example to explain.
Step 1 Batch initialization and temporary directory settings (optional)
Start the SARscape module and set the temporary path.
SARscape_Batch_Init,Temp_Directory=aTmp
Step 2 Show all SARscape functions (optional)
This step is required for writing programs. After determining the name of the function (class) called by the SARScape module, it can be deleted. For specific usage, please refer to the official explanation mentioned above.
;(obj_new('SARscapeBatch'))->Manifest
Note: the latest versions can use "." Instead of "-" > ", it is still used for distinguishing attributes and structures
Step 3 Input data and parameters
You can open the ENVI SARscape module to view the required parameters
; 3) Input data and parameters ; inRasterName_data = theTestDir+Path_sep()+'_pwr'; ; outRasterName = theTestDir+Path_sep()+'output'+Path_sep()+'_geo'; ; inRasterName_dem = theTestDir+Path_sep()+'start_dem';; ; aGridSize = 25.0
Step 4 Load user specific default files
This default file is used to set cache files and SARscape preferences. For specific settings, refer to Blog
;4) Load user specific default files (i.e SARscape_preferences_user_Sentinel.sml)Optional ;/FJEA_Program/Resource/SARscape_preferences_user_Sentinel_TOPSAR.sml default_file_name = File_dirname(myResult.path)+Path_sep()+'Resource'+Path_sep()+'SARscape_preferences_user_Sentinel_TOPSAR.sml' aRet = SARscape_set_save_actual_default_in_dfl (default_file_name)
Step 5 Set working directory optional (optional)
;5) Set working directory optional IF (SARscape_set_working_in_actual_default(aWorkDir) EQ 'NotOK') THEN BEGIN ok = Dialog_message('You must initialize a valid working directory' ,/ERROR) SARscape_Batch_Exit Return ENDIF
Step 6 Create concrete objects
This one is used to select functions, such as importing sentinel 1 data, multi view, InSAR, DInDAR, filtering, clipping... The corresponding functions can be found in step 2;
; 6) establish IMPORTSENTINEL1FORMAT object aActualStep = 0 oSB = Obj_new('SARscapeBatch',Module='INSARCOMPLEXDATAMULTILOOKING') IF (~Obj_valid(oSB)) THEN BEGIN ; Object is invalid, then the user must manage the error ; sign out SARscape Batch processing SARscape_Batch_Exit Return ENDIF
Step 7 Fill in parameters
That is, you need to fill the parameters in the object in step 6. Check the parameters you need to fill in, and compare ENVI SARscape, as shown in the following figure;
;oSB.Listparams oSB->Setparam,'input_file_name', Files[index];Must be a one file process, so write loop oSB->Setparam,'output_file_name', Out_Path_Name
Step 8 Validation parameters
This step is used to verify whether the filled parameters are feasible.
;8) Validation parameters ok = oSB->Verifyparams(Silent=0) IF ~ok THEN BEGIN Print,' ************************************************************* ' Print,' The module cannot be executed; Some parameters need to be filled in ' Print,' ************************************************************* ' ; Exit from SARscape batch SARscape_Batch_Exit Return; ENDIF
Step 9 Process execution
Process the data according to the previously selected object and the set parameters;
;OK = oSB->Executeprogress() OK = oSB->Execute()
The difference between the above two codes is that the previous one has processing progress; The latter one has no progress; To use the previous code, you must open ENVI. You can also use the following code to judge whether ENVI is turned on to automatically select;
IF (Strpos(!PROMPT,'ENVI') GT -1 ) THEN BEGIN OK = oSB->Executeprogress(show_end_dialog='NotOK') ENDIF ELSE BEGIN OK = oSB->Execute(); ENDELSE IF ~ok THEN BEGIN Print,' Multi view processing: failed ' SARscape_Batch_Exit Return ENDIF
Step 10 Exit batch program
The last step is to close the SARScape module
; 10)Exit batch program SARscape_Batch_Exit
Note:
1. In the first sentence of the code, you need to add the following sentence. Due to the large range of remote sensing data, the conventional data space (for example, int 2 bytes) cannot be saved, so this code needs to be added, that is, to expand the data storage space and change the int type bytes to 4 bytes
COMPILE_OPT idl2
2. For the above codes, if the operation is wrong, the result will return 0 or NotOK. If it is correct, it will return 1 or OK. Therefore, judgment can be added to determine where the program is wrong;
Click to download the complete program (upload in a few days)
Although the road is endless and faraway, I still want to pursue the truth in the world.